Announcement

  •  » Themes
  •  » [resolved] Custom header

#1 2010-06-14 03:15:34

developer
Guest

[resolved] Custom header

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!

 

#2 2010-06-14 07:27:04

tosca
Former Piwigo Team
Cévennes (France)
2006-09-23
567

Re: [resolved] Custom header

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)


My galleries : Photos, Watercolours, Recipes

Offline

 

#3 2010-06-14 07:44:18

VDigital
Former Piwigo Team
Paris (FR)
2005-05-04
17680

Re: [resolved] Custom header

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.


Piwigo.com: Start and run your own photo gallery. Signup and get 30 days to try for free, no commitment.
8-)

Offline

 

#4 2010-06-14 09:50:39

developer
Guest

Re: [resolved] Custom header

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?

 

#5 2010-06-14 10:03:14

developer
Guest

Re: [resolved] Custom header

For homepage I use it like this

Code:

            <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?

 

#6 2010-06-14 19:18:57

flop25
Piwigo Team
2006-07-06
7037

Re: [resolved] Custom header

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';


To get a better help : Politeness like Hello-A link-Your past actions precisely described
Check my extensions : more than 30 available
who I am and what I do : http://fr.gravatar.com/flop25
My gallery : an illustration of how to integrate Piwigo in your website

Offline

 

#7 2010-06-14 20:15:54

developer
Guest

Re: [resolved] Custom header

flop25, great! Thanks for advice!
Could you show at least 1 example of how can I call it from smarty, please?

 

#8 2010-06-15 17:14:18

flop25
Piwigo Team
2006-07-06
7037

Re: [resolved] Custom header

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


To get a better help : Politeness like Hello-A link-Your past actions precisely described
Check my extensions : more than 30 available
who I am and what I do : http://fr.gravatar.com/flop25
My gallery : an illustration of how to integrate Piwigo in your website

Offline

 

#9 2010-06-19 02:33:37

developer
Member
Honolulu, HI (United States)
2010-06-19
79

Re: [resolved] Custom header

flop25, thank you for your response, I am still learning smarty =)

So I used this code in clear theme themeconf.inc.php

Code:

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 16

Help, please.

Last edited by developer (2010-06-19 02:34:05)


400+ Magento Themes, each Magento template includes PSD file. See our gallery!

Offline

 

#10 2010-06-19 12:58:11

VDigital
Former Piwigo Team
Paris (FR)
2005-05-04
17680

Re: [resolved] Custom header

developer wrote:

flop25, thank you for your response, I am still learning smarty =)

So I used this code in clear theme themeconf.inc.php

Code:

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 16

Help, 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.


Piwigo.com: Start and run your own photo gallery. Signup and get 30 days to try for free, no commitment.
8-)

Offline

 

#11 2010-06-19 13:04:18

developer
Member
Honolulu, HI (United States)
2010-06-19
79

Re: [resolved] Custom header

Thank you, but still an error.

Code:

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']);


400+ Magento Themes, each Magento template includes PSD file. See our gallery!

Offline

 

#12 2010-06-19 17:25:34

flop25
Piwigo Team
2006-07-06
7037

Re: [resolved] Custom header

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)


To get a better help : Politeness like Hello-A link-Your past actions precisely described
Check my extensions : more than 30 available
who I am and what I do : http://fr.gravatar.com/flop25
My gallery : an illustration of how to integrate Piwigo in your website

Offline

 

#13 2010-06-19 21:10:32

VDigital
Former Piwigo Team
Paris (FR)
2005-05-04
17680

Re: [resolved] Custom header

{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.
;-)


Piwigo.com: Start and run your own photo gallery. Signup and get 30 days to try for free, no commitment.
8-)

Offline

 

#14 2010-06-19 21:14:29

VDigital
Former Piwigo Team
Paris (FR)
2005-05-04
17680

Re: [resolved] Custom header

Could you try $this in state of $template or $smarty?

{php}
global $page;
$this->assign($page['section'], 'tabs-selected');
{/php}


Piwigo.com: Start and run your own photo gallery. Signup and get 30 days to try for free, no commitment.
8-)

Offline

 

#15 2010-06-19 21:51:54

developer
Member
Honolulu, HI (United States)
2010-06-19
79

Re: [resolved] Custom header

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! =)


400+ Magento Themes, each Magento template includes PSD file. See our gallery!

Offline

 
  •  » Themes
  •  » [resolved] Custom header

Board footer

Powered by FluxBB

github twitter newsletter Donate Piwigo.org © 2002-2024 · Contact