|
Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon. |
|
View previous topic :: View next topic |
Author |
Message |
davidu Smarty n00b
Joined: 21 Sep 2003 Posts: 2
|
Posted: Sun Sep 21, 2003 1:31 pm Post subject: Complex: Using SmartestSmartyMultilanguageSupport in plugin |
|
|
Ok,
Here's a look at my site first:
http://test:test@staging.everybox.com/
(you can login with username/password test/test)
On the left side I have that menu bar right. It uses SmartestSmartyMultilanguageSupport to make the menu text in multiple languages. My "navcol.tpl" looks like this:
Code: |
{if not $auth->getAuth()}
{include file="auth/login.tpl"}
{else}
{include file="auth/user.tpl"}
{/if}
{if $auth->getAuth()}
<div class="sidebox">
<div>{t}DNS Management{/t}:</div>
<a href="./">& Domains</a>
<a href="./">& BackupMX</a>
<a href="./">& Statistics</a>
</div>
{/if}
<div class="sidetext" id="light">
<div>{t}Support{/t}:</div>
<p>{t}To contact support...{/t}</p>
</div>
<div class="sidebox">
<div>{t}Reference{/t}:</div>
<a href="/docs/AboutUs">& {t}About Us{/t}</a>
<a href="/docs/Contribute">& {t}Contribute{/t}</a>
<a href="/docs/MailingLists">& {t}Mailing Lists{/t}</a>
<a href="/docs/GetInvolved">& {t}Get Involved{/t}</a>
<a href="/docs/Security">& {t}Security & Abuse{/t}</a>
</div>
|
Now I need to make the menu look different if, for example, the "About Us" page is clicked. So that people know where they are in the site. Normally I would write a function block like {menu page="About Us"} but that would make me lose my {t} translation.
How can I make a menu or have it go through the menu code and show what page the person is on while maintaining the i18n support.
Thanks,
David U. |
|
Back to top |
|
Troublegum Smarty Rookie
Joined: 07 Sep 2003 Posts: 33 Location: Germany
|
Posted: Sun Sep 21, 2003 3:34 pm Post subject: |
|
|
Well I think that is probably more a CSS/HTML problem.
You can try the following:
Code: | <div class="sidebox">
<div>{t}Reference{/t}:</div>
<a{if $filename == '..'} class="currentlink"{/if} href="/docs/AboutUs">& {t}About Us{/t}</a>
<a{if $filename == '..'} class="currentlink"{/if} href="/docs/Contribute">& {t}Contribute{/t}</a>
<a{if $filename == '..'} class="currentlink"{/if} href="/docs/MailingLists">& {t}Mailing Lists{/t}</a>
<a{if $filename == '..'} class="currentlink"{/if} href="/docs/GetInvolved">& {t}Get Involved{/t}</a>
<a{if $filename == '..'} class="currentlink"{/if} href="/docs/Security">& {t}Security & Abuse{/t}</a>
</div> |
You can easily use CSS to highlight the current location:
Code: | a:link.currentlink, a:visited.currentlink {
...
} |
The second approach is that you set a unique id for every link and define a style for this id in <head> area
Code: |
<head>
<style type="text/css">a#{$siteid} {literal} {
...
}{/literal}</style>
|
This way, you do not need to modify the menu's markup on every site. |
|
Back to top |
|
davidu Smarty n00b
Joined: 21 Sep 2003 Posts: 2
|
Posted: Sun Sep 21, 2003 4:17 pm Post subject: |
|
|
I had thought about this option. It's a possibility. I was just hoping for a more Smarty solution. With CSS I can't "get rid of the link" but maybe that's a good thing. I can certainly change the look of it.
Thanks. |
|
Back to top |
|
toma Smarty Regular
Joined: 25 Apr 2003 Posts: 62
|
Posted: Sun Sep 21, 2003 5:10 pm Post subject: |
|
|
{if $page == 'AboutUs'}<B>{else}
<a href="/docs/AboutUs">{/if}
{t}About Us{/t}
{if $page == 'AboutUs'}</B>{else}
</a>{/if}
is one solution |
|
Back to top |
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|