Jump to:

22977 Posts in 11657 Topics by 2827 members

General Questions

SilverStripe Forums » General Questions » I need to insert PHP coding into site

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

Page: 1
Go to End
Author Topic: 796 Views
  • UserC479
    Avatar
    Community Member
    2 Posts

    I need to insert PHP coding into site Link to this post

    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?

  • danzzz
    Avatar
    Community Member
    175 Posts

    Re: I need to insert PHP coding into site Link to this post

    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

  • martimiz
    Avatar
    Forum Moderator
    1035 Posts

    Re: I need to insert PHP coding into site Link to this post

    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...

  • UserC479
    Avatar
    Community Member
    2 Posts

    Re: I need to insert PHP coding into site Link to this post

    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?

  • danzzz
    Avatar
    Community Member
    175 Posts

    Re: I need to insert PHP coding into site Link to this post

    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/

    796 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.