"Mark C" <nospam@today.com> wrote in message
news:104knpthdotn153@corp.supernews.com...[color=blue]
> I come from a corporate C background and I find style to be important in
> readability. Especially when multiple people are working on the same[/color]
code.[color=blue]
> I have seen 3 way to deal with large bocks of static HTML code in PHP.[/color]
What[color=blue]
> are your preferences? I have listed the techniques in the order of my
> preference.
>
> Hope I don't start an argument ;)
>
> Mark C
>
>
> Method 1:
>
> switch ($_POST[Mode])
> {
> case "":
> ?>
> <br><span class='instruct'>Select the area you need to[/color]
administer.</span>[color=blue]
> <form action="Admin.php" method="post">
> <input type="submit" name="Mode" value="User">
> </form>
> <form action="Admin.php" method="post">
> <input type="submit" name="Mode" value="Church">
> </form>
> <form action="Admin.php" method="post">
> <input type="submit" name="Mode" value="Ministry">
> </form>
> <?php
> break;
>
> case "User":
> $hits = GetEMailList($mn[MinistryID]);
>
> ================================================== ====
>
> Method 2:
>
> switch ($_POST[Mode])
> {
> case "":
>
> print "<br><span class='instruct'>Select the area you need to
> administer.</span>";
> print "<form action=\"Admin.php\" method=\"post\">";
> print " <input type=\"submit\" name=\"Mode\" value=\"User\">";
> print "</form>";
> print "<form action=\"Admin.php" method="post">";
> print " <input type=\"submit" name="Mode" value="Church">";
> print "</form>";
> print "<form action=\"Admin.php\" method=\"post\">";
> print " <input type=\"submit\" name=\"Mode\" value=\"Ministry\">";
> print "</form>";
> break;
>
> case "User":
> $hits = GetEMailList($mn[MinistryID]);
>
> ================================================== ====
>
> Method 3:
>
> switch ($_POST[Mode])
> {
> case "":
>
> $Var = <<<EOQ
> <br><span class='instruct'>Select the area you need to[/color]
administer.</span>[color=blue]
> <form action="Admin.php" method="post">
> <input type="submit" name="Mode" value="User">
> </form>
> <form action="Admin.php" method="post">
> <input type="submit" name="Mode" value="Church">
> </form>
> <form action="Admin.php" method="post">
> <input type="submit" name="Mode" value="Ministry">
> </form>
> EOQ;
>
> print $Var;
> break;
>
> case "User":
> $hits = GetEMailList($mn[MinistryID]);
>
>[/color]
Well, you know what they say about opionion, they are like... well, lets
just say everyone has one. :)
I can warrent times when you would need to do all the 3 you listed above.
method 1: if you needed to edit the html section in say, dreamweaver.
method 2: if you jsut need to spit out a couple lines
method 3: if the block has vars in it, but I would do print <<< instead of
$var <<<
method 4: method 1, as was stated by someone else, put html in a seperate
file, use to keep site very dynamic
just my 1 cent, need other 1 cent for another post
--
Mike Bradley
http://www.gzentools.com -- free online php tools