I'm a Cake noob, could someone help me out with this question? I'm
pretty sure this is a syntax issue:

What I am trying to do is click a link and pass a variable back to a
function in my controller.

Here's the controller code:

<?php

        class BlogpostsController extends AppController {
                var $name = "Blogposts";
                var $scaffold;

                //disables the index in the scaffolding and inserts our 
own...index
is Cake's way of saying get every record for blogpost...
                //we are assigning the results of the query to the array "posts"
                function index() {
                        $this->set('posts',$this->Blogpost->find('all'));
                }

                function viewuser($userid) {
                        $this->set('thisuser', $this->User->find($userid));
                }
        }

and in my .cpt file I have this line...

<td class="user"><?=$html->link($post['User']['name'], 'viewuser');?></
td>

which I know won't work because I am not passing any arguments...I get
this error to confirm that:

Warning (2) <javascript:void(0);> : Missing argument 1 for viewuser()
[APP/controllers/blogposts_controller.php, line 13]

But I'm stuck on the correct way to write this...

<td class="user"><?=$html->link($post['User']['name'],
array['viewuser'][argument]);?></td>

Any help would be appreciated...

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected] For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en

Reply via email to