Re: nested if's



On May 13, 2:24 pm, JRough <jlro...@xxxxxxxxx> wrote:
I got lost on formatting the nested if/else's on the bottom of the
file right up the last else/if there seems to be a stray bracket. I'm
trying to line up the brackets so I can read it. Is it okay to split
a long line setting a variable on two lines at the equals sign? That
is so you can read it in google groups.

<?
//Send payement advices
$TPL_auction_id = $auction_id;
$user_id=$userrec["id"];
if(!$sessionVars["SELL_action"]) {
include "header.php";}

if($FEE>0) {
if($SETTINGS["invoicing"] == 'y') {
if(!$sessionVars["SELL_action"]=="edit") {
include phpa_include("template_menu_php.html");
include phpa_include("template_sell_result_php.html");
} else {
$auction_url =
$SETTINGS["siteurl"] . "item.php?mode=1&id=".$auction_id;
if($sessionVars["SELL_action"]=="edit") {
unset($_SESSION["sessionVars"]);
unset($_SESSION["RELISTEDAUCTION"]);
if(isset($_SESSION['backtolist']))
header("Location: ".$_SESSION['backtolist']."?PAGE=
".$_SESSION['backtolist_page']);
else
header("Location: yourauctions.php?PAGE=
".$_SESSION['backtolist_page']);
exit;
}
if($sessionVars["SELL_action"]=="reopen") {
unset($_SESSION["sessionVars"]);
unset($_SESSION["RELISTEDAUCTION"]);
header("Location: yourauctions_c.php?PAGE=
".$_SESSION['backtolist_page']);
exit;
}}
} elseif($SETTINGS["feetype"] == "prepay") {

if(!$sessionVars["SELL_action"]) {
//include "header.php";}

include "lib/auctionsetup_payment.php";} else {

if($sessionVars["SELL_action"]) {
include "header.php";
include phpa_include("template_menu_php.html");}

?>

The first thing I think of when something with this much logic comes
up is a switch statement. Of course sometimes it is not suited at all
or only for some of the logic. However, when you can use switch, the
code is much more orderly and easy to modify. You may have already
considered switch and found problems in using it, so excuse me for
bringing up the subject if that is the case. I do not have time just
now to consider the details of your code and test them. The php switch
is nearly the same as a Javascript switch in the formal code structure.
.



Relevant Pages

  • Re: [Monad] Missing help about_switch
    ... Using a switch to handle multiple if statements. ... A switch statement is, in effect, a series of If statements. ... the automatic variable "$_" and is available during the evaluation of ... command at the MSH command prompt: ...
    (microsoft.public.windows.server.scripting)
  • Re: Word takes too long to shutdown
    ... starting Word with the /a switch is one of the solutions in the document ... "I also have customizations added for exit, ... it loads instantly and closes instantly. ...
    (microsoft.public.word.docmanagement)
  • Patch for ping6 -o
    ... The pingutility has an -o switch that tells it to exit after ... .\" without ipsec, or new ipsec ... +Exit successfully after receiving one reply packet. ...
    (freebsd-hackers)
  • Re: Switch for floating !!
    ... Why does the switch case statement does not have support ... characters representing elements of text, whose codes are arbitrarily assigned, ... Would you use a giant switch statement to distinguish fibonacci integers from ... You need a better example to actually rationalize switching on floating point ...
    (comp.lang.c)
  • Re: Bash script Slack >> Deb-Etch
    ... echo>> ~/.signature ... -wF chokes cut, and the switch isn't ... Somehow in the script ...
    (comp.os.linux.misc)