Page 1 of 1
[SOLVED] menutext in an array??
Posted: Sun Feb 24, 2008 3:16 am
by weaselweasel
Hello.
I'm quite a PHP-noob, and now I'm stuck with a little problem.
All I want is to print my menutext into a PHP-array.
Something like {php}$my_array = {menu_text} {/php}
But that doesn't work. I tried lots of different ways, but I can't figure out how to get this right.
Anyone?
Re: menutext in an array??
Posted: Sun Feb 24, 2008 11:37 am
by alby
weaselweasel wrote:
All I want is to print my menutext into a PHP-array.
So {menutext|print_r}?
Alby
Re: menutext in an array??
Posted: Sun Feb 24, 2008 5:05 pm
by weaselweasel
No, the thing is: inside a {PHP}, I can't use tags. They simply don't work.
Normally, I can just type {menu_text} for the menutext to show, but that won't work now.

Re: menutext in an array??
Posted: Sun Feb 24, 2008 5:35 pm
by alby
weaselweasel wrote:
No, the thing is: inside a {PHP}, I can't use tags. They simply don't work.
Normally, I can just type {menu_text} for the menutext to show, but that won't work now.
Ok, never used menu_text.
This tag printing the menu name of current page,
no array but string.
What exactly do you need?
If possible use
UDT and not
{php}
Alby
Re: menutext in an array??
Posted: Sun Feb 24, 2008 5:49 pm
by weaselweasel
This is what I use (but doesn't work):
{php} $pagetitle ='{menutext}'; {/php}
{php}if ( $pagina == "home" ) { echo "This is home!" } {/php}
How can I do this with UDT?
Re: menutext in an array??
Posted: Sun Feb 24, 2008 5:52 pm
by alby
weaselweasel wrote:
This is what I use (but doesn't work):
{php} $pagetitle ='{menutext}'; {/php}
{php}if ( $pagina == "home" ) { echo "This is home!" } {/php}
How can I do this with UDT?
{if $page_alias == 'home'}This is home!{/if}
where home is alias name of your page
Alby
Re: menutext in an array??
Posted: Sun Feb 24, 2008 5:59 pm
by weaselweasel
alby wrote:
weaselweasel wrote:
This is what I use (but doesn't work):
{php} $pagetitle ='{menutext}'; {/php}
{php}if ( $pagina == "home" ) { echo "This is home!" } {/php}
How can I do this with UDT?
{if $page_alias == 'home'}This is home!{/if}
where home is alias name of your page
Alby
Ok great!! This works.
Now, if the page_alias is not home... Can I use {else} ?
Like:
{if $page_alias == 'home'}This is home!{/if} {else}This is not home{/else}
Re: menutext in an array??
Posted: Sun Feb 24, 2008 6:01 pm
by alby
weaselweasel wrote:
Now, if the page_alias is not home... Can I use {else} ?
Yes

,
{if $page_alias == 'home'}This is home!
{else}This is not home
{/if}
view
smarty doc
Alby
Re: menutext in an array??
Posted: Sun Feb 24, 2008 6:06 pm
by weaselweasel
alby wrote:
weaselweasel wrote:
Now, if the page_alias is not home... Can I use {else} ?
Yes

,
{if $page_alias == 'home'}This is home!
{else}This is not home
{/if}
view
smarty doc
Alby
Solved!
Thanks a million!!
