Jump to:

17452 Posts in 4473 Topics by 1971 members


SilverStripe Forums » Archive » Can you?

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: 1210 Views
  • ladrao2007
    Community Member
    16 Posts

    Can you? Link to this post

    Can you insert raw php code into the content section of a page in the admin part of the CMS? Or is there a way to insert php code into a page?

  • Willr
    Forum Moderator
    5511 Posts

    Re: Can you? Link to this post

    No you cannot insert PHP in the text view. Though you can to a token in the text view for example you can you do $MyToken in the text editor then in your Page.php - Page_Controller class have a method

    function Content() {
    return str_replace('$MyToken', $this->CustomPHPCode(), $this->Content);

    function CustomPHPCode() {
    return "Hi!";
    Then that will insert the CustomPHPCode() ("Hi!") in where every you have $MyToken in the template.


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.