Joaogl Posted November 17, 2011 Report Share Posted November 17, 2011 Hello guy's, E put in the directory("/public_html/core/modules/adicionar") this code: <?php class adicionar extends CodonModule { public function index() { Template::Show('adicionar.tpl'); } } ?> . now the problem is, when i put this(<?php echo $userinfo->firstname; ?>) in the file(adicionar.tpl), the pilot's name does not appear to me why? ho and i'm logged in.... Quote Link to comment Share on other sites More sharing options...
Administrators Nabeel Posted November 17, 2011 Administrators Report Share Posted November 17, 2011 YOu have to do $this->set('userinfo', Auth::$userinfo) to set the $userinfo variable to the view I think its Auth::$userinfo Quote Link to comment Share on other sites More sharing options...
Joaogl Posted November 17, 2011 Author Report Share Posted November 17, 2011 YOu have to do $this->set('userinfo', Auth::$userinfo) to set the $userinfo variable to the view I think its Auth::$userinfo were in the ("/public_html/core/modules/adicionar") or in the(adicionar.tpl)?? Quote Link to comment Share on other sites More sharing options...
bunoire14 Posted November 18, 2011 Report Share Posted November 18, 2011 were in the ("/public_html/core/modules/adicionar") or in the(adicionar.tpl)?? You would want to set your variables in the controller, so you would place it in "modules/adicionar/adicionar.php" Another good tip if you are unsure whats being passed to your templates is run a simple vardump: var_dump($userinfo); This will give you a break down of the Objects/Variables being passed into your template. Hope this helps, Quote Link to comment Share on other sites More sharing options...
Joaogl Posted November 20, 2011 Author Report Share Posted November 20, 2011 You would want to set your variables in the controller, so you would place it in "modules/adicionar/adicionar.php" Another good tip if you are unsure whats being passed to your templates is run a simple vardump: var_dump($userinfo); This will give you a break down of the Objects/Variables being passed into your template. Hope this helps, Hello, When i do: <?php class adicionar extends CodonModule { public function index() { Template::Show('adicionar.tpl'); var_dump($userinfo); } } ?> the <?php echo $userinfo->firstname; ?> still doesn't work but add a "NULL" in the bottom of the page: See the image please. How i can resolve that? Quote Link to comment Share on other sites More sharing options...
Joaogl Posted November 22, 2011 Author Report Share Posted November 22, 2011 Please i really need help..... Quote Link to comment Share on other sites More sharing options...
Administrators simpilot Posted November 23, 2011 Administrators Report Share Posted November 23, 2011 You need to set the variable in the controller before you try to see what is in it. Try this in your controller; <?php class adicionar extends CodonModule { public function index() { $this->show('adicionar.tpl'); $this->set('userinfo', Auth::$userinfo); } } ?> then in your template use <?php var_dump($userinfo); ?> to see what is available. If the user is not logged in you are not going to get any data using this method, it should be only used on pages only available to logged in users. Quote Link to comment Share on other sites More sharing options...
Joaogl Posted November 23, 2011 Author Report Share Posted November 23, 2011 Hello guy's, <?php class adicionar extends CodonModule { public function index() { $this->show('adicionar.tpl'); $this->set('userinfo', Auth::$userinfo); } } ?> and on template <style type="text/css"> #tabledlistcolor { color: #069; } .style1 {color: #669900} </style> <?php Auth::$userinfo ?> <h3>*Reservar um Oasis/Aldeia <?php echo $userinfo->firstname; ?>*</h3> <p> </p> and still doesn't work i and i m logged in Quote Link to comment Share on other sites More sharing options...
Administrators simpilot Posted November 23, 2011 Administrators Report Share Posted November 23, 2011 Change; $this->show('adicionar.tpl'); $this->set('userinfo', Auth::$userinfo); to $this->set('userinfo', Auth::$userinfo); $this->show('adicionar.tpl'); Quote Link to comment Share on other sites More sharing options...
Joaogl Posted November 23, 2011 Author Report Share Posted November 23, 2011 thank you really thank you now its working. hehehhe Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.