I am new to KPHP. This is the navigation section that I am using in one of my cake PHP websites:
& lt ;? Php $ list = array ($ this-> html- & gt; link ('home', array ('admin' => gtk; 'page', 'action' => index), $ ('About', 'array' ('Admin' = & gt; 'page' 'action' => about '' '), array ($ this- & Gt; HTML- & gt; tags ('span', null, array ('class' = & gt; 'top')), $ this-> HTML- & gt; tags ('span', null, Array ('class' = & gt; 'bottom')), $ this-> HTML- & gt; link ('sub menu 1', array ('controller' = & gt; '', 'verb' & Gt; '')), $ this-> HTML- & gt; Link ('sub menu 2', array ('controller' => gt; '', 'action' =>) , $ This- & gt; HTML- & gt; Link ('sub menu 3', array ('admin' =>; '', 'verb' =>; '')), , $ This- & gt; HTML- & gt; Link ('Gallery', array ('Controller' = & gt; 'Page', 'Action' => Gallery ')), Array ($ this- & ('Span', zero, array ('square' => 'top')), $ - this-> HTML- & gt; tags ('span', null, Array ('class' = & gt; 'bottom')), $$ - & gt; HTML- & gt; link ('sub menu 1', array ('controller' = & gt; '', 'Verb' = & gt; '')), $ This-> HTML-> Link ('sub men u2', array ('controller' => gt; '', 'verb' =>) ", $-this-> HTML-> Link ('sub menu 3', array ('controller' => gt; '', 'verb' =>; '')),), $ this- & gt; HTML-> Link ('My Post', Array ('Controller' => gtk; 'Page', 'Action' = & gt; 'MyPosts / 1')), $ this- & gt; HTML-> Link ('blog', array ('admin' => gtc: 'page', 'verb' = & gt; 'blog')), $$ - & gt; Html-> Link ('Contacts', array ('Controller' => gtk; 'page', 'verb' = & gt; 'contact')), $ this- & gt; HTML-> Link ('logout', array ('admin' => gt; 'user', 'verb' = & gt; 'logout'))); Echo $ this-> Html-> Nested list ($ list); ? & Gt; What do I need, "My posts" and "Logout" menus will be shown and only one user will be logged in, otherwise not. how to do this ? And, do you have a better idea to create a navigation bar in Cape PhP?
Here the span tag is used only for design issues.
first solution
create a separate array for you to log in to the user And it will be auth functions such as
Controller $ this-> Set ('authUser', $ this-> AUTH- & gt; User ()); OR
$ this-> Set ('authUser', $ this-> AUTH- & gt; Login ()); In if ($ authUser) {$ list = array (/ * without posts and logout * /); } And {$ list = array (/ * same full array * /); } Second Solution if ($-> this-> session-> read ('AUTH.User ')) {$ List = array (/ * without posts and logout * /); } And {$ list = array (/ * same full array * /); }
No comments:
Post a Comment