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.

Archive /

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

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

including php in pages


Go to End
Reply


12 Posts   3607 Views

Avatar
Matt Hardwick

Community Member, 61 Posts

26 June 2008 at 4:27am

Edited: 26/06/2008 4:28am

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.

Avatar
Matt Hardwick

Community Member, 61 Posts

26 June 2008 at 4:41am

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.

Avatar
Willr

Forum Moderator, 5513 Posts

26 June 2008 at 1:53pm

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

Avatar
Matt Hardwick

Community Member, 61 Posts

26 June 2008 at 7:27pm

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

Thanks again.

Go to Top