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've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

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   3108 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....