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.

Migrating a Site to Silverstripe /

What you need to know when migrating your existing site to SilverStripe.

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

Inlclude output of SS in own page.


Go to End


2 Posts   2846 Views

Avatar
markotondria

Community Member, 13 Posts

18 April 2009 at 5:00am

Edited: 18/04/2009 5:01am

Hi -
I have a current site that uses ajax to pipe page contents into a div on my front page, the url of which doesnt change.
I am looking to use the CMS of silverstripe to produce templated, updatable pages, that I can then pipe through to my current page layout.
I have tried using:

ob_start(); 

include 'SilverStripe/sapphire/main.php?url=/my-news_page';

$result = ob_get_clean(); 

echo $result;

within my current ajax script, but I get no results.
In my page.ss I have stripped out everything except the $Layout var.

When I go to
www.mysite.com/SilverStripe/sapphire/main.php?url=/my-news_page
I see the markout output correctly, and it is this that I want to appear in my div on my front page..

Is there any setting or security variables that I need to adjust so that SS will be happy sending the output to my 'include' ?

Many thanks :)

Mike.

Avatar
markotondria

Community Member, 13 Posts

18 April 2009 at 5:35am

Well, as foolish as I might appear by answering my own question in such a quick time, I will not be proud, but post my solution..

I used

$thefiletoopen = 'mysite.com/SilverStripe/sapphire/main.php?url=/my-news-page/';
$fileHandle = fopen($thefiletoopen, 'r');
$fileData = fread ($fileHandle, 10000);
echo $fileData;

and all was well.