Jump to:

17452 Posts in 4473 Topics by 1971 members


SilverStripe Forums » Archive » Questions (PHP Code, random pictures in CSS)

Our old forums are still available as a read-only archive.

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

Page: 1
Go to End
Author Topic: 1763 Views
  • vinz
    Community Member
    13 Posts

    Questions (PHP Code, random pictures in CSS) Link to this post

    Hi there, I tryed this CMS and i'm really happy, but I have a few questions:

    1) is it possible to insert in the pages PHP code? if yes is there any special tag for it?
    2) i would like that my header in formed for different pictures. Is it possible to have random pics inside the css?

    I really would appreciate it if someone could help me out with this questions.


  • Blackdog
    Community Member
    156 Posts

    Re: Questions (PHP Code, random pictures in CSS) Link to this post

    Not sure about the php but I have a solution for your random pictures in css.

    You could setup a tab on your home page which is called header and within that have a dataobject list of images. Then when you site loads it picks one of those images at random and loads that to a inline style in you site.

    I have done something similar on a site I recently completed where the client is able to change he background image. I didn't use a list of images as they only need one background at time.

    checkout the tutorial on relationships to work out how to get setup dataobjects with relation to a page.

    As a tip you are going to want to use "new FileIFrameField" as the standard image upload won't work correctly in a popup. Well that has been my experience.

  • simon_w
    Forum Moderator
    473 Posts

    Re: Questions (PHP Code, random pictures in CSS) Link to this post

    About the PHP. You cannot have PHP inside your content for obvious security, and coding, reasons.

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.