Ask a Question related to PHP Development, Design and Development.
-
Kevin Stone #1
Re: Frequent Mode Switching
"Derrick Fogle" <derrick@foundationcomputing.com> wrote in message
news:B4735EB9-C789-11D7-9AA8-000393C7877A@foundationcomputing.com...> 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
I used to program that way. The logic and presentation portions of my
scripts were combined into one or two monolithic files. That worked well
for small projects. But as I got involved in larger projects and had to
juggle many code files at once I found that I prefered to separate as much
of the HTML from the PHP code as possible.
Typically what I do now is set up my HTML in a template-like format using
<?= $var?> as the outputs. Very little logic goes between the <?php?> tags
in my HTML files but of course sometimes it's unaviodable and that's why you
want to use <?php?> tags here and not some phoney template language. Then
sipmly include() the HTML file back into the script allowing the outputs to
fill in. This makes for a very 'plastic' interface that you can mold very
easily in an HTML editor without screwing up your script. For example I did
a calendar script recently with the following outputs...
$next_year
$prev_year
$cur_year
$cur_month
$cur_day
$january
$february
$march
$april
$may
$june
$july
$august
$september
$october
$november
$december
$event_list
$event_header
Each output contains a portion of the final calendar page. So I could take
the months and put them into rows or columns, take the event list and put it
on the top or the bottom, take the interface elements and place them where
they work best. Or I can ignore half of the outputs and display only one
month if I wanted to. Point being I could do this in a fraction of the time
it would take me to do it in logic portion of the script.
Anyway.. just my two bits. Take it or leave it. :-)
- Kevin
Kevin Stone Guest
-
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... -
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... -
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... -
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... -
[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... -
Jason Sheets #2
Re: [PHP] Re: Frequent Mode Switching
Kevin Stone wrote:
<?= is discouraged and is known to break some files, the full use if>
>I used to program that way. The logic and presentation portions of my
>scripts were combined into one or two monolithic files. That worked well
>for small projects. But as I got involved in larger projects and had to
>juggle many code files at once I found that I prefered to separate as much
>of the HTML from the PHP code as possible.
>
>
>Typically what I do now is set up my HTML in a template-like format using
><?= $var?> as the outputs.
>
<?php is encouraged, they have been several threads discussing the use
of <?= and where there is not a <?php=, search the archives for more
information.
Jason
>
>$next_year
>$prev_year
>$cur_year
>$cur_month
>$cur_day
>$january
>$february
>$march
>$april
>$may
>$june
>$july
>$august
>$september
>$october
>$november
>$december
>$event_list
>$event_header
>
>Each output contains a portion of the final calendar page. So I could take
>the months and put them into rows or columns, take the event list and put it
>on the top or the bottom, take the interface elements and place them where
>they work best. Or I can ignore half of the outputs and display only one
>month if I wanted to. Point being I could do this in a fraction of the time
>it would take me to do it in logic portion of the script.
>
>Anyway.. just my two bits. Take it or leave it. :-)
>
>- Kevin
>
>
>
>
>Jason Sheets Guest



Reply With Quote

