mantisinc Posted October 11, 2008 Share Posted October 11, 2008 Looking to see if I can enclose items in { if } conditions that they will only display to people who are either logged in, or guests.If there is such a condition - anyone know what it is?Thanks in advance! Link to comment Share on other sites More sharing options...
vinoalvino Posted October 12, 2008 Share Posted October 12, 2008 Sorry I don't know in smarty directly: I use this code (peraps not the better way): /* get current id_customer in php file */ $cookie = new Cookie('ps'); $id_customer=intval($cookie->id_customer); $logged=($id_customer==0 ? false : true ); $smarty->assign('logged', $logged); in tpl file I use {if $logged } ... Link to comment Share on other sites More sharing options...
mantisinc Posted October 12, 2008 Author Share Posted October 12, 2008 Okay that worked a treat for displaying the content only to registered users.Now - what would the guest if condition be? Link to comment Share on other sites More sharing options...
vinoalvino Posted October 12, 2008 Share Posted October 12, 2008 Sorry :question: Link to comment Share on other sites More sharing options...
mantisinc Posted October 12, 2008 Author Share Posted October 12, 2008 As in, the code you would wrap around something so that it's only display to guests (unregistered), and not registered users? Link to comment Share on other sites More sharing options...
vinoalvino Posted October 12, 2008 Share Posted October 12, 2008 {if $logged}hi logged user{else}bla bla bla{/if} Link to comment Share on other sites More sharing options...
Recommended Posts