php for loop trouble
Posted: Tue Sep 27, 2005 1:02 am
All right I know it has been a while since I have first undertaken the php plunge and I am still very much on the super low end of the learning curve ;D
I am trying to rewrite a website in php which formerly written in javascript accesses an array for it's information and then creates a webpage based off of the number of entries. Some day this information will probably be located in a database, that day is not today though. Here is an example of the javascript in action, and here is my newest not working php.Everything seems to be working, except for that "for if else" statement. I am not sure what it is that is amiss, if anyone has any suggestions.
I am trying to rewrite a website in php which formerly written in javascript accesses an array for it's information and then creates a webpage based off of the number of entries. Some day this information will probably be located in a database, that day is not today though. Here is an example of the javascript in action, and here is my newest not working php.
Code: Select all
<?php
$series_title='Template';
$publisher='Comic Gnome';
$description='The Comic Gnome welcomes you. A Resource of no Recourse';
$keywords='comic books, summaries, publisher';
$url_style='pics';
$url_code='html';
$image_url='pic';
$series_thoughts='My thoughts on this series as a whole have not entirely been formed yet, at least not so far as I would feel comfortable making them public. But anyway, I highly doubt that you came here to read what it is that I may or may not have thought.';
$a[$i]='??';
$b[$i]='??';
$x[$i]='Writer';
$c[$i]='??';
$y[$i]='Penciller';
$d[$i]='??';
$z[$i]='Inks';
$e[$i]='??';
$f[$i]='A summary to comeA summary to comeA summary to ';
$g[$i]='A summary to comeA summary to comeA summary to ';
$a[$i]='??';
$b[$i]='??';
$x[$i]='Writer';
$c[$i]='??';
$y[$i]='Penciller';
$d[$i]='??';
$z[$i]='Inks';
$e[$i]='??';
$f[$i]='A summary to comeA summary to comeA summary to ';
$g[$i]='A summary to comeA summary to comeA summary to ';
$a[$i]='??';
$b[$i]='??';
$x[$i]='Writer';
$c[$i]='??';
$y[$i]='Penciller';
$d[$i]='??';
$z[$i]='Inks';
$e[$i]='??';
$f[$i]='A summary to comeA summary to comeA summary to ';
$g[$i]='A summary to comeA summary to comeA summary to ';
$v ="count($a)";
include('page_head.inc');
?>
<body>
<a name=top></a>
<table id=main cellpadding=0 cellspacing=0 border=0>
<tr><td id="topleft"><?php echo("<img src=$url_style/spacer.gif width=174 height=101>"); ?></td>
<td id="topright"><?php echo("<img src=$url_style/banner.gif width=271 height=100>"); ?></td></tr>
<tr><td id="marquee" colspan="2"><marquee scrollamount=4><script type="text/javascript">document.write(getmarquee());</script></marquee></td></tr>
<tr><td id="navigation" rowspan="2">
<table class="navigation" cellpadding=0 cellspacing=0>
<?php include("$url_style/page_navigation.inc"); ?>
</table></td>
<td id="content">
<table class=news cellpadding=0 cellspacing=0>
<tr class=info1>
<td><?php echo("<img src=\"$url_style/info_1.gif\" height=30>"); ?></td>
<td class=newstitle><?php echo("<span class=nobr>$series_title</span>"); ?></td>
<td style="text-align:right;"><?php echo("<img src=\"$url_style\/info_3.gif\" height=30>"); ?></td></tr>
<tr><td class=info_content colspan=3><br><?php echo("$series_thoughts"); ?><br><br><hr></td></tr>
<tr><td><span class=nobr> Issues Owned: </span></td>
<td align="center" width=100%><span class=nobr>
<a href=#??>??</a>, <a href=#??>??</a>
</span></td>
<td align="right"><span class=nobr><?php echo(" <i>of </i> $max_in_series "); ?></span></td></tr>
</table>
<?php
for ($i=0; $i<$v; $i++)
{
echo("<a name=$a[$i]></a><br>");
if( ($i==0) || ($i==2) || ($i==4) || ($i==6) || ($i==8) || ($i==10) || ($i==12) || ($i==14) || ($i==16) )
{echo("
<table class=left cellspacing=1 cellpadding=0>
<tr class=dated><td class=left># $a[$i]</td>
<td></td><td class=right>$b[$i]</td>
<td rowspan=4><img alt=\"$series_title # $a[$i]\" src=pics/$image_url.$a[$i].jpg height=306 width=201></td></tr>
");}
else
{echo("
<table class=right cellspacing=1 cellpadding=0>
<tr class=dated><td rowspan=4><img alt=\"$series_title # $a[$i]\" src=pics/$image_url.$a[$i].jpg height=306 width=201></td>
<td>$b[$i]</td><td></td><td class=right># $a[$i]</td></tr>
");}
echo("<tr class=credittop><td class=credittop>$x[$i]</td><td class=credittop>$y[$i]</td><td class=credittop>$z[$i]</td></tr>");
echo("<tr class=creditbottom><td class=creditbottom>$c[$i]</td><td class=creditbottom>$d[$i]</td><td class=creditbottom>$e[$i]</td></tr>");
echo("<tr><td colspan=3 align=center><b>$f[$i] $g[$i]</b></td></tr>");
echo('</table>');
}
?>
<hr>
<?php include('page_footer.inc'); ?>
</BODY>
</HTML>