I want to be able to display a user’s username with cakephp in my default.ctp view. Using the authComponent I know I can look up the userid, but how can I use this to look up the username from the users table? I’m used to doing this from a controller, I’m not sure how to do it within a view.
users table
userid | username
If you already know how to do it within a controller – then you’re done 99% of the battle. You just need to pass your user that you retrieved in the controller to the view.
In your controller:
In your view:
This is very basic Cake stuff, you should spend a little more time on the manual 🙂