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

I need to insert PHP coding into site


Reply


5 Posts   1345 Views

Avatar
UserC479

Community Member, 2 Posts

10 September 2011 at 4:49pm

I need to insert a php coding into one of the pages and it seems silverstripe strips off the PHP coding parts.

I've looked on here and found part help for function string replace and silverstripe still removes the php
coding which I need and returns nothing.

Basically I'm trying to include the old gallery location so it integrates into our new site.

Any help please?

Avatar
danzzz

Community Member, 175 Posts

10 September 2011 at 9:19pm

hi

in your Page.php file craete a function:

public function something() {

$phpcode = 'test';
return $phpcode;

}

now in your template just call:

$something

You may want to read the tutorials?
http://doc.silverstripe.org/sapphire/en/tutorials/1-building-a-basic-site

Avatar
martimiz

Forum Moderator, 1106 Posts

10 September 2011 at 11:11pm

just inserting some php code into the content of your page won't make it execute. For that it has to be part of/included in/rewritten for SilverStripe...

So depending on the old gallery location: if you want to keep it running, you could think of an iframe in your SilverStripe template and load the gallery into that.

But if it's not a hughe gallery, I would probably want to install a fresh SilverStripe gallery module, and take it from there...

Avatar
UserC479

Community Member, 2 Posts

11 September 2011 at 2:57am

public function something() {

$phpcode = 'test';
return $phpcode;

}

that bit if i wanted to do the command of php include, will that work for the above.

As for the gallery,
there is over 4000 images lol!

You can see why I want to integrate into the site but i just worry about
the width and height due to various screen sizes on people computer.

Any more advice?

Avatar
danzzz

Community Member, 175 Posts

11 September 2011 at 10:37pm

what gallery do you use?
SS is so flexible, as martimiz also says ... I think it's no problem to port it to SS in a short time :-)
there are tuts for that, for example:
http://deadlytechnology.com/silverstripe/silverstripe-image-gallery/