[SOLVED] menutext in an array??

For questions and problems with the CMS core. This board is NOT for any 3rd party modules, addons, PHP scripts or anything NOT distributed with the CMS made simple package itself.
Post Reply
weaselweasel
Forum Members
Forum Members
Posts: 23
Joined: Mon Dec 03, 2007 9:32 pm

[SOLVED] menutext in an array??

Post 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?
Last edited by weaselweasel on Sun Feb 24, 2008 6:06 pm, edited 1 time in total.
alby

Re: menutext in an array??

Post by alby »

weaselweasel wrote: All I want is to print my menutext into a PHP-array.
So {menutext|print_r}?

Alby
weaselweasel
Forum Members
Forum Members
Posts: 23
Joined: Mon Dec 03, 2007 9:32 pm

Re: menutext in an array??

Post 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. :(
alby

Re: menutext in an array??

Post 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
weaselweasel
Forum Members
Forum Members
Posts: 23
Joined: Mon Dec 03, 2007 9:32 pm

Re: menutext in an array??

Post 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?
alby

Re: menutext in an array??

Post 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
weaselweasel
Forum Members
Forum Members
Posts: 23
Joined: Mon Dec 03, 2007 9:32 pm

Re: menutext in an array??

Post 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}
alby

Re: menutext in an array??

Post 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
weaselweasel
Forum Members
Forum Members
Posts: 23
Joined: Mon Dec 03, 2007 9:32 pm

Re: menutext in an array??

Post 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!! :D
Post Reply

Return to “CMSMS Core”