Hello,
I am using Piwigo 2.1.1 and I'd like to create custom heading like tabs. I want to have 5 tabs
Home, Category1, Best rated, Recently Added, Category 2
How can I assign class "selected" whenever users in one of those sections? Could you provide detailed instruction how can I make it work? I understand general conception how it should work, but I still can't make it work =(
Your help is greatly appreciated!
Try [extension by grum] Advanced Menu Manager with a theme of your own.
More information about creating a theme in [Forum, topic 16001] Theme creation in 2.1
Last edited by tosca (2010-06-14 07:29:18)
Offline
You want to highlight the selected tab in your horizontal menubar.
That's different from what [extension by grum] Advanced Menu Manager is doing.
Currently I have no idea how to do it.
Offline
I don't want to install extra plugins, that's way too much extra code that I don't need.
I just need the ability to reference and highlight tabs.
Any suggestions?
For homepage I use it like this
<li {if ( $TITLE == '<a href="http://localhost/gallery/">Home</a>' )} class="tabs-selected" {/if} >
Could you help me with the rest of the tabs, please?
you have to use the php tag in smarty, in order to use
global $page ;
and checking the value of $page['section']
$page['section'] = 'tags';
$page['section'] = 'categories';
$page['section'] = 'favorites';
$page['section'] = 'most_visited';
$page['section'] = 'best_rated';
$page['section'] = 'recent_pics';
$page['section'] = 'recent_cats';
$page['section'] = 'search';
$page['section'] = 'list';
Offline
flop25, great! Thanks for advice!
Could you show at least 1 example of how can I call it from smarty, please?
http://www.smarty.net/manual/en/languag … on.php.php
so in header.tpl
{php}
global $page ;
$smarty->assign($page['section'], 'VALUE');
{/php}
and then in the .tpl
{if isset ($most_visited) } class="{$most_visited}"
...
Or you may do it in themeconf.inc.php
global $page ;
$smarty->assign($page['section'], 'VALUE');
please keep us informed
Offline
flop25, thank you for your response, I am still learning smarty =)
So I used this code in clear theme themeconf.inc.php
global $page; $smarty->assign($page['section'], 'most_visited');
and than from the header.tpl I called it as you've mentioned
{if isset ($most_visited) } class="{$most_visited}"{/if}
but I am getting an error
Notice: Undefined variable: smarty in \gallery\themes\clear\themeconf.inc.php on line 16
Fatal error: Call to a member function assign() on a non-object in \gallery\themes\clear\themeconf.inc.php on line 16
Help, please.
Last edited by developer (2010-06-19 02:34:05)
Offline
developer wrote:
flop25, thank you for your response, I am still learning smarty =)
So I used this code in clear theme themeconf.inc.phpCode:
global $page; $smarty->assign($page['section'], 'most_visited');and than from the header.tpl I called it as you've mentioned
Code:
{if isset ($most_visited) } class="{$most_visited}"{/if}but I am getting an error
Notice: Undefined variable: smarty in \gallery\themes\clear\themeconf.inc.php on line 16
Fatal error: Call to a member function assign() on a non-object in \gallery\themes\clear\themeconf.inc.php on line 16Help, please.
Correct syntax is:
global $page, $template;
$template->assign( 'most_visited', $page['section']);
But you wrote "So I used this code in clear theme themeconf.inc.php" and this has no real sense.
Offline
Thank you, but still an error.
Fatal error: Call to a member function assign() on a non-object in \gallery\themes\clear\themeconf.inc.php on line 16
Line 16 is $template->assign( 'most_visited', $page['section']);
Offline
you may have forgotten the global var template
and no Vdigital my code was right ! He wants to display "tabs-selected" and not "most_visited"
so I maintain : in header.tpl
{php}
global $page, $template ;
$smarty->assign($page['section'], 'tabs-selected');
{/php}
and then in the .tpl where you have your menu :
{if isset ($most_visited) } class="{$most_visited}"
ps : and do it in a new theme instead of modifying an existing one
Last edited by flop25 (2010-06-19 17:26:39)
Offline
{php}
global $page, $template ;
$smarty->assign($page['section'], 'tabs-selected');
{/php}
???
developer wrote:
but I am getting an error
Notice: Undefined variable: smarty in \gallery\themes\clear\themeconf.inc.php on line 16
Fatal error: Call to a member function assign() on a non-object in \gallery\themes\clear\themeconf.inc.php on line 16
I am not looking on what you are advising but just looking on coded lines.
HTH.
;-)
Offline
Could you try $this in state of $template or $smarty?
{php}
global $page;
$this->assign($page['section'], 'tabs-selected');
{/php}
Offline
VDigital wrote:
Could you try $this in state of $template or $smarty?
{php}
global $page;
$this->assign($page['section'], 'tabs-selected');
{/php}
AWESOME! With "this" it worked perfectly with new theme and with default.
VDigital and flop25, Thank you very much for help! =)
Offline