Loading ...
Sorry, an error occurred while loading the content.

RE: [php-objects] Is there a PHP equivilent to dBase's "do case" statement?

Expand Messages
  • Andrew Drexler
    switch (
    Message 1 of 15 , Nov 13, 2002
    • 0 Attachment
      switch (<some expression) {

      case 'case a' :

      break;
      case 'case b' :

      break;

      default:

      }

      -----Original Message-----
      From: blackpool54 [mailto:steve@...]
      Sent: Wednesday, November 13, 2002 8:54 AM
      To: php-objects@yahoogroups.com
      Subject: [php-objects] Is there a PHP equivilent to dBase's "do case"
      statement?


      Or do I end up having to use endless if/else statements to get the job
      done?

      What I am trying to do is something like this...

      do case
      case = index
      show index on screen
      case = aboutus
      show aboutus on screen
      case = etc.
      ...
      endcase




      Look here for Free PHP Classes of objects:
      http://phpclasses.UpperDesign.com/
      To unsubscribe from this group, send an email to:
      php-objects-unsubscribe@egroups.com



      Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service
      <http://docs.yahoo.com/info/terms/> .




      [Non-text portions of this message have been removed]
    • stevej@pahrump.com
      Yes, Mark. That is more what I mean. Here is what I am currently trying and receiving as an end result in the browser. Perhaps you can tell me what I am
      Message 2 of 15 , Nov 13, 2002
      • 0 Attachment
        Yes, Mark. That is more what I mean.

        Here is what I am currently trying and receiving as an end result in the
        browser. Perhaps you can tell me what I am doing wrong...

        Browser error

        Parse error: parse error, unexpected T_STRING in
        /home/virtual/site339/fst/var/www/html/test/vars.inc.php on line 4

        vars.inc.php

        <?
        switch ($pagetext) {
        case 0:
        $pagetext = "if (file_exists("body1.inc.php")):
        include("body1.inc.php"); endif;";
        break;
        // case 1:
        // $pagetext="if (file_exists("body2.inc.php")):
        include("body2.inc.php"); endif;";
        // break;
        // case 2:
        // $pagetext="if (file_exists("body3.inc.php")):
        include("body3.inc.php"); endif;";
        // break;
        // default
        // $pagetext = "if (file_exists("body1.inc.php")):
        include("body1.inc.php"); endif;";
        }
        ?>

        test2.php

        <?
        if (file_exists("vars.inc.php")): include("vars.inc.php"); endif;
        if (file_exists("header.inc.php")): include("header.inc.php"); endif;
        if (file_exists("sidebar.inc.php")): include("sidebar.inc.php"); endif;
        echo $pagetext;
        if (file_exists("footer.inc.php")): include("footer.inc.php"); endif;
        ?>


        Any ideas what I am doing wrong? What the heck is a T-STRING error?

        Thanks
        > You mean:
        >
        > switch ($page){
        > case 'index':
        > show index
        > break;
        > case 'aboutus':
        > show aboutus
        > break;
        > default:
        > show default
        > }
        > -----Original Message-----
        > From: blackpool54 [mailto:steve@...]
        > Sent: Wednesday, November 13, 2002 11:54 AM
        > To: php-objects@yahoogroups.com
        > Subject: [php-objects] Is there a PHP equivilent to dBase's "do case"
        > statement?
        >
        >
        > Or do I end up having to use endless if/else statements to get the job
        > done?
        >
        > What I am trying to do is something like this...
        >
        > do case
        > case = index
        > show index on screen
        > case = aboutus
        > show aboutus on screen
        > case = etc.
        > ...
        > endcase
        >
        >
        >
        >
        > Look here for Free PHP Classes of objects:
        > http://phpclasses.UpperDesign.com/
        > To unsubscribe from this group, send an email to:
        > php-objects-unsubscribe@egroups.com
        >
        >
        >
        > Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
        >
        >
        > [Non-text portions of this message have been removed]
        >
        >
        > Look here for Free PHP Classes of objects:
        > http://phpclasses.UpperDesign.com/
        > To unsubscribe from this group, send an email to:
        > php-objects-unsubscribe@egroups.com
        >
        >
        >
        > Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
        >
        >
        >


        Steven W. Johnson
        471 W. Wilson Road #36
        Pahrump, Nevada 89048
        steve@...
      • Mark
        You re getting this error because you re not escaping the quotes. Try using single quotes instead of double quotes inside the double quotes. For example,
        Message 3 of 15 , Nov 13, 2002
        • 0 Attachment
          You're getting this error because you're not escaping the quotes. Try
          using single quotes instead of double quotes inside the double
          quotes.

          For example,
          <?
          switch ($pagetext) {
          case 0:
          $pagetext = "if (file_exists('body1.inc.php')):
          include('body1.inc.php'); endif;"
          break;
          ...

          Remember that the case is on $pagetext here... Are you sure you want
          to use the same variable?


          --- "stevej@..." <steve@...> wrote:
          > Yes, Mark. That is more what I mean.
          >
          > Here is what I am currently trying and receiving as an end result
          > in the
          > browser. Perhaps you can tell me what I am doing wrong...
          >
          > Browser error
          >
          > Parse error: parse error, unexpected T_STRING in
          > /home/virtual/site339/fst/var/www/html/test/vars.inc.php on line 4
          >
          > vars.inc.php
          >
          > <?
          > switch ($pagetext) {
          > case 0:
          > $pagetext = "if (file_exists("body1.inc.php")):
          > include("body1.inc.php"); endif;";
          > break;
          > // case 1:
          > // $pagetext="if (file_exists("body2.inc.php")):
          > include("body2.inc.php"); endif;";
          > // break;
          > // case 2:
          > // $pagetext="if (file_exists("body3.inc.php")):
          > include("body3.inc.php"); endif;";
          > // break;
          > // default
          > // $pagetext = "if (file_exists("body1.inc.php")):
          > include("body1.inc.php"); endif;";
          > }
          > ?>
          >
          > test2.php
          >
          > <?
          > if (file_exists("vars.inc.php")): include("vars.inc.php"); endif;
          > if (file_exists("header.inc.php")): include("header.inc.php");
          > endif;
          > if (file_exists("sidebar.inc.php")): include("sidebar.inc.php");
          > endif;
          > echo $pagetext;
          > if (file_exists("footer.inc.php")): include("footer.inc.php");
          > endif;
          > ?>
          >
          >
          > Any ideas what I am doing wrong? What the heck is a T-STRING
          > error?
          >
          > Thanks
          > > You mean:
          > >
          > > switch ($page){
          > > case 'index':
          > > show index
          > > break;
          > > case 'aboutus':
          > > show aboutus
          > > break;
          > > default:
          > > show default
          > > }
          > > -----Original Message-----
          > > From: blackpool54 [mailto:steve@...]
          > > Sent: Wednesday, November 13, 2002 11:54 AM
          > > To: php-objects@yahoogroups.com
          > > Subject: [php-objects] Is there a PHP equivilent to dBase's "do
          > case"
          > > statement?
          > >
          > >
          > > Or do I end up having to use endless if/else statements to get
          > the job
          > > done?
          > >
          > > What I am trying to do is something like this...
          > >
          > > do case
          > > case = index
          > > show index on screen
          > > case = aboutus
          > > show aboutus on screen
          > > case = etc.
          > > ...
          > > endcase
          > >
          > >
          > >
          > >
          > > Look here for Free PHP Classes of objects:
          > > http://phpclasses.UpperDesign.com/
          > > To unsubscribe from this group, send an email to:
          > > php-objects-unsubscribe@egroups.com
          > >
          > >
          > >
          > > Your use of Yahoo! Groups is subject to the Yahoo! Terms of
          > Service.
          > >
          > >
          > > [Non-text portions of this message have been removed]
          > >
          > >
          > > Look here for Free PHP Classes of objects:
          > > http://phpclasses.UpperDesign.com/
          > > To unsubscribe from this group, send an email to:
          > > php-objects-unsubscribe@egroups.com
          > >
          > >
          > >
          > > Your use of Yahoo! Groups is subject to
          > http://docs.yahoo.com/info/terms/
          > >
          > >
          > >
          >
          >
          > Steven W. Johnson
          > 471 W. Wilson Road #36
          > Pahrump, Nevada 89048
          > steve@...
          >


          =====
          Mark Weinstock
          mark_weinstock@...
          ***************************************
          You can't demand something as a "right" unless you are willing to fight to death to defend everyone else's right to the same thing.
          -Stolen from the now-defunct Randy's Random mailing list.
          ***************************************

          __________________________________________________
          Do you Yahoo!?
          U2 on LAUNCH - Exclusive greatest hits videos
          http://launch.yahoo.com/u2
        • Mark
          Now that I read this again, I think I may have misunderstood... try this:
          Message 4 of 15 , Nov 13, 2002
          • 0 Attachment
            Now that I read this again, I think I may have misunderstood...

            try this:

            <?
            switch($pagetext)
            case "body1.inc.php":
            if (file_exists("body1.inc.php")) {
            include("body1.inc.php");
            }
            break;
            case "body2,inc.php":
            if (file_exists("body2.inc.php")) {
            include("body2.inc.php");
            }
            ...
            ?>

            But you could also make this more generic...

            <?
            if (file_exists("$pagetext")) {
            include("$pagetext");
            }
            ?>

            --- "stevej@..." <steve@...> wrote:
            > Yes, Mark. That is more what I mean.
            >
            > Here is what I am currently trying and receiving as an end result
            > in the
            > browser. Perhaps you can tell me what I am doing wrong...
            >
            > Browser error
            >
            > Parse error: parse error, unexpected T_STRING in
            > /home/virtual/site339/fst/var/www/html/test/vars.inc.php on line 4
            >
            > vars.inc.php
            >
            > <?
            > switch ($pagetext) {
            > case 0:
            > $pagetext = "if (file_exists("body1.inc.php")):
            > include("body1.inc.php"); endif;";
            > break;
            > // case 1:
            > // $pagetext="if (file_exists("body2.inc.php")):
            > include("body2.inc.php"); endif;";
            > // break;
            > // case 2:
            > // $pagetext="if (file_exists("body3.inc.php")):
            > include("body3.inc.php"); endif;";
            > // break;
            > // default
            > // $pagetext = "if (file_exists("body1.inc.php")):
            > include("body1.inc.php"); endif;";
            > }
            > ?>
            >
            > test2.php
            >
            > <?
            > if (file_exists("vars.inc.php")): include("vars.inc.php"); endif;
            > if (file_exists("header.inc.php")): include("header.inc.php");
            > endif;
            > if (file_exists("sidebar.inc.php")): include("sidebar.inc.php");
            > endif;
            > echo $pagetext;
            > if (file_exists("footer.inc.php")): include("footer.inc.php");
            > endif;
            > ?>
            >
            >
            > Any ideas what I am doing wrong? What the heck is a T-STRING
            > error?
            >
            > Thanks
            > > You mean:
            > >
            > > switch ($page){
            > > case 'index':
            > > show index
            > > break;
            > > case 'aboutus':
            > > show aboutus
            > > break;
            > > default:
            > > show default
            > > }
            > > -----Original Message-----
            > > From: blackpool54 [mailto:steve@...]
            > > Sent: Wednesday, November 13, 2002 11:54 AM
            > > To: php-objects@yahoogroups.com
            > > Subject: [php-objects] Is there a PHP equivilent to dBase's "do
            > case"
            > > statement?
            > >
            > >
            > > Or do I end up having to use endless if/else statements to get
            > the job
            > > done?
            > >
            > > What I am trying to do is something like this...
            > >
            > > do case
            > > case = index
            > > show index on screen
            > > case = aboutus
            > > show aboutus on screen
            > > case = etc.
            > > ...
            > > endcase
            > >
            > >
            > >
            > >
            > > Look here for Free PHP Classes of objects:
            > > http://phpclasses.UpperDesign.com/
            > > To unsubscribe from this group, send an email to:
            > > php-objects-unsubscribe@egroups.com
            > >
            > >
            > >
            > > Your use of Yahoo! Groups is subject to the Yahoo! Terms of
            > Service.
            > >
            > >
            > > [Non-text portions of this message have been removed]
            > >
            > >
            > > Look here for Free PHP Classes of objects:
            > > http://phpclasses.UpperDesign.com/
            > > To unsubscribe from this group, send an email to:
            > > php-objects-unsubscribe@egroups.com
            > >
            > >
            > >
            > > Your use of Yahoo! Groups is subject to
            > http://docs.yahoo.com/info/terms/
            > >
            > >
            > >
            >
            >
            > Steven W. Johnson
            > 471 W. Wilson Road #36
            > Pahrump, Nevada 89048
            > steve@...
            >


            =====
            Mark Weinstock
            mark_weinstock@...
            ***************************************
            You can't demand something as a "right" unless you are willing to fight to death to defend everyone else's right to the same thing.
            -Stolen from the now-defunct Randy's Random mailing list.
            ***************************************

            __________________________________________________
            Do you Yahoo!?
            U2 on LAUNCH - Exclusive greatest hits videos
            http://launch.yahoo.com/u2
          • stevej@pahrump.com
            GRRRRRRRRR! This is my latest revision... Sticking the switch statement right in line. and it is still not working. Any ideas? I ve tried using the track_vars
            Message 5 of 15 , Nov 13, 2002
            • 0 Attachment
              GRRRRRRRRR!

              This is my latest revision... Sticking the switch statement right in line.
              and it is still not working.

              Any ideas?

              I've tried using the track_vars to pass variable values and that doesn't
              seem to work.

              Does default: override the existing $page value? Or does default just
              take effect when the $page value doesn't exist?

              <?track_vars?>
              <?
              if (file_exists("header.inc.php")): include("header.inc.php"); endif;
              if (file_exists("sidebar.inc.php")): include("sidebar.inc.php"); endif;
              // if (file_exists("vars.inc.php")): include("vars.inc.php"); endif;
              switch ($page) {
              case body1.inc.php:
              if (file_exists("body1.inc.php")): include("body1.inc.php"); endif;
              break;
              case body2.inc.php:
              if (file_exists("body2.inc.php")): include("body2.inc.php"); endif;
              break;
              case body2.inc.php:
              if (file_exists("body3.inc.php")): include("body3.inc.php"); endif;
              break;
              case body3.inc.php:
              if (file_exists("body3.inc.php")): include("body3.inc.php"); endif;
              break;
              default:
              if (file_exists("body1.inc.php")): include("body1.inc.php"); endif;
              break;
              }
              echo $page;
              if (file_exists("footer.inc.php")): include("footer.inc.php"); endif;
              ?>

              End of the troublesome file.

              Or is this a hopeless case?

              > Now that I read this again, I think I may have misunderstood...
              >
              > try this:
              >
              > <?
              > switch($pagetext)
              > case "body1.inc.php":
              > if (file_exists("body1.inc.php")) {
              > include("body1.inc.php");
              > }
              > break;
              > case "body2,inc.php":
              > if (file_exists("body2.inc.php")) {
              > include("body2.inc.php");
              > }
              > ...
              > ?>
              >
              > But you could also make this more generic...
              >
              > <?
              > if (file_exists("$pagetext")) {
              > include("$pagetext");
              > }
              > ?>
              >
              > --- "stevej@..." <steve@...> wrote:
              > > Yes, Mark. That is more what I mean.
              > >
              > > Here is what I am currently trying and receiving as an end result
              > > in the
              > > browser. Perhaps you can tell me what I am doing wrong...
              > >
              > > Browser error
              > >
              > > Parse error: parse error, unexpected T_STRING in
              > > /home/virtual/site339/fst/var/www/html/test/vars.inc.php on line 4
              > >
              > > vars.inc.php
              > >
              > > <?
              > > switch ($pagetext) {
              > > case 0:
              > > $pagetext = "if (file_exists("body1.inc.php")):
              > > include("body1.inc.php"); endif;";
              > > break;
              > > // case 1:
              > > // $pagetext="if (file_exists("body2.inc.php")):
              > > include("body2.inc.php"); endif;";
              > > // break;
              > > // case 2:
              > > // $pagetext="if (file_exists("body3.inc.php")):
              > > include("body3.inc.php"); endif;";
              > > // break;
              > > // default
              > > // $pagetext = "if (file_exists("body1.inc.php")):
              > > include("body1.inc.php"); endif;";
              > > }
              > > ?>
              > >
              > > test2.php
              > >
              > > <?
              > > if (file_exists("vars.inc.php")): include("vars.inc.php"); endif;
              > > if (file_exists("header.inc.php")): include("header.inc.php");
              > > endif;
              > > if (file_exists("sidebar.inc.php")): include("sidebar.inc.php");
              > > endif;
              > > echo $pagetext;
              > > if (file_exists("footer.inc.php")): include("footer.inc.php");
              > > endif;
              > > ?>
              > >
              > >
              > > Any ideas what I am doing wrong? What the heck is a T-STRING
              > > error?
              > >
              > > Thanks
              > > > You mean:
              > > >
              > > > switch ($page){
              > > > case 'index':
              > > > show index
              > > > break;
              > > > case 'aboutus':
              > > > show aboutus
              > > > break;
              > > > default:
              > > > show default
              > > > }
              > > > -----Original Message-----
              > > > From: blackpool54 [mailto:steve@...]
              > > > Sent: Wednesday, November 13, 2002 11:54 AM
              > > > To: php-objects@yahoogroups.com
              > > > Subject: [php-objects] Is there a PHP equivilent to dBase's "do
              > > case"
              > > > statement?
              > > >
              > > >
              > > > Or do I end up having to use endless if/else statements to get
              > > the job
              > > > done?
              > > >
              > > > What I am trying to do is something like this...
              > > >
              > > > do case
              > > > case = index
              > > > show index on screen
              > > > case = aboutus
              > > > show aboutus on screen
              > > > case = etc.
              > > > ...
              > > > endcase
              > > >
              > > >
              > > >
              > > >
              > > > Look here for Free PHP Classes of objects:
              > > > http://phpclasses.UpperDesign.com/
              > > > To unsubscribe from this group, send an email to:
              > > > php-objects-unsubscribe@egroups.com
              > > >
              > > >
              > > >
              > > > Your use of Yahoo! Groups is subject to the Yahoo! Terms of
              > > Service.
              > > >
              > > >
              > > > [Non-text portions of this message have been removed]
              > > >
              > > >
              > > > Look here for Free PHP Classes of objects:
              > > > http://phpclasses.UpperDesign.com/
              > > > To unsubscribe from this group, send an email to:
              > > > php-objects-unsubscribe@egroups.com
              > > >
              > > >
              > > >
              > > > Your use of Yahoo! Groups is subject to
              > > http://docs.yahoo.com/info/terms/
              > > >
              > > >
              > > >
              > >
              > >
              > > Steven W. Johnson
              > > 471 W. Wilson Road #36
              > > Pahrump, Nevada 89048
              > > steve@...
              > >
              >
              >
              > =====
              > Mark Weinstock
              > mark_weinstock@...
              > ***************************************
              > You can't demand something as a "right" unless you are willing to fight to
              > death to defend everyone else's right to the same thing. -Stolen from the
              > now-defunct Randy's Random mailing list.
              > ***************************************
              >
              > __________________________________________________
              > Do you Yahoo!?
              > U2 on LAUNCH - Exclusive greatest hits videos
              > http://launch.yahoo.com/u2
              >
              > Look here for Free PHP Classes of objects:
              > http://phpclasses.UpperDesign.com/
              > To unsubscribe from this group, send an email to:
              > php-objects-unsubscribe@egroups.com
              >
              >
              >
              > Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
              >
              >
              >


              Steven W. Johnson
              471 W. Wilson Road #36
              Pahrump, Nevada 89048
              steve@...
            • Flinn Mueller
              default is used when none of the cases are true, so if page is not set, then it should default... Why don t you check the existance of $page before you
              Message 6 of 15 , Nov 13, 2002
              • 0 Attachment
                default is used when none of the cases are true, so if page is not
                set, then it should default...

                Why don't you check the existance of $page before you switch($page),
                so that you don't have all those redundant 'if' statements.

                if (file_exists($page)) {

                switch($page)
                case "body1.inc.php":
                include("body1.inc.php");
                break;
                ...

                Good Luck,
                Flinn

                stevej@... wrote:

                > GRRRRRRRRR!
                >
                > This is my latest revision... Sticking the switch statement right in
                > line.
                > and it is still not working.
                >
                > Any ideas?
                >
                > I've tried using the track_vars to pass variable values and that
                > doesn't
                > seem to work.
                >
                > Does default: override the existing $page value? Or does default just
                > take effect when the $page value doesn't exist?
                >
                >
                >
                >
                > End of the troublesome file.
                >
                > Or is this a hopeless case?
                >
                >
                > >Now that I read this again, I think I may have misunderstood...
                > >
                > >try this:
                > >
                > >switch($pagetext)
                > > case "body1.inc.php":
                > > if (file_exists("body1.inc.php")) {
                > > include("body1.inc.php");
                > > }
                > > break;
                > > case "body2,inc.php":
                > > if (file_exists("body2.inc.php")) {
                > > include("body2.inc.php");
                > > }
                > >...
                > >?>
                > >
                > >But you could also make this more generic...
                > >
                > >if (file_exists("$pagetext")) {
                > > include("$pagetext");
                > >}
                > >?>
                > >
                > >--- "stevej@..." wrote:
                > >
                > >>Yes, Mark. That is more what I mean.
                > >>
                > >>Here is what I am currently trying and receiving as an end result
                > >>in the
                > >>browser. Perhaps you can tell me what I am doing wrong...
                > >>
                > >>Browser error
                > >>
                > >>Parse error: parse error, unexpected T_STRING in
                > >>/home/virtual/site339/fst/var/www/html/test/vars.inc.php on line 4
                > >>
                > >>vars.inc.php
                > >>
                > >>> switch ($pagetext) {
                > >> case 0:
                > >> $pagetext = "if (file_exists("body1.inc.php")):
                > >>include("body1.inc.php"); endif;";
                > >> break;
                > >>// case 1:
                > >>// $pagetext="if (file_exists("body2.inc.php")):
                > >>include("body2.inc.php"); endif;";
                > >>// break;
                > >>// case 2:
                > >>// $pagetext="if (file_exists("body3.inc.php")):
                > >>include("body3.inc.php"); endif;";
                > >>// break;
                > >>// default
                > >>// $pagetext = "if (file_exists("body1.inc.php")):
                > >>include("body1.inc.php"); endif;";
                > >> }
                > >>?>
                > >>
                > >>test2.php
                > >>
                > >>> if (file_exists("vars.inc.php")): include("vars.inc.php"); endif;
                > >> if (file_exists("header.inc.php")): include("header.inc.php");
                > >>endif;
                > >> if (file_exists("sidebar.inc.php")): include("sidebar.inc.php");
                > >>endif;
                > >> echo $pagetext;
                > >> if (file_exists("footer.inc.php")): include("footer.inc.php");
                > >>endif;
                > >>?>
                > >>
                > >>
                > >>Any ideas what I am doing wrong? What the heck is a T-STRING
                > >>error?
                > >>
                > >>Thanks
                > >>
                > >>>You mean:
                > >>>
                > >>>switch ($page){
                > >>> case 'index':
                > >>> show index
                > >>> break;
                > >>> case 'aboutus':
                > >>> show aboutus
                > >>> break;
                > >>> default:
                > >>> show default
                > >>>}
                > >>> -----Original Message-----
                > >>> From: blackpool54 [mailto:steve@...]
                > >>> Sent: Wednesday, November 13, 2002 11:54 AM
                > >>> To: php-objects@yahoogroups.com
                > >>> Subject: [php-objects] Is there a PHP equivilent to dBase's "do
                > >>
                > >>case"
                > >>
                > >>>statement?
                > >>>
                > >>>
                > >>> Or do I end up having to use endless if/else statements to get
                > >>
                > >>the job
                > >>
                > >>> done?
                > >>>
                > >>> What I am trying to do is something like this...
                > >>>
                > >>> do case
                > >>> case = index
                > >>> show index on screen
                > >>> case = aboutus
                > >>> show aboutus on screen
                > >>> case = etc.
                > >>> ...
                > >>> endcase
                > >>>
                > >>>
                > >>>
                > >>>
                > >>> Look here for Free PHP Classes of objects:
                > >>> http://phpclasses.UpperDesign.com/
                > >>> To unsubscribe from this group, send an email to:
                > >>> php-objects-unsubscribe@egroups.com
                > >>>
                > >>>
                > >>>
                > >>> Your use of Yahoo! Groups is subject to the Yahoo! Terms of
                > >>
                > >>Service.
                > >>
                > >>>
                > >>>[Non-text portions of this message have been removed]
                > >>>
                > >>>
                > >>>Look here for Free PHP Classes of objects:
                > >>>http://phpclasses.UpperDesign.com/
                > >>>To unsubscribe from this group, send an email to:
                > >>>php-objects-unsubscribe@egroups.com
                > >>>
                > >>>
                > >>>
                > >>>Your use of Yahoo! Groups is subject to
                > >>
                > >>http://docs.yahoo.com/info/terms/
                > >>
                > >>>
                > >>>
                > >>
                > >>Steven W. Johnson
                > >>471 W. Wilson Road #36
                > >>Pahrump, Nevada 89048
                > >>steve@...
                > >>
                > >
                > >
                > >=====
                > >Mark Weinstock
                > >mark_weinstock@...
                > >***************************************
                > >You can't demand something as a "right" unless you are willing to
                > fight to
                > >death to defend everyone else's right to the same thing. -Stolen
                > from the
                > >now-defunct Randy's Random mailing list.
                > >***************************************
                > >
                > >__________________________________________________
                > >Do you Yahoo!?
                > >U2 on LAUNCH - Exclusive greatest hits videos
                > >http://launch.yahoo.com/u2
                > >
                > >Look here for Free PHP Classes of objects:
                > >http://phpclasses.UpperDesign.com/
                > >To unsubscribe from this group, send an email to:
                > >php-objects-unsubscribe@egroups.com
                > >
                > >
                > >
                > >Your use of Yahoo! Groups is subject to
                > http://docs.yahoo.com/info/terms/
                > >
                > >
                > >
                >
                >
                >
                > Steven W. Johnson
                > 471 W. Wilson Road #36
                > Pahrump, Nevada 89048
                > steve@...
                >
                >
                > Look here for Free PHP Classes of objects:
                > http://phpclasses.UpperDesign.com/
                > To unsubscribe from this group, send an email to:
                > php-objects-unsubscribe@egroups.com
                >
                >
                >
                > Your use of Yahoo! Groups is subject to
                > http://docs.yahoo.com/info/terms/
                >
                >
              • stevej@pahrump.com
                That is probably it. Thanks! I have been beating my head against the wall with this one all day. ... Steven W. Johnson 471 W. Wilson Road #36 Pahrump, Nevada
                Message 7 of 15 , Nov 13, 2002
                • 0 Attachment
                  That is probably it. Thanks! I have been beating my head against the
                  wall with this one all day.

                  > default is used when none of the cases are true, so if page is not
                  > set, then it should default...
                  >
                  > Why don't you check the existance of $page before you switch($page), so
                  > that you don't have all those redundant 'if' statements.
                  >
                  > if (file_exists($page)) {
                  >
                  > switch($page)
                  > case "body1.inc.php":
                  > include("body1.inc.php");
                  > break;
                  > ...
                  >
                  > Good Luck,
                  > Flinn
                  >
                  > stevej@... wrote:
                  >
                  > > GRRRRRRRRR!
                  > >
                  > > This is my latest revision... Sticking the switch statement right in
                  > > line.
                  > > and it is still not working.
                  > >
                  > > Any ideas?
                  > >
                  > > I've tried using the track_vars to pass variable values and that
                  > > doesn't
                  > > seem to work.
                  > >
                  > > Does default: override the existing $page value? Or does default just
                  > > take effect when the $page value doesn't exist?
                  > >
                  > >
                  > >
                  > >
                  > > End of the troublesome file.
                  > >
                  > > Or is this a hopeless case?
                  > >
                  > >
                  > > >Now that I read this again, I think I may have misunderstood...
                  > > >
                  > > >try this:
                  > > >
                  > > >switch($pagetext)
                  > > > case "body1.inc.php":
                  > > > if (file_exists("body1.inc.php")) {
                  > > > include("body1.inc.php");
                  > > > }
                  > > > break;
                  > > > case "body2,inc.php":
                  > > > if (file_exists("body2.inc.php")) {
                  > > > include("body2.inc.php");
                  > > > }
                  > > >...
                  > > >?>
                  > > >
                  > > >But you could also make this more generic...
                  > > >
                  > > >if (file_exists("$pagetext")) {
                  > > > include("$pagetext");
                  > > >}
                  > > >?>
                  > > >
                  > > >--- "stevej@..." wrote:
                  > > >
                  > > >>Yes, Mark. That is more what I mean.
                  > > >>
                  > > >>Here is what I am currently trying and receiving as an end result in
                  > > >>the browser. Perhaps you can tell me what I am doing wrong...
                  > > >>
                  > > >>Browser error
                  > > >>
                  > > >>Parse error: parse error, unexpected T_STRING in
                  > > >>/home/virtual/site339/fst/var/www/html/test/vars.inc.php on line 4
                  > > >>
                  > > >>vars.inc.php
                  > > >>
                  > > >>> switch ($pagetext) {
                  > > >> case 0:
                  > > >> $pagetext = "if (file_exists("body1.inc.php")):
                  > > >>include("body1.inc.php"); endif;";
                  > > >> break;
                  > > >>// case 1:
                  > > >>// $pagetext="if (file_exists("body2.inc.php")):
                  > > >>include("body2.inc.php"); endif;";
                  > > >>// break;
                  > > >>// case 2:
                  > > >>// $pagetext="if (file_exists("body3.inc.php")):
                  > > >>include("body3.inc.php"); endif;";
                  > > >>// break;
                  > > >>// default
                  > > >>// $pagetext = "if (file_exists("body1.inc.php")):
                  > > >>include("body1.inc.php"); endif;";
                  > > >> }
                  > > >>?>
                  > > >>
                  > > >>test2.php
                  > > >>
                  > > >>> if (file_exists("vars.inc.php")): include("vars.inc.php"); endif;
                  > > >> if (file_exists("header.inc.php")): include("header.inc.php");
                  > > >>endif;
                  > > >> if (file_exists("sidebar.inc.php")): include("sidebar.inc.php");
                  > > >>endif;
                  > > >> echo $pagetext;
                  > > >> if (file_exists("footer.inc.php")): include("footer.inc.php");
                  > > >>endif;
                  > > >>?>
                  > > >>
                  > > >>
                  > > >>Any ideas what I am doing wrong? What the heck is a T-STRING
                  > > >>error?
                  > > >>
                  > > >>Thanks
                  > > >>
                  > > >>>You mean:
                  > > >>>
                  > > >>>switch ($page){
                  > > >>> case 'index':
                  > > >>> show index
                  > > >>> break;
                  > > >>> case 'aboutus':
                  > > >>> show aboutus
                  > > >>> break;
                  > > >>> default:
                  > > >>> show default
                  > > >>>}
                  > > >>> -----Original Message-----
                  > > >>> From: blackpool54 [mailto:steve@...]
                  > > >>> Sent: Wednesday, November 13, 2002 11:54 AM
                  > > >>> To: php-objects@yahoogroups.com
                  > > >>> Subject: [php-objects] Is there a PHP equivilent to dBase's "do
                  > > >>
                  > > >>case"
                  > > >>
                  > > >>>statement?
                  > > >>>
                  > > >>>
                  > > >>> Or do I end up having to use endless if/else statements to get
                  > > >>
                  > > >>the job
                  > > >>
                  > > >>> done?
                  > > >>>
                  > > >>> What I am trying to do is something like this...
                  > > >>>
                  > > >>> do case
                  > > >>> case = index
                  > > >>> show index on screen
                  > > >>> case = aboutus
                  > > >>> show aboutus on screen
                  > > >>> case = etc.
                  > > >>> ...
                  > > >>> endcase
                  > > >>>
                  > > >>>
                  > > >>>
                  > > >>>
                  > > >>> Look here for Free PHP Classes of objects:
                  > > >>> http://phpclasses.UpperDesign.com/
                  > > >>> To unsubscribe from this group, send an email to:
                  > > >>> php-objects-unsubscribe@egroups.com
                  > > >>>
                  > > >>>
                  > > >>>
                  > > >>> Your use of Yahoo! Groups is subject to the Yahoo! Terms of
                  > > >>
                  > > >>Service.
                  > > >>
                  > > >>>
                  > > >>>[Non-text portions of this message have been removed]
                  > > >>>
                  > > >>>
                  > > >>>Look here for Free PHP Classes of objects:
                  > > >>>http://phpclasses.UpperDesign.com/
                  > > >>>To unsubscribe from this group, send an email to:
                  > > >>>php-objects-unsubscribe@egroups.com
                  > > >>>
                  > > >>>
                  > > >>>
                  > > >>>Your use of Yahoo! Groups is subject to
                  > > >>
                  > > >>http://docs.yahoo.com/info/terms/
                  > > >>
                  > > >>>
                  > > >>>
                  > > >>
                  > > >>Steven W. Johnson
                  > > >>471 W. Wilson Road #36
                  > > >>Pahrump, Nevada 89048
                  > > >>steve@...
                  > > >>
                  > > >
                  > > >
                  > > >=====
                  > > >Mark Weinstock
                  > > >mark_weinstock@...
                  > > >***************************************
                  > > >You can't demand something as a "right" unless you are willing to
                  > > fight to
                  > > >death to defend everyone else's right to the same thing. -Stolen
                  > > from the
                  > > >now-defunct Randy's Random mailing list.
                  > > >***************************************
                  > > >
                  > > >__________________________________________________
                  > > >Do you Yahoo!?
                  > > >U2 on LAUNCH - Exclusive greatest hits videos
                  > > >http://launch.yahoo.com/u2
                  > > >
                  > > >Look here for Free PHP Classes of objects:
                  > > >http://phpclasses.UpperDesign.com/
                  > > >To unsubscribe from this group, send an email to:
                  > > >php-objects-unsubscribe@egroups.com
                  > > >
                  > > >
                  > > >
                  > > >Your use of Yahoo! Groups is subject to
                  > > http://docs.yahoo.com/info/terms/
                  > > >
                  > > >
                  > > >
                  > >
                  > >
                  > >
                  > > Steven W. Johnson
                  > > 471 W. Wilson Road #36
                  > > Pahrump, Nevada 89048
                  > > steve@...
                  > >
                  > >
                  > > Look here for Free PHP Classes of objects:
                  > > http://phpclasses.UpperDesign.com/
                  > > To unsubscribe from this group, send an email to:
                  > > php-objects-unsubscribe@egroups.com
                  > >
                  > >
                  > >
                  > > Your use of Yahoo! Groups is subject to
                  > > http://docs.yahoo.com/info/terms/
                  > >
                  > >
                  >
                  >
                  >
                  >
                  > Look here for Free PHP Classes of objects:
                  > http://phpclasses.UpperDesign.com/
                  > To unsubscribe from this group, send an email to:
                  > php-objects-unsubscribe@egroups.com
                  >
                  >
                  >
                  > Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
                  >
                  >
                  >


                  Steven W. Johnson
                  471 W. Wilson Road #36
                  Pahrump, Nevada 89048
                  steve@...
                • Mark
                  Two more things. The variable $page is a string, as are the things you re checking against. So I m pretty sure they should be in quotes. (your last email
                  Message 8 of 15 , Nov 14, 2002
                  • 0 Attachment
                    Two more things. The variable $page is a string, as are the things
                    you're checking against. So I'm pretty sure they should be in quotes.
                    (your last email didn't have them there).

                    Also, as I mentioned eariler, you can probably make the code more
                    simple by using the variable $page in the file_exists() and include()
                    statements. The only thing you'd have to be concerned about is if
                    $page can be supplied by the end user... That would be a (much more
                    than) slight security risk.



                    --- "stevej@..." <steve@...> wrote:
                    > That is probably it. Thanks! I have been beating my head against
                    > the
                    > wall with this one all day.
                    >
                    > > default is used when none of the cases are true, so if page is
                    > not
                    > > set, then it should default...
                    > >
                    > > Why don't you check the existance of $page before you
                    > switch($page), so
                    > > that you don't have all those redundant 'if' statements.
                    > >
                    > > if (file_exists($page)) {
                    > >
                    > > switch($page)
                    > > case "body1.inc.php":
                    > > include("body1.inc.php");
                    > > break;
                    > > ...
                    > >
                    > > Good Luck,
                    > > Flinn
                    > >
                    > > stevej@... wrote:
                    > >
                    > > > GRRRRRRRRR!
                    > > >
                    > > > This is my latest revision... Sticking the switch statement
                    > right in
                    > > > line.
                    > > > and it is still not working.
                    > > >
                    > > > Any ideas?
                    > > >
                    > > > I've tried using the track_vars to pass variable values and
                    > that
                    > > > doesn't
                    > > > seem to work.
                    > > >
                    > > > Does default: override the existing $page value? Or does
                    > default just
                    > > > take effect when the $page value doesn't exist?
                    > > >
                    > > >
                    > > >
                    > > >
                    > > > End of the troublesome file.
                    > > >
                    > > > Or is this a hopeless case?
                    > > >
                    > > >
                    > > > >Now that I read this again, I think I may have
                    > misunderstood...
                    > > > >
                    > > > >try this:
                    > > > >
                    > > > >switch($pagetext)
                    > > > > case "body1.inc.php":
                    > > > > if (file_exists("body1.inc.php")) {
                    > > > > include("body1.inc.php");
                    > > > > }
                    > > > > break;
                    > > > > case "body2,inc.php":
                    > > > > if (file_exists("body2.inc.php")) {
                    > > > > include("body2.inc.php");
                    > > > > }
                    > > > >...
                    > > > >?>
                    > > > >
                    > > > >But you could also make this more generic...
                    > > > >
                    > > > >if (file_exists("$pagetext")) {
                    > > > > include("$pagetext");
                    > > > >}
                    > > > >?>
                    > > > >
                    > > > >--- "stevej@..." wrote:
                    > > > >
                    > > > >>Yes, Mark. That is more what I mean.
                    > > > >>
                    > > > >>Here is what I am currently trying and receiving as an end
                    > result in
                    > > > >>the browser. Perhaps you can tell me what I am doing
                    > wrong...
                    > > > >>
                    > > > >>Browser error
                    > > > >>
                    > > > >>Parse error: parse error, unexpected T_STRING in
                    > > > >>/home/virtual/site339/fst/var/www/html/test/vars.inc.php on
                    > line 4
                    > > > >>
                    > > > >>vars.inc.php
                    > > > >>
                    > > > >>> switch ($pagetext) {
                    > > > >> case 0:
                    > > > >> $pagetext = "if (file_exists("body1.inc.php")):
                    > > > >>include("body1.inc.php"); endif;";
                    > > > >> break;
                    > > > >>// case 1:
                    > > > >>// $pagetext="if (file_exists("body2.inc.php")):
                    > > > >>include("body2.inc.php"); endif;";
                    > > > >>// break;
                    > > > >>// case 2:
                    > > > >>// $pagetext="if (file_exists("body3.inc.php")):
                    > > > >>include("body3.inc.php"); endif;";
                    > > > >>// break;
                    > > > >>// default
                    > > > >>// $pagetext = "if (file_exists("body1.inc.php")):
                    > > > >>include("body1.inc.php"); endif;";
                    > > > >> }
                    > > > >>?>
                    > > > >>
                    > > > >>test2.php
                    > > > >>
                    > > > >>> if (file_exists("vars.inc.php")): include("vars.inc.php");
                    > endif;
                    > > > >> if (file_exists("header.inc.php")):
                    > include("header.inc.php");
                    > > > >>endif;
                    > > > >> if (file_exists("sidebar.inc.php")):
                    > include("sidebar.inc.php");
                    > > > >>endif;
                    > > > >> echo $pagetext;
                    > > > >> if (file_exists("footer.inc.php")):
                    > include("footer.inc.php");
                    > > > >>endif;
                    > > > >>?>
                    > > > >>
                    > > > >>
                    > > > >>Any ideas what I am doing wrong? What the heck is a T-STRING
                    > > > >>error?
                    > > > >>
                    > > > >>Thanks
                    > > > >>
                    > > > >>>You mean:
                    > > > >>>
                    > > > >>>switch ($page){
                    > > > >>> case 'index':
                    > > > >>> show index
                    > > > >>> break;
                    > > > >>> case 'aboutus':
                    > > > >>> show aboutus
                    > > > >>> break;
                    > > > >>> default:
                    > > > >>> show default
                    > > > >>>}
                    > > > >>> -----Original Message-----
                    > > > >>> From: blackpool54 [mailto:steve@...]
                    > > > >>> Sent: Wednesday, November 13, 2002 11:54 AM
                    > > > >>> To: php-objects@yahoogroups.com
                    > > > >>> Subject: [php-objects] Is there a PHP equivilent to
                    > dBase's "do
                    > > > >>
                    > > > >>case"
                    > > > >>
                    > > > >>>statement?
                    > > > >>>
                    > > > >>>
                    > > > >>> Or do I end up having to use endless if/else statements to
                    > get
                    > > > >>
                    > > > >>the job
                    > > > >>
                    > > > >>> done?
                    > > > >>>
                    > > > >>> What I am trying to do is something like this...
                    > > > >>>
                    > > > >>> do case
                    > > > >>> case = index
                    > > > >>> show index on screen
                    > > > >>> case = aboutus
                    > > > >>> show aboutus on screen
                    > > > >>> case = etc.
                    > > > >>> ...
                    > > > >>> endcase
                    > > > >>>
                    > > > >>>
                    > > > >>>
                    > > > >>>
                    > > > >>> Look here for Free PHP Classes of objects:
                    > > > >>> http://phpclasses.UpperDesign.com/
                    > > > >>> To unsubscribe from this group, send an email to:
                    > > > >>> php-objects-unsubscribe@egroups.com
                    > > > >>>
                    > > > >>>
                    > > > >>>
                    > > > >>> Your use of Yahoo! Groups is subject to the Yahoo! Terms
                    > of
                    > > > >>
                    > > > >>Service.
                    > > > >>
                    > > > >>>
                    > > > >>>[Non-text portions of this message have been removed]
                    > > > >>>
                    > > > >>>
                    > > > >>>Look here for Free PHP Classes of objects:
                    > > > >>>http://phpclasses.UpperDesign.com/
                    > > > >>>To unsubscribe from this group, send an email to:
                    > > > >>>php-objects-unsubscribe@egroups.com
                    > > > >>>
                    > > > >>>
                    > > > >>>
                    > > > >>>Your use of Yahoo! Groups is subject to
                    > > > >>
                    > > > >>http://docs.yahoo.com/info/terms/
                    > > > >>
                    > > > >>>
                    > > > >>>
                    > > > >>
                    > > > >>Steven W. Johnson
                    > > > >>471 W. Wilson Road #36
                    > > > >>Pahrump, Nevada 89048
                    > > > >>steve@...
                    > > > >>
                    > > > >
                    > > > >
                    > > > >=====
                    > > > >Mark Weinstock
                    > > > >mark_weinstock@...
                    > > > >***************************************
                    > > > >You can't demand something as a "right" unless you are willing
                    > to
                    > > > fight to
                    > > > >death to defend everyone else's right to the same thing.
                    > -Stolen
                    > > > from the
                    > > > >now-defunct Randy's Random mailing list.
                    > > > >***************************************
                    > > > >
                    > > > >__________________________________________________
                    > > > >Do you Yahoo!?
                    > > > >U2 on LAUNCH - Exclusive greatest hits videos
                    > > > >http://launch.yahoo.com/u2
                    > > > >
                    > > > >Look here for Free PHP Classes of objects:
                    > > > >http://phpclasses.UpperDesign.com/
                    > > > >To unsubscribe from this group, send an email to:
                    > > > >php-objects-unsubscribe@egroups.com
                    > > > >
                    > > > >
                    > > > >
                    > > > >Your use of Yahoo! Groups is subject to
                    > > > http://docs.yahoo.com/info/terms/
                    > > > >
                    > > > >
                    > > > >
                    > > >
                    > > >
                    > > >
                    > > > Steven W. Johnson
                    > > > 471 W. Wilson Road #36
                    > > > Pahrump, Nevada 89048
                    > > > steve@...
                    > > >
                    > > >
                    > > > Look here for Free PHP Classes of objects:
                    > > > http://phpclasses.UpperDesign.com/
                    > > > To unsubscribe from this group, send an email to:
                    > > > php-objects-unsubscribe@egroups.com
                    > > >
                    > > >
                    > > >
                    > > > Your use of Yahoo! Groups is subject to
                    > > > http://docs.yahoo.com/info/terms/
                    > > >
                    > > >
                    > >
                    > >
                    > >
                    > >
                    > > Look here for Free PHP Classes of objects:
                    > > http://phpclasses.UpperDesign.com/
                    > > To unsubscribe from this group, send an email to:
                    > > php-objects-unsubscribe@egroups.com
                    > >
                    > >
                    > >
                    > > Your use of Yahoo! Groups is subject to
                    > http://docs.yahoo.com/info/terms/
                    > >
                    > >
                    > >
                    >
                    >
                    > Steven W. Johnson
                    > 471 W. Wilson Road #36
                    > Pahrump, Nevada 89048
                    > steve@...
                    >


                    =====
                    Mark Weinstock
                    mark_weinstock@...
                    ***************************************
                    You can't demand something as a "right" unless you are willing to fight to death to defend everyone else's right to the same thing.
                    -Stolen from the now-defunct Randy's Random mailing list.
                    ***************************************

                    __________________________________________________
                    Do you Yahoo!?
                    Yahoo! Web Hosting - Let the expert host your site
                    http://webhosting.yahoo.com
                  • stevej@pahrump.com
                    Yep, Mark. Thanks. I finally got it working last night around 10PM. You can check out the end result at http://www.softnuggets.com but avoid the Products,
                    Message 9 of 15 , Nov 14, 2002
                    • 0 Attachment
                      Yep, Mark. Thanks. I finally got it working last night around 10PM. You
                      can check out the end result at http://www.softnuggets.com but avoid the
                      Products, Testsites, and Forum links as nothing is behind them yet.

                      > Two more things. The variable $page is a string, as are the things
                      > you're checking against. So I'm pretty sure they should be in quotes.
                      > (your last email didn't have them there).
                      >
                      > Also, as I mentioned eariler, you can probably make the code more
                      > simple by using the variable $page in the file_exists() and include()
                      > statements. The only thing you'd have to be concerned about is if $page
                      > can be supplied by the end user... That would be a (much more than) slight
                      > security risk.
                      >
                      >
                      >
                      > --- "stevej@..." <steve@...> wrote:
                      > > That is probably it. Thanks! I have been beating my head against
                      > > the
                      > > wall with this one all day.
                      > >
                      > > > default is used when none of the cases are true, so if page is
                      > > not
                      > > > set, then it should default...
                      > > >
                      > > > Why don't you check the existance of $page before you
                      > > switch($page), so
                      > > > that you don't have all those redundant 'if' statements.
                      > > >
                      > > > if (file_exists($page)) {
                      > > >
                      > > > switch($page)
                      > > > case "body1.inc.php":
                      > > > include("body1.inc.php");
                      > > > break;
                      > > > ...
                      > > >
                      > > > Good Luck,
                      > > > Flinn
                      > > >
                      > > > stevej@... wrote:
                      > > >
                      > > > > GRRRRRRRRR!
                      > > > >
                      > > > > This is my latest revision... Sticking the switch statement
                      > > right in
                      > > > > line.
                      > > > > and it is still not working.
                      > > > >
                      > > > > Any ideas?
                      > > > >
                      > > > > I've tried using the track_vars to pass variable values and
                      > > that
                      > > > > doesn't
                      > > > > seem to work.
                      > > > >
                      > > > > Does default: override the existing $page value? Or does
                      > > default just
                      > > > > take effect when the $page value doesn't exist?
                      > > > >
                      > > > >
                      > > > >
                      > > > >
                      > > > > End of the troublesome file.
                      > > > >
                      > > > > Or is this a hopeless case?
                      > > > >
                      > > > >
                      > > > > >Now that I read this again, I think I may have
                      > > misunderstood...
                      > > > > >
                      > > > > >try this:
                      > > > > >
                      > > > > >switch($pagetext)
                      > > > > > case "body1.inc.php":
                      > > > > > if (file_exists("body1.inc.php")) {
                      > > > > > include("body1.inc.php");
                      > > > > > }
                      > > > > > break;
                      > > > > > case "body2,inc.php":
                      > > > > > if (file_exists("body2.inc.php")) {
                      > > > > > include("body2.inc.php");
                      > > > > > }
                      > > > > >...
                      > > > > >?>
                      > > > > >
                      > > > > >But you could also make this more generic...
                      > > > > >
                      > > > > >if (file_exists("$pagetext")) {
                      > > > > > include("$pagetext");
                      > > > > >}
                      > > > > >?>
                      > > > > >
                      > > > > >--- "stevej@..." wrote:
                      > > > > >
                      > > > > >>Yes, Mark. That is more what I mean.
                      > > > > >>
                      > > > > >>Here is what I am currently trying and receiving as an end
                      > > result in
                      > > > > >>the browser. Perhaps you can tell me what I am doing
                      > > wrong...
                      > > > > >>
                      > > > > >>Browser error
                      > > > > >>
                      > > > > >>Parse error: parse error, unexpected T_STRING in
                      > > > > >>/home/virtual/site339/fst/var/www/html/test/vars.inc.php on
                      > > line 4
                      > > > > >>
                      > > > > >>vars.inc.php
                      > > > > >>
                      > > > > >>> switch ($pagetext) {
                      > > > > >> case 0:
                      > > > > >> $pagetext = "if (file_exists("body1.inc.php")):
                      > > > > >>include("body1.inc.php"); endif;";
                      > > > > >> break;
                      > > > > >>// case 1:
                      > > > > >>// $pagetext="if (file_exists("body2.inc.php")):
                      > > > > >>include("body2.inc.php"); endif;";
                      > > > > >>// break;
                      > > > > >>// case 2:
                      > > > > >>// $pagetext="if (file_exists("body3.inc.php")):
                      > > > > >>include("body3.inc.php"); endif;";
                      > > > > >>// break;
                      > > > > >>// default
                      > > > > >>// $pagetext = "if (file_exists("body1.inc.php")):
                      > > > > >>include("body1.inc.php"); endif;";
                      > > > > >> }
                      > > > > >>?>
                      > > > > >>
                      > > > > >>test2.php
                      > > > > >>
                      > > > > >>> if (file_exists("vars.inc.php")): include("vars.inc.php");
                      > > endif;
                      > > > > >> if (file_exists("header.inc.php")):
                      > > include("header.inc.php");
                      > > > > >>endif;
                      > > > > >> if (file_exists("sidebar.inc.php")):
                      > > include("sidebar.inc.php");
                      > > > > >>endif;
                      > > > > >> echo $pagetext;
                      > > > > >> if (file_exists("footer.inc.php")):
                      > > include("footer.inc.php");
                      > > > > >>endif;
                      > > > > >>?>
                      > > > > >>
                      > > > > >>
                      > > > > >>Any ideas what I am doing wrong? What the heck is a T-STRING
                      > > > > >>error?
                      > > > > >>
                      > > > > >>Thanks
                      > > > > >>
                      > > > > >>>You mean:
                      > > > > >>>
                      > > > > >>>switch ($page){
                      > > > > >>> case 'index':
                      > > > > >>> show index
                      > > > > >>> break;
                      > > > > >>> case 'aboutus':
                      > > > > >>> show aboutus
                      > > > > >>> break;
                      > > > > >>> default:
                      > > > > >>> show default
                      > > > > >>>}
                      > > > > >>> -----Original Message-----
                      > > > > >>> From: blackpool54 [mailto:steve@...]
                      > > > > >>> Sent: Wednesday, November 13, 2002 11:54 AM
                      > > > > >>> To: php-objects@yahoogroups.com
                      > > > > >>> Subject: [php-objects] Is there a PHP equivilent to
                      > > dBase's "do
                      > > > > >>
                      > > > > >>case"
                      > > > > >>
                      > > > > >>>statement?
                      > > > > >>>
                      > > > > >>>
                      > > > > >>> Or do I end up having to use endless if/else statements to
                      > > get
                      > > > > >>
                      > > > > >>the job
                      > > > > >>
                      > > > > >>> done?
                      > > > > >>>
                      > > > > >>> What I am trying to do is something like this...
                      > > > > >>>
                      > > > > >>> do case
                      > > > > >>> case = index
                      > > > > >>> show index on screen
                      > > > > >>> case = aboutus
                      > > > > >>> show aboutus on screen
                      > > > > >>> case = etc.
                      > > > > >>> ...
                      > > > > >>> endcase
                      > > > > >>>
                      > > > > >>>
                      > > > > >>>
                      > > > > >>>
                      > > > > >>> Look here for Free PHP Classes of objects:
                      > > > > >>> http://phpclasses.UpperDesign.com/
                      > > > > >>> To unsubscribe from this group, send an email to:
                      > > > > >>> php-objects-unsubscribe@egroups.com
                      > > > > >>>
                      > > > > >>>
                      > > > > >>>
                      > > > > >>> Your use of Yahoo! Groups is subject to the Yahoo! Terms
                      > > of
                      > > > > >>
                      > > > > >>Service.
                      > > > > >>
                      > > > > >>>
                      > > > > >>>[Non-text portions of this message have been removed]
                      > > > > >>>
                      > > > > >>>
                      > > > > >>>Look here for Free PHP Classes of objects:
                      > > > > >>>http://phpclasses.UpperDesign.com/
                      > > > > >>>To unsubscribe from this group, send an email to:
                      > > > > >>>php-objects-unsubscribe@egroups.com
                      > > > > >>>
                      > > > > >>>
                      > > > > >>>
                      > > > > >>>Your use of Yahoo! Groups is subject to
                      > > > > >>
                      > > > > >>http://docs.yahoo.com/info/terms/
                      > > > > >>
                      > > > > >>>
                      > > > > >>>
                      > > > > >>
                      > > > > >>Steven W. Johnson
                      > > > > >>471 W. Wilson Road #36
                      > > > > >>Pahrump, Nevada 89048
                      > > > > >>steve@...
                      > > > > >>
                      > > > > >
                      > > > > >
                      > > > > >=====
                      > > > > >Mark Weinstock
                      > > > > >mark_weinstock@...
                      > > > > >***************************************
                      > > > > >You can't demand something as a "right" unless you are willing
                      > > to
                      > > > > fight to
                      > > > > >death to defend everyone else's right to the same thing.
                      > > -Stolen
                      > > > > from the
                      > > > > >now-defunct Randy's Random mailing list.
                      > > > > >***************************************
                      > > > > >
                      > > > > >__________________________________________________
                      > > > > >Do you Yahoo!?
                      > > > > >U2 on LAUNCH - Exclusive greatest hits videos
                      > > > > >http://launch.yahoo.com/u2
                      > > > > >
                      > > > > >Look here for Free PHP Classes of objects:
                      > > > > >http://phpclasses.UpperDesign.com/
                      > > > > >To unsubscribe from this group, send an email to:
                      > > > > >php-objects-unsubscribe@egroups.com
                      > > > > >
                      > > > > >
                      > > > > >
                      > > > > >Your use of Yahoo! Groups is subject to
                      > > > > http://docs.yahoo.com/info/terms/
                      > > > > >
                      > > > > >
                      > > > > >
                      > > > >
                      > > > >
                      > > > >
                      > > > > Steven W. Johnson
                      > > > > 471 W. Wilson Road #36
                      > > > > Pahrump, Nevada 89048
                      > > > > steve@...
                      > > > >
                      > > > >
                      > > > > Look here for Free PHP Classes of objects:
                      > > > > http://phpclasses.UpperDesign.com/
                      > > > > To unsubscribe from this group, send an email to:
                      > > > > php-objects-unsubscribe@egroups.com
                      > > > >
                      > > > >
                      > > > >
                      > > > > Your use of Yahoo! Groups is subject to
                      > > > > http://docs.yahoo.com/info/terms/
                      > > > >
                      > > > >
                      > > >
                      > > >
                      > > >
                      > > >
                      > > > Look here for Free PHP Classes of objects:
                      > > > http://phpclasses.UpperDesign.com/
                      > > > To unsubscribe from this group, send an email to:
                      > > > php-objects-unsubscribe@egroups.com
                      > > >
                      > > >
                      > > >
                      > > > Your use of Yahoo! Groups is subject to
                      > > http://docs.yahoo.com/info/terms/
                      > > >
                      > > >
                      > > >
                      > >
                      > >
                      > > Steven W. Johnson
                      > > 471 W. Wilson Road #36
                      > > Pahrump, Nevada 89048
                      > > steve@...
                      > >
                      >
                      >
                      > =====
                      > Mark Weinstock
                      > mark_weinstock@...
                      > ***************************************
                      > You can't demand something as a "right" unless you are willing to fight to
                      > death to defend everyone else's right to the same thing. -Stolen from the
                      > now-defunct Randy's Random mailing list.
                      > ***************************************
                      >
                      > __________________________________________________
                      > Do you Yahoo!?
                      > Yahoo! Web Hosting - Let the expert host your site
                      > http://webhosting.yahoo.com
                      >
                      >
                      > Look here for Free PHP Classes of objects:
                      > http://phpclasses.UpperDesign.com/
                      > To unsubscribe from this group, send an email to:
                      > php-objects-unsubscribe@egroups.com
                      >
                      >
                      >
                      > Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
                      >
                      >
                      >


                      Steven W. Johnson
                      471 W. Wilson Road #36
                      Pahrump, Nevada 89048
                      steve@...
                    • Derek Scruggs
                      Hi All, A quick search of phpclasses.org didn t yield any results so... I m looking for a class that can generate a complex WHERE clause for use in creating
                      Message 10 of 15 , Dec 5, 2002
                      • 0 Attachment
                        Hi All,

                        A quick search of phpclasses.org didn't yield any results so...

                        I'm looking for a class that can generate a complex WHERE clause for use
                        in creating named filters. For example, I might want to have a filter
                        called "Users in California" that checks for state=CA. That's pretty
                        simple, but a more complex one might be "Users in California who
                        completed survey X", so the where clause is users.state=CA and
                        surveys.userID=theUser AND surveys.surveyID=X

                        If a class is not freely available (and I suspect one is not), does
                        anyone have suggestions on how to tackle this? My initial thought is an
                        array of field names, the search condition for each field and some kind
                        of nesting structure to indicate whether subconditions are present and
                        how they relate to each other. The ultimate goal is to generate sql like
                        this:

                        SELECT .... WHERE (foo=foo AND bar=bar) OR (foo=bar AND bar=foo) OR
                        (foo=whatever OR bar=whatever) AND x=x

                        TIA,
                        Derek
                      • Demian Turner
                        have you looked into DB_DataObject http://pear.php.net/manual/en/packages.database.db-dataobject.php seems like it might address some of your requirements.
                        Message 11 of 15 , Dec 5, 2002
                        • 0 Attachment
                          have you looked into DB_DataObject

                          http://pear.php.net/manual/en/packages.database.db-dataobject.php

                          seems like it might address some of your requirements.

                          cheers,

                          Demian

                          Derek Scruggs wrote:

                          > Hi All,
                          >
                          > A quick search of phpclasses.org didn't yield any results so...
                          >
                          > I'm looking for a class that can generate a complex WHERE clause for use
                          > in creating named filters. For example, I might want to have a filter
                          > called "Users in California" that checks for state=CA. That's pretty
                          > simple, but a more complex one might be "Users in California who
                          > completed survey X", so the where clause is users.state=CA and
                          > surveys.userID=theUser AND surveys.surveyID=X
                          >
                          > If a class is not freely available (and I suspect one is not), does
                          > anyone have suggestions on how to tackle this? My initial thought is an
                          > array of field names, the search condition for each field and some kind
                          > of nesting structure to indicate whether subconditions are present and
                          > how they relate to each other. The ultimate goal is to generate sql like
                          > this:
                          >
                          > SELECT .... WHERE (foo=foo AND bar=bar) OR (foo=bar AND bar=foo) OR
                          > (foo=whatever OR bar=whatever) AND x=x
                          >
                          > TIA,
                          > Derek
                          >
                          >
                          >
                          > Yahoo! Groups Sponsor
                          > ADVERTISEMENT
                          > <http://rd.yahoo.com/M=240188.2647639.4038785.2225243/D=egroupweb/S=1705006764:HM/A=1321406/R=0/*http://www.e-dealsdaily.com/soundbug/>
                          >
                          >
                          >
                          > Look here for Free PHP Classes of objects:
                          > http://phpclasses.UpperDesign.com/
                          > To unsubscribe from this group, send an email to:
                          > php-objects-unsubscribe@egroups.com
                          >
                          >
                          >
                          > Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service
                          > <http://docs.yahoo.com/info/terms/>.




                          [Non-text portions of this message have been removed]
                        Your message has been successfully submitted and would be delivered to recipients shortly.