Jump to:

17452 Posts in 4473 Topics by 1971 members

Archive

SilverStripe Forums » Archive » Get $Title from Page.php

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

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

Page: 1
Go to End
Author Topic: 1609 Views
  • tofola
    Avatar
    Community Member
    1 Post

    Get $Title from Page.php Link to this post

    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);
    }

  • Fuzz10
    Avatar
    Community Member
    787 Posts

    Re: Get $Title from Page.php Link to this post

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

    1609 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.