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.


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

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

php include in Layout/


3 Posts   2762 Views


5 June 2008 at 4:02am Community Member, 14 Posts

Hi All

Have a question. Can I put a php include in a Layout/ file?

Basically, I have a page from outside SilverStripe that I want to include. I tried the iFrame module but I don't have a specific page size as the page that will load into the frame is dynamic so the length can change.

As a workaround, I made a new page type, with a new layout template - but can I call the page I need with php include? I tried it but I get an error. Any ideas?


14 June 2008 at 12:54am Community Member, 14 Posts

SS developers, any word on this?


15 June 2008 at 10:21am Forum Moderator, 5511 Posts

There is no way that I know of to embed PHP files in the template files - I think that would violate the whole MVC approach aswell. Your best idea is like you said, a seperate page type or convert your php to a Silverstripe class - doesnt need to be a page type if its not a whole page by itself but just a bit of functionality so it could extend DataObject instead of Page... anyway that and give it a separate page template would be the way to go