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   619 Views

Avatar
Flexart

Community Member, 3 Posts

1 May 2012 at 1:00pm

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

Thanks

Edwin

Avatar
Willr

Forum Moderator, 5513 Posts

1 May 2012 at 5:33pm

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

Community Member, 3 Posts

1 May 2012 at 5:44pm

Hi

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

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

Thanks

Edwin