[PHP] Frequent Mode Switching

Ask a Question related to PHP Development, Design and Development.

  1. #1

    Default Re: [PHP] Frequent Mode Switching

    This method has been my personal choice for the past 3-4 yrs in coding,

    I have not found any problems with it thus far.

    But I am gradually switching all my code over to a seperate template style
    design as where I have all my values in a variable format and then parse a
    *.html file and str_replace() all the values accordingly.

    I have found no significant performance difference between <?= **?>, echo
    "";, print()

    But I have found a much cleaner method by using the templateing method that
    I am switching to.

    To sum it up, if you are concerned about performance, I wouldn't worry too
    much. But if you are worried about readability, I would stick with the <?=
    ** ?> method myself. It keeps everything flowing in the script.

    Jim Lucas

    ----- Original Message -----
    From: "Derrick Fogle" <derrick@foundationcomputing.com>
    To: <php-general@lists.php.net>
    Sent: Tuesday, August 05, 2003 2:13 PM
    Subject: [PHP] Frequent Mode Switching

    > Thoughts on frequent switching in and out of PHP mode:
    >
    > <? switch in, do some code
    > ?>Switch out, static HTML
    > <? switch in, do more code
    > ?>Switch out, more static HTML
    >
    > I've found that I prefer programming this way, for the most part,
    > putting most of the heavy PHP programming at the top, and then using
    > static HTML interspersed mostly with quick <?= $variable ?> statements
    > for what users see.
    >
    > I'm sure there's more than one viewpoint out there, so I'd like to hear
    > a couple of them. Is this frequent mode switching good, bad, or
    > indifferent? Is there a point at which the mode switching starts to
    > seriously degrade performance and reliability?
    >
    > -Derrick
    >
    >
    > --
    > PHP General Mailing List (http://www.php.net/)
    > To unsubscribe, visit: http://www.php.net/unsub.php
    >
    >
    Jim Lucas Guest

  2. Similar Questions and Discussions

    1. Frequent quitting
      I have a project running that consists of a series of medium resolution images playing randomly. It's on a recently purchased Windows XP machine...
    2. PS CS crashing when switching screen mode
      I'm freezing up when hot keying through screen mode quickly. This doesn't happen when I do slowly. I'm on a G5 running10.3.2. Anyone have similar...
    3. frequent crashes
      Yes me too. I tried ditching the prefs and Apple's disk utility. Still the same. It seems more stable for a while after doing this and then off...
    4. frequent CS crashes on a new g5
      Something is wrong, i just purchased a new dual g5, with 2 gigs or ram runing panther and photoshopCS. and it keeps crashing, about an hour after i...
    5. Frequent Mode Switching
      "Derrick Fogle" <derrick@foundationcomputing.com> wrote in message news:B4735EB9-C789-11D7-9AA8-000393C7877A@foundationcomputing.com... I used...
  3. #2

    Default RE: [PHP] Frequent Mode Switching

    Derrick Fogle <mailto:derrick@foundationcomputing.com>
    on Tuesday, August 05, 2003 2:14 PM said:
    > I've found that I prefer programming this way, for the most part,
    > putting most of the heavy PHP programming at the top, and then using
    > static HTML interspersed mostly with quick <?= $variable ?> statements
    > for what users see.
    In that case you will want to adopt a templating system. Smarty[1] comes
    to mind first.


    chris.

    [1] [url]http://smarty.php.net/[/url]
    Chris W. Parker Guest

  4. #3

    Default Re: [PHP] Frequent Mode Switching

    On Tuesday 05 August 2003 05:13 pm, Derrick Fogle wrote:
    > Thoughts on frequent switching in and out of PHP mode:
    >
    > <? switch in, do some code
    > ?>Switch out, static HTML
    > <? switch in, do more code
    > ?>Switch out, more static HTML
    >
    > I've found that I prefer programming this way, for the most part,
    > putting most of the heavy PHP programming at the top, and then using
    > static HTML interspersed mostly with quick <?= $variable ?> statements
    > for what users see.
    >
    > I'm sure there's more than one viewpoint out there, so I'd like to hear
    > a couple of them. Is this frequent mode switching good, bad, or
    > indifferent?
    As long as you're organize, and consistent, and coding readably, that should
    be fine.
    Basically what I do is I try to separate programming/logic with presentation
    as much as possible. Put most programming on the top (PHP, Database query,
    etc) and presentation on the bottom (HTML part with some PHP for logic and
    displaying variable).
    > Is there a point at which the mode switching starts to
    > seriously degrade performance and reliability?
    Not that I know of. I am pretty sure the answer to your question is No.

    RDB
    --
    -------------------------------------------------
    /"\ ASCII Ribbon Campaign against HTML
    \ / email and proprietary format
    X attachments.
    / \
    -------------------------------------------------
    Have you been used by Microsoft today?
    Choose your life. Choose freedom.
    Choose LINUX.
    -------------------------------------------------

    Reuben D. Budiardja Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139