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, Ed, biapar, Willr, Ingo

php include in Layout/

Go to End

3 Posts   3028 Views


Community Member, 14 Posts

5 June 2008 at 4:02am

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?


Community Member, 14 Posts

14 June 2008 at 12:54am

SS developers, any word on this?


Forum Moderator, 5523 Posts

15 June 2008 at 10:21am

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