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.

General Questions /

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

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

Intergrate include php file


Go to End


3 Posts   2093 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, 5523 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