customizing the global nav

cois

Joined: 2010-01-15
Posts: 2
Posted: Fri, 2010-01-15 11:33

I'm new to gallery and I'm just trying to help a friend out with getting his gallery up and running.
One thing we would like to do is add specific ID's or Classes to the links, as well as, a span within the anchor to do a quick and dirty image swap on the text.
...
I've been searching around and from what I can tell I need to create a local version of a file in the theme.
What I'm not sure about is if it's SystemLinks.tpl or SystemLink.tpl which I need to edit.
Here is what is currently rendered...

Quote:
<span class="block-core-SystemLink">
<a href="main.php?g2_view=core.SiteAdmin&amp;g2_return=main.php%3Fg2_view%3Dcore.UserAdmin%26g2_subView%3Dcore.UserLogin%26g2_itemId%3D7">Site Admin</a>
</span>
<span class="block-core-SystemLink">

<a href="main.php?g2_view=core.UserAdmin&amp;g2_subView=core.UserPreferences&amp;g2_return=main.php%3Fg2_view%3Dcore.UserAdmin%26g2_subView%3Dcore.UserLogin%26g2_itemId%3D7">Your Account</a>
</span>
<span class="block-core-SystemLink">
<a href="main.php?g2_controller=core.Logout&amp;g2_return=main.php%3Fg2_view%3Dcore.UserAdmin%26g2_subView%3Dcore.UserLogin%26g2_itemId%3D7">Logout</a>
</span>

Here is what I'd like to be able to render...

Quote:
<span class="block-core-SystemLink">
<a class="menu_site-admin" href="main.php?g2_view=core.SiteAdmin&amp;g2_return=main.php%3Fg2_view%3Dcore.UserAdmin%26g2_subView%3Dcore.UserLogin%26g2_itemId%3D7"><span>Site Admin</span></a>
</span>
<span class="block-core-SystemLink">

<a class="menu_your-account" href="main.php?g2_view=core.UserAdmin&amp;g2_subView=core.UserPreferences&amp;g2_return=main.php%3Fg2_view%3Dcore.UserAdmin%26g2_subView%3Dcore.UserLogin%26g2_itemId%3D7"><span>Your Account</span></a>
</span>
<span class="block-core-SystemLink">
<a class="menu_logout" href="main.php?g2_controller=core.Logout&amp;g2_return=main.php%3Fg2_view%3Dcore.UserAdmin%26g2_subView%3Dcore.UserLogin%26g2_itemId%3D7"><span>Logout</span></a>
</span>

Any guidance would be greatly appreciated.

 
suprsidr
suprsidr's picture

Joined: 2005-04-17
Posts: 8339
Posted: Fri, 2010-01-15 12:08

I don't believe using the local directory works with module templates including core.
Try editing the original - and remember to flush the template cache in admin -> maintenance after each change.
You may still want to keep a copy of your changes in the local directory to have handy after future upgrades.

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

 
cois

Joined: 2010-01-15
Posts: 2
Posted: Fri, 2010-01-15 22:42

So here is my solution.
I created a local folder within modules/core/templates/blocks and copied the SystemLinks.tpl file into it.

Lines 31 and 32

    <a href="{g->url
       params=$theme.systemLinks[$linkId].params}">{$theme.systemLinks[$linkId].text}</a>

And here is what I changed it to...

    <a class="menu_{$theme.systemLinks[$linkId].text|strtolower|replace:' ':'-'|regex_replace:"/[^a-zA-Z0-9_\-]/":""|strip}" href="{g->url
       params=$theme.systemLinks[$linkId].params}"><span>{$theme.systemLinks[$linkId].text}</span></a>

So, if the text in my link is "Your Account" it now has a class of "menu_your-account"

 
alecmyers

Joined: 2006-08-01
Posts: 4342
Posted: Fri, 2010-01-15 23:52
Quote:
I don't believe using the local directory works with module templates including core.

Yep - it does. All Smarty templates in G2.