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

Get $Title from Page.php


Go to End


2 Posts   2609 Views

Avatar
tofola

Community Member, 1 Post

19 November 2008 at 2:27am

I am going to replace each $Title with an Image. The Image replacement work, but I can not find a way to pass the $Title variable from the .ss file to the actual function in Page.php.

ss template:

 $ifr($Test)  <-- This do not work!

Php:

 function ifr($text) {
        $text = DataObject::get('Title');
        doIfr($text);
    }

Avatar
Fuzz10

Community Member, 791 Posts

19 November 2008 at 2:45am

If you want to replace just the Titles , why not override the Title method in your class ?

e.g. :

function Title() {
return $this->doIfr($this->Title);
}

or something along those lines....