Jump to content

Menu swap in layout.tpl


Felipe

Recommended Posts

I wonder if anybody in here would help me, please, solve the following... I'm coding my web site template to have two menus, in accordance to the requested ".tpl" file. Actually, in case the user is requesting the frontpage_main.tpl, it should use one block of html tags, and in case it is any other .tpl file, it should be another block of html tags. So my question is: is there any phpVMS native class + method I can put in the if() statement to check which .tpl file the user is requesting? Id it does not, how could I solve it by simply using php?

Link to comment
Share on other sites

  • Moderators

Open the appropriate file (in the default version of phpvms it is named core_navigation.tpl) and just use this:

<?php
if(!Auth::LoggedIn())
{
?>
//The meeus you want to show if a user is not logged in
<?php } else { ?>
//The menus you want to show if he is logged in
<?php } ?>

Link to comment
Share on other sites

Hello, servetas! This was my first try, but, actually, I realized the are some "" that should be shown to both logged in and not. I guesse the best solution would be working on the layout.tpl, since this part...

<ul class="nav">
 <?php
  Template::Show('core_navigation.tpl');
 ?>
 </ul>

... fits for what I want. I just have to have an if() statement in here to check if the request is for the frontpage_main.tpl or any other .tpl.

Link to comment
Share on other sites

  • Moderators

Ok. you may use the if statement i send you wherever you want.

<?php
if(!Auth::LoggedIn())
{
?>
//The .tpl file you want to show if a user is not logged in
<?php } else { ?>
//The .tpl file you want to show if he is logged in
<?php } ?>

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...