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.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

Archive /

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

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

php include in Layout/NewPage.ss


Go to End


3 Posts   3334 Views

Avatar
sammahoney

Community Member, 14 Posts

5 June 2008 at 4:02am

Hi All

Have a question. Can I put a php include in a Layout/page.ss 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?

Avatar
sammahoney

Community Member, 14 Posts

14 June 2008 at 12:54am

SS developers, any word on this?

Avatar
Willr

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