Smarty Forum Index Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon.

Complex: Using SmartestSmartyMultilanguageSupport in plugin

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> General
View previous topic :: View next topic  
Author Message
davidu
Smarty n00b


Joined: 21 Sep 2003
Posts: 2

PostPosted: Sun Sep 21, 2003 1:31 pm    Post subject: Complex: Using SmartestSmartyMultilanguageSupport in plugin Reply with quote

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
View user's profile Send private message
Troublegum
Smarty Rookie


Joined: 07 Sep 2003
Posts: 33
Location: Germany

PostPosted: Sun Sep 21, 2003 3:34 pm    Post subject: Reply with quote

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
View user's profile Send private message
davidu
Smarty n00b


Joined: 21 Sep 2003
Posts: 2

PostPosted: Sun Sep 21, 2003 4:17 pm    Post subject: Reply with quote

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
View user's profile Send private message
toma
Smarty Regular


Joined: 25 Apr 2003
Posts: 62

PostPosted: Sun Sep 21, 2003 5:10 pm    Post subject: Reply with quote

{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
View user's profile Send private message Visit poster's website
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> General All times are GMT
Page 1 of 1

 
Jump to:  
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
Protected by Anti-Spam ACP