ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Little things you notice after using them long time

May 27, 2008 4:18am

Subscribe [5]
  • #1 / May 27, 2008 4:18am

    xwero

    4145 posts

    Yesterday i realized you don’t have to add a semicolon if you go out the php escape in your views.

    Hello <?php echo $name ?>

    I’m so used adding a semicolon i happens as a reflex but if i think of all the semicolons i could saved myself i would have learned myself to lose the reflex.

  • #2 / May 27, 2008 5:35am

    frenzal

    136 posts

    it’s still not a bad habit to have though, otherwise you’ll start forgetting them all the time 😊

  • #3 / May 27, 2008 6:55am

    Yes, I use that all the time:

    Hello <?=$name?>

    While using short tags like that, be sure that you’ve set to TRUE the rewrite short tag parameter in the config file:

    $config['rewrite_short_tags'] = TRUE;

    It makes things more portable and doesn’t affect the code execution time, even if you have your server already accepting rewrite of short tags (CI check before rewriting how is your php.ini parameter)

  • #4 / May 28, 2008 11:16pm

    John_Betong

    690 posts

    Yesterday i realized you don’t have to add a semicolon if you go out the php escape in your views.

    Hello <?php echo $name ?>

    I’m so used adding a semicolon i happens as a reflex but if i think of all the semicolons i could saved myself i would have learned myself to lose the reflex.

     
    Same as the CSS trailing semi-colon that is just before the closing curly bracket.
     

    body {border:0; margin:0; padding:0}

     
     

  • #5 / May 29, 2008 1:57am

    Lone

    350 posts

    body {border:0; margin:0; padding:0}

    That still makes me feel dirty..

  • #6 / May 29, 2008 2:45am

    Michael Wales

    2070 posts

    That still makes me feel dirty..

    That’s exactly the reason I don’t use the techniques described here - it just feels wrong. And if someone were too look over my code :o

    I was, and still am, bad about using <?= but I am trying to get away from that right now.

  • #7 / May 29, 2008 3:13am

    I feel nothing wrong using short tags until it is template related only.

  • #8 / May 29, 2008 3:43am

    xwero

    4145 posts

    About the short tags i think go all the way and use a template enigne or you go the php way and than the safest option is to go for full tags.

    About the semicolons, in css i will keep adding semicolons before curly brackets but in views i noticed it from the point of consistency.

    Open from <?php echo $from; ?> AM until <?php echo $until ?> PM.

    It’s not wrong but i like to do it as consistent as possible because the view files are the most likely to fall in the hands of others.

  • #9 / May 29, 2008 7:14am

    Michael Wales

    2070 posts

    Yeah - it’s personal preference either way, but for the sake of your client - make it your preference throughout the entire project.

  • #10 / May 29, 2008 7:23am

    That depend the work you have to make of course, but I personally never had any problem with short tags, and most often when the file come to designer hand they feel better with it, so I think the use of short tags is debatable depending on the situation.

  • #11 / May 29, 2008 8:50am

    Lone

    350 posts

    I love the use of short tags - we do it all the time in our own code. We did hit one of the (few) flaws the other day though when David had to start an xml output with <?  - nothing a string can’t help! 😛

  • #12 / May 29, 2008 9:55am

    Majd Taby

    637 posts

    using short tags caused errors on some peoples systems in codeExtinguisher

  • #13 / May 29, 2008 10:04am

    That’s what I had in mind when I telling “That depend the work you have to make”. If you release code to a public use it should be portable. That made me think that we have coded all the CodeIgniter Directory project (Name Linkster, see my signature) all with short tags…. Now thinking about it we will have to change that, so the post was useful in this way!

  • #14 / May 29, 2008 10:50am

    anonymous65551

    222 posts

    I’ve known about leaving off the semicolon in those instances, but I still put it there.  I can’t help but wonder if a future version of PHP is going to require it, and I want to have my code as clean as possible to the smoothest transition, should it come to that.  Besides, I’m OCD.

    I’ll still use short tags, though, but ONLY in views.  <?=$column_header_text;?> inserted in a view is easier for an external designer to work with, it actually looks like something that will be replaced, and they catch on faster.  Some designers, who are not coders, freak out when they start seeing a log of <?php echo $column_header_text; ?> for some reason.  (Not all designers, but several I’ve had to deal with at one particular company.)

  • #15 / Nov 02, 2008 2:02am

    Murodese

    53 posts

    I love the use of short tags - we do it all the time in our own code. We did hit one of the (few) flaws the other day though when David had to start an xml output with <?  - nothing a string can’t help! 😛

    <<??>? always makes me laugh.


    e; :argh: necro

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases