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

Page type that uses content from another page

Go to End

4 Posts   2743 Views


Community Member, 4 Posts

6 August 2008 at 10:08pm

I saw this in the tutuorial, in that sample picture there's a page type titled: "change to a virtual page that uses another pages content". I assume that Silverstripe let's me fillin the content and it provides all the menus and stuff. That would be really useful when adapting data from other systems into seemingly using SilverStripe. So, where can I get that pagetype?


126 Posts

7 August 2008 at 9:44am


what you have seen in the tutorial is the VirtualPage page type. However, what a virtual page does is to use an existing Silverstripe page, not a page of another system. This is useful e.g. if you have a large site and you want to link to the same content from different places (so you can link to the same page from another navigation or sub navigation level, etc...). The url is different from the original page, but the content is the same.

Another page type is the Redirector page type but this one only redirects to another page, either a Silverstripe page or an external page. The url changes to the url of the original page (it's really just like a link to another page in your navigation).

Both VirtualPage and Redirector are standard page types that come with the Silverstripe CMS.

But I guess that what you are looking for is probably different. It should not be too difficult to create a new page type that just loads the content from a defined url into the Silverstripe content and keeps the Silverstripe navigation, etc, but I imagine that in most cases this is not very practical and different style sheets etc could easily break the design. You would probably have to parse the data of the external page and remove the header, html and body tags, style sheets and possibly some other tags to get a clean result. I could also imagine that a page that loads content from another url is slower than a real Silverstripe page.

If you want to create that page type you may want to look at some PHP functions, e.g. file_get_contents or http_get_request_body, just to get you started.



Community Member, 4 Posts

7 August 2008 at 11:41am

OK, great, thanks! Is there a tutorial for creating a custom page type? It would be nice to have some code that I just could get a jumpstart from.




Forum Moderator, 5523 Posts

7 August 2008 at 12:53pm

Tutorial 2 covers adding page types to the system. At the very basic level all you need is


class MyNewPageType extends Page {}

class MyNewPageType_Controller extends Page_Controller {}