|
Posted by Veign on 12/30/06 19:07
This line:
$image = ($page == 2) 'images/bullet_on.gif' : 'images/bullet_off.gif';
Should be:
$image = ($page == 2) ? 'images/bullet_on.gif' : 'images/bullet_off.gif';
--
Chris
http://www.veign.com / http://www.veign.com/blog
--
"brown705" <brown705@gmail.com> wrote in message
news:1167501306.181967.71140@s34g2000cwa.googlegroups.com...
Rik,
Thanks for the info, but that didn't work for me. It gave this error
on the line that starts with $image:
Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING in
/home/**(edit)**/public_html/includes/links.php on line 11
I Googled for "php if statement" and ended up finding this:
http://www.tizag.com/phpT/ifelse.php
I used this method and it worked fine.
Michael
On Dec 28, 10:11 am, "Rik" <luiheidsgoe...@hotmail.com> wrote:
> brown705 wrote:
> > Hi,
>
> > I'm converting a client's web site from ASP to PHP, and besides the
> > SSIs, there is some variable use and some IF statements that I do not
> > know how to recreate in PHP (I'm quite amateur in PHP).
>
> > It seems the ASP code sets a variable called "page" at the top of each
> > page on the site, setting a unique number for the page. Then in the
> > links sidebar, it uses IF statements to identify the page and give a
> > different link image to the current page. Each link has a
> > bullet-style image in front of it, and the current page would have a
> > different color bullet when identified by the "page" variable.
>
> > Here's the code:
>
> > Each page had "<%page = X%>" at the top, where X was a unique
> > digit.<?php $page = X; ?>
>
> > Then each link looked like this:
>
> > <td>
> > <% image = "images/bullet_off.gif"%>
> > <%if page = 2 then image = "images/bullet_on.gif"%>
> > <img src="<%=image%>">
> > <% image = "images/bullet_off.gif"%><?php
> $image = ($page == 2) 'images/bullet_on.gif' : 'images/bullet_off.gif';
> echo "<img src=\"$image\">";
> ?>
>
> Judging from this little tiny bit of code, the ASP version wasn't very
> well
> coded, or at least not very efficiλnt. Line-for-line translation to PHP
> will probably not result in a very good system. Consider rewriting the
> thing.
> --
> Rik Wasmus- Hide quoted text -- Show quoted text -
Navigation:
[Reply to this message]
|