MyBB Community Forums

Full Version: Move top links to another template file
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello there !

First of all : My forum (v 1.8.7)

Test account : 
  • User name : Test
  • Password : 123456Ab
I'm having fun editing the template of the forum, and one thing I'd like to do is displaying top links (Research, Memberlist, etc.) only when user is logged in.

So i thought "No problem, just take the appropriate code in "header" template and move it to "header_welcomeblock_member" !". But no...

So i took the following code from header : 

<ul class="menu top_links">
	{$menu_portal}
	{$menu_search}
	{$menu_memberlist}
	{$menu_calendar}
	<li><a href="{$mybb->settings['bburl']}/misc.php?action=help" class="help">{$lang->toplinks_help}</a></li>
</ul>

And put it in header_welcomeblock_member like this :

<!-- Continuation of div(class="upper") as opened in the header template -->
	<ul class="menu top_links">
		{$menu_portal}
		{$menu_search}
		{$menu_memberlist}
		{$menu_calendar}
		<li><a href="{$mybb->settings['bburl']}/misc.php?action=help" class="help">{$lang->toplinks_help}</a></li>
	</ul>
	<span class="welcome">{$lang->welcome_back} <a href="{$mybb->settings['bburl']}/member.php?action=logout&amp;logoutkey={$mybb->user['logoutkey']}" class="logout">{$lang->welcome_logout}</a></span>
	</div>
</div>
<div class="lower">
...

I've been doing that kind of thing a lot recently, so I know sometimes I won't get the same results because of CSS.
But this time the problem is that it doesn't even inject the code of menu_portal, menu_search, etc. (Which I didn't change btw).
The HTML result I get is the following :

<ul class="menu top_links">
		
		
		
		
	<li><a href="http://forum.egides.com/misc.php?action=help" class="help">Aide</a></li>
</ul>

Is this normal ? Why doesn't it recognize the tags ? Can I do anything about it ? Sad

Thank you for your time !
Use this code instead:
    <ul class="menu top_links">
         <li><a href="{$mybb->settings['bburl']}/portal.php" class="help">Portal</a></li>
         <li><a href="{$mybb->settings['bburl']}/search.php" class="help">Search</a></li>
         <li><a href="{$mybb->settings['bburl']}/memberlist.php">Members</a></li>
         <li><a href="{$mybb->settings['bburl']}/calander.php" class="help">Calander</a></li>
        <li><a href="{$mybb->settings['bburl']}/misc.php?action=help" class="help">{$lang->toplinks_help}</a></li>
    </ul>

Some variables are hard-coded to only show up in specific parts of the template. But you can always work around it by creating an alternative like the one i showed above
Ooooh... Ok ! This works fine thank you very much !

Any idea where those variables are injected into templates ? I'd love to learn more about how it works.