CakePHPでTwitterのクローンサイトを作成しています。(課題用)以下の機能を実現したく、その機能自体が可能なのか、また実現するには具体的に使うべき文法やどのような工程を踏めばいいか教えて頂きたいです。
<実現したいこと>
ユーザー名のリンクをクリックすると DBからそのユーザーの情報(username、profile image)を表示する画面に移動。そこからFollow Unfollowができる。
<現状>
現状は以下のコードでユーザーの検索昨日までは作成済みです。
UsersController.php public function find() { $userNameKeyword=$this->request->data['Users']['username']; $users=$this->User->find('all', [ 'conditions' => [ 'User.username LIKE' => '%'.$userNameKeyword.'%' ], ]); $this->set('users',$users); $this->render(); } コード
find.ctp <div class="row-fluid"> <div class="span9"> <table class="table"> <tr> <th><?php echo $this->Paginator->sort('id','ID');?></th> <th><?php echo $this->Paginator->sort('username','username');?></th> </tr> <?php foreach($users as $key => $user):?> <tr> <td><?php echo h($user['User']['id']); ?></td> <td><?php echo $this->Html->link($user['User']['username'],'/users/find/');?></td> </tr> <?php endforeach;?> </table> </div> <div class="span3"> <div class="well" style="margin-top:20px;"> <?php echo $this->Form->create('Users',array('url'=>'find')); ?> <fieldset> <legend>Search user</legend> </fieldset> <?php echo $this->Form->input('username', array('label' => 'Enter Username', 'class' => 'span12', 'empty' => true)); ?> <?php echo $this->Form->end('Search'); ?> </div> </div> </div> コード

回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2019/06/13 02:45