parent album names

brian_l

Joined: 2010-12-01
Posts: 7
Posted: Mon, 2010-12-06 22:11

I am trying to implement a "back to %s" button in my gallery

The layout is as follows:

 
main gallery
    Sub-gallery "photos"
               sub-sub-gallery "location1"
               sub-sub-gallery "location2"
               sub-sub-gallery "location3"

    Sub-gallery "videos"
               sub-sub-gallery "location"

I can create a link above the photos to take me back to ../
so if I'm in "photos/location1" the link takes me to "photos" and from "videos/location" back to "videos"

I want to have the link show the parent albums name.

ex.
you are on a photo page in sub-sub-gallery "location1" the link text is "back to Photos"

I don't know how to get the parent/parent album title.
something like:

 
{g->text text="Back to %s" arg1=$somevariable}

Hope this makes sense
thanks

 
suprsidr
suprsidr's picture

Joined: 2005-04-17
Posts: 8339
Posted: Tue, 2010-12-07 03:12
 
brian_l

Joined: 2010-12-01
Posts: 7
Posted: Tue, 2010-12-07 15:35

{g->text text="Back To %s" arg=$theme.item.parent.title}

Just prints:

Back To %s

on the page!

 
suprsidr
suprsidr's picture

Joined: 2005-04-17
Posts: 8339
Posted: Tue, 2010-12-07 15:43

set debug to buffered in config.php
it will popup a smarty window that contains all the available variables for the current page.

not all themes have the same variables.

-s
FlashYourWeb and Your Gallery with The E2 XML Media Player for Gallery2

 
brian_l

Joined: 2010-12-01
Posts: 7
Posted: Tue, 2010-12-07 16:08
 
main gallery
    Sub-gallery "photos"
               sub-sub-gallery "location1"
                       Photo-page that needs link here

<a href="">{$theme.parent.title|markup}</a>
gives me a link, but it is to the parent sub-sub-gallery "location1", not the "photos" gallery

does that make it clearer?

 
suprsidr
suprsidr's picture

Joined: 2005-04-17
Posts: 8339
Posted: Tue, 2010-12-07 16:13

{g->text text="Back To %s" arg=$theme.parent.title|markup}

-s
FlashYourWeb and Your Gallery with The E2 XML Media Player for Gallery2

 
brian_l

Joined: 2010-12-01
Posts: 7
Posted: Tue, 2010-12-07 16:53

I got it to work but it's a pretty poor hack:
borrowed some code

{foreach name=parent from=$theme.parents item=parent}
   {if $smarty.foreach.parent.iteration ==2}
       <p><a href="../"> {$parent.pathComponent}</a></p>
  {/if}
{/foreach}

it does give me the name "Photos", or "Videos" though.
I just don't like the "../"
oh well, I'll just keep at it.
Thanks!

 
brian_l

Joined: 2010-12-01
Posts: 7
Posted: Tue, 2010-12-07 18:21

Working!

{foreach name=parent from=$theme.parents item=parent}
 {if $smarty.foreach.parent.iteration ==2}
    <p><a href="{g->url params=$parent.urlParams}">
       {g->text text="Back to %s" arg1=$parent.pathComponent|markup}</a></p>
 {/if}
{/foreach}