|
Posted by Rik on 12/28/06 16:11
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
Navigation:
[Reply to this message]
|