Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We're retiring the forums!

The SilverStripe forums have passed their heyday. They'll stick around, but will be read only. We'd encourage you to get involved in the community via the following channels instead:

Archive /

Our old forums are still available as a read-only archive.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo

problem in function with $MenuTitle


Go to End


2 Posts   1374 Views

Avatar
ojalà

Community Member, 87 Posts

15 October 2008 at 3:53am

HI!
I waht to usea function in Page.php to print only 3 entry of $MenuTitle.
So I use this code:

function Ciclo_menu()
{
$array = $MenuTitle;
for($i=0;$i<3;$i++)
$nuovo_menu = $array[$i];
return $nuovo_menu;

}

something is wrong, is it possible to use $menuTitle varable in Page.php function?

Avatar
Willr

Forum Moderator, 5523 Posts

15 October 2008 at 1:16pm

$MenuTitle would refer to the variable $MenuTitle in that function, you need to refer to the MenuTitle on the 'Object' rather then the function by doing

$this->MenuTitle