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.

General Questions

General questions about getting started with SilverStripe that don't fit in any of the categories above.

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

Intergrate include php file


Reply

3 Posts   589 Views

Avatar
Flexart

1 May 2012 at 1:00pm Community Member, 3 Posts

Is there a way to integrate a include PHP file in Silver stripe CMS?

Thanks

Edwin

Avatar
Willr

1 May 2012 at 5:33pm Forum Moderator, 5511 Posts

Please explain in more detail what this PHP file is. If it simply echos values then no, you cannot use it. If it returns something (like an array) then you just need a custom function..

// mysite/code/Page.php

function IncludeSomethingCool() {
require_once('something/cool.php');

// say that cool.php contains a static method foo
return cool::foo();
}

Then in your template use $IncludeSomethingCool.

Avatar
Flexart

1 May 2012 at 5:44pm Community Member, 3 Posts

Hi

I have a Php Calender that i would like to integrate in one of the SS files.

<?php include('calendar.php'); ?>

Thanks

Edwin