Jump to:

17452 Posts in 4473 Topics by 1971 members

Archive

SilverStripe Forums » Archive » Using PHP in templates

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: 775 Views
  • kubox
    Avatar
    Community Member
    1 Post

    Using PHP in templates Link to this post

    Hi there,

    First of all, I want to say want a great CMS SS is. In particular, the interface for the backend of the CMS is miles ahead from 99% of what's out there at the moment, and is something I feel confident clients would be able to use with very little help.

    Secondly, I have to admit that I'm not a hardcore developer by any means, although I know enough to be able to customize most CMSs to my needs. SS has been tricky in that respect - I know the code is very well structured, but the lack of tutorial-type backend documentation makes it a bit tricky for someone like me who is more designer than developer.

    Something I've been struggling with is not being able to use PHP in my templates. I know that there's a real need to seperate content from presentation (as discussed here http://www.silverstripe.com/site-builders-forum/flat/18678 ) but I can't help feel that occasionally logic and presentation are so closely intertwined that a little logic in a tempate file is a good thing. But I may be wrong!

    One exaple is something I'm working on now, where I have a list of child pages that I want to span over several columns in a menu in the front end (see screenshot). The normal way I'd do this is using PHP to count the child pages as they're iterated, and insert something like </ul><ul> every fifth child to break the list into columns.

    This is very simple in PHP, but seems a lot more complicated in SilverStripe - I'm not even sure where to start!

    WHat do you guys think?

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