0 Members and 1 Guest are viewing this topic.
<?php $cur = $_GET['p']; ?><a href="/?p=<?php echo $cur - 1; ?>"><img src="thebestprevbuttonever"></a><a href="/?p=<?php echo $cur + 1; ?>"><img src="thebestnextbuttonever"></a>
Hmm, could I get some help? It's kinda annoying that I can't test out PHP scripts offline, i'm waiting for the nameservers to resolve atm.
Code: (php) [Select]<?php $cur = $_GET['p']; ?><a href="/?p=<?php echo $cur - 1; ?>"><img src="thebestprevbuttonever"></a><a href="/?p=<?php echo $cur + 1; ?>"><img src="thebestnextbuttonever"></a>This would show two buttons, one linking to the previous comic, one linking to the next. (You could also add something like changing "$cur - 1" to "$cur > 0 ? $cur - 1 : 0" and "$cur + 1" to "$cur < $max ? $cur + 1 : $max" for safety as long as you always changed $max to the current comic number) Need anything else?
Oh wow, I didn't realize that php outputs html LOL. Thanks . So just to clarify, I would then have to name each comic's page /?p=#, correct?
<img src="img/page_<?php echo $cur; ?>.png"/>
well, it would be one file, "index.php" which you can pass different arguments for the page numbers. That code just takes the argument and outputs buttons linking to the right page, so you don't really "name" them, other than the one main file, which is probably going to be index.php. Does that make sense and answer the question?
Darn you ninjas!!! But yes, also what Eeems said =P
<1><title>Title</title><alt>Alt text</alt></1>
<h2><?php echo $xml->$cur->title ?> </h2><img.... title=<?php $xml->$cur->alt ?>>
Ok, I see. Wow, php is pretty powerful lol. And then for alt text and stuff should I use an xml file?Code: (xml) [Select]<1><title>Title</title><alt>Alt text</alt></1>Code: (php) [Select]<h2><?php echo $xml->$cur->title ?> </h2><img.... title=<?php $xml->$cur->alt ?>>Does this work?