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?
[SOLVED] menutext in an array??
-
- Forum Members
- Posts: 23
- Joined: Mon Dec 03, 2007 9:32 pm
[SOLVED] menutext in an array??
Last edited by weaselweasel on Sun Feb 24, 2008 6:06 pm, edited 1 time in total.
Re: menutext in an array??
So {menutext|print_r}?weaselweasel wrote: All I want is to print my menutext into a PHP-array.
Alby
-
- Forum Members
- Posts: 23
- Joined: Mon Dec 03, 2007 9:32 pm
Re: menutext in an array??
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.
Normally, I can just type {menu_text} for the menutext to show, but that won't work now.

Re: menutext in an array??
Ok, never used menu_text.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.![]()
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
-
- Forum Members
- Posts: 23
- Joined: Mon Dec 03, 2007 9:32 pm
Re: menutext in an array??
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?
{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??
{if $page_alias == 'home'}This is home!{/if}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?
where home is alias name of your page
Alby
-
- Forum Members
- Posts: 23
- Joined: Mon Dec 03, 2007 9:32 pm
Re: menutext in an array??
Ok great!! This works.alby wrote:{if $page_alias == 'home'}This is home!{/if}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?
where home is alias name of your page
Alby
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??
Yesweaselweasel wrote: Now, if the page_alias is not home... Can I use {else} ?

{if $page_alias == 'home'}This is home!
{else}This is not home
{/if}
view smarty doc
Alby
-
- Forum Members
- Posts: 23
- Joined: Mon Dec 03, 2007 9:32 pm
Re: menutext in an array??
Solved!alby wrote:Yesweaselweasel wrote: Now, if the page_alias is not home... Can I use {else} ?,
{if $page_alias == 'home'}This is home!
{else}This is not home
{/if}
view smarty doc
Alby
Thanks a million!!
