Jump to:

17452 Posts in 4473 Topics by 1971 members

Archive

SilverStripe Forums » Archive » Question on Coding Conventions

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: 1102 Views
  • Double-A-Ron
    Avatar
    Community Member
    604 Posts

    Question on Coding Conventions Link to this post

    http://doc.silverstripe.com/doku.php?id=coding-conventions

    Quote:

    Don’t end them with ?> - if you leave it out, it’s implied and it prevents blank lines from accidentally being outputted when you have newlines after the ?>

    I understand this. I use this method all the time with standard PHP includes. But I am unsure when it comes to how SS processes php files.

    I mean, should this rule apply to Page Types or DataObject files I create in /mysite/?

    Does it apply everywhere an extender or module developer uses PHP? I've always been under the impression, that in roll-your-own php apps, this method should only be used on included php files, not primary pages that a user might view directly. (I may have misunderstood this)

    Cheers
    Aaron Cooper

  • Fuzz10
    Avatar
    Community Member
    787 Posts

    Re: Question on Coding Conventions Link to this post

    Hmmm.. good question! ;-)

    Subscribe....

  • ajshort
    Avatar
    Community Member
    244 Posts

    Re: Question on Coding Conventions Link to this post

    Im fairly sure that this rule is just a good practice to use on every file that is purely PHP. It helps to prevent the "header has already been sent" messages and stuff.

  • Ingo
    Avatar
    Forum Moderator
    801 Posts

    Re: Question on Coding Conventions Link to this post

    I don't think we should have coding conventions with "exceptions", so yeah, if its written there it should apply consistently for all PHP files you create. I'm more in favor of actually checking your code for trailing blanks and close your tags properly btw, but thats not what the conventions state ;)

  • Double-A-Ron
    Avatar
    Community Member
    604 Posts

    Re: Question on Coding Conventions Link to this post

    Thanks for the clarification guys.

    Aaron

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