Jump to:

17452 Posts in 4473 Topics by 1971 members

Archive

SilverStripe Forums » Archive » including php in pages

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

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

Page: 1 2
Go to End
Author Topic: 3409 Views
  • Matt Hardwick
    Avatar
    Community Member
    61 Posts

    Re: including php in pages Link to this post

    It still doesn't make any sense.

    Whatever I try I get :

    XML Parsing Error: not well-formed
    Location: http://yoog.co.uk/new-playlistpage/
    Line Number 101, Column 4:

    Or something very similar.

  • Matt Hardwick
    Avatar
    Community Member
    61 Posts

    Re: including php in pages Link to this post

    OK I have got what I needed now.

    PlaylistPage.php:

    <?php
    /**
    * Defines the Playlist page type
    */

    class PlayListPage extends Page {
    static $db = array(
    );
    static $has_one = array(
    );

    function getAList() { return "something returns but this is just a string for testing";}
    function Content() { $content = $this->Content; $content = str_replace('[[aList]]', $this->getAList(), $content); return $content; }

    }

    class PlayListPage_Controller extends Page_Controller {

    }
    ?>

    Now I can put [[aList]] in the content box in the CMS and I get the test text comes back in the editor. This is what I needed. I have to think about my editors.

    Thanks for your help guys.

  • Willr
    Avatar
    Forum Moderator
    5489 Posts

    Re: including php in pages Link to this post

    XML Parsing Error: not well-formed
    Location: http://yoog.co.uk/new-playlistpage/
    Line Number 101, Column 4:

    Watch out for that. The default theme sends the html as pure xml which is picky. You can disable it (and avoid errors like this) http://doc.silverstripe.com/doku.php?id=contentnegotiator

  • Matt Hardwick
    Avatar
    Community Member
    61 Posts

    Re: including php in pages Link to this post

    It seems so simple once it's done. I suppose it's just getting used to a different way of doing things!

    Thanks again.

    3409 Views
Page: 1 2
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.