Re: goto
| From: | Peter | Date: | Thu, 13 Jun 2002 20:07:11 +0000 |
| Subject: | Re: goto | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-102047@lists.php.net to get a copy of this message | ||
maybe switch() would be of some use? Your could save the values for $type
in an array and look them up to get a numbe to use with switch(). You can
also have a "case else" with switch.
"Stephen Brewster" <steve@cite.co.uk> wrote in message
news:20020613122618.71214.qmail@pb1.pair.com...
> I am wirting a code seperation engine for PHP, the idea of which is it
will
> remove the need for me to have to build the majority of the websites at my
> company. The designers will be able to build the html in dreamweaver or
> similar and then insert custom tags into their code. The engine will parse
> the code and insert the necessary PHP code. For the most part this engine
is
> working. However under some cirtumstances (like the one shown below) I
need
> to be able to perfom a loop or if statement. This is proving to be
> incredably difficult since I would end up with code like below. For
obvious
> reasons the compiler does not like this code. This would be simple if PHP
> had GOTO's. Does anyone know of a way around this situation?
>
> HTML
> ----
> <table>
> <products type="loop">
> <tr>
> <td><products type="text" field="name"></td>
> <td><products type="text" field="price"></td>
> </tr>
> <products type="endloop">
> </tr>
>
>
> PHP
> ---
>
> if($type == 'LOOP') {
> $sql = 'SELECT * FROM products';
> $result = mysql_query($sql, $db);
> $record = $mysql_fetch_array($result, MYSQL_ASSOC);
> {
> }
>
> if($type == 'TEXT')
> echo($record[$field]);
>
> if($type == 'ENDLOOP') {
> }
> }
>
> --
>
> ------------------------------------------------------
> Stephen Brewster
> Email: steve@cite.co.uk
> Tel: 0116 2335545
> Mobile: 07776 475849
> ICQ: 383095
> ------------------------------------------------------
>
> UNIX SEX
> unzip; strip; touch; finger; mount; fsck; more; yes; umount; sleep
>
>
>