Simple PHP webcomic code

Disclaimer: All care No Responsibility. you follow the instructions provided at your own risk. I take no responsibility any damage you may cause. Please read the article in full before starting

I have worked on the Life of Riley comic code for a while and realised its a good base for anyone else to use for their own webcomic. its really simple and should be easy enough to modify to suit your webcomic with some simple HTML stuff.

Here it is on sourceforge

Here it is to download now

I have added on this version to include a basic mysql table to pull the titles out since they were not printed on the images, I recommend you print the comic titles (if you are naming them) on the images but if thats not feasible then here is the additional code to pull from a mysql database. it should be quite straightforward. I feed the request the $titleid which comes from the URL eg /comic.php?strip=1
mysql_connect('localhost or mysql.yourdomain.com','yourusername','yourpassword');
@mysql_select_db('databasename') or die( "err1");

$query="SELECT * FROM titles";
$result=mysql_query($query);

$title=mysql_result($result,$titleid,"title");

mysql_close();

Here is an SQL file of the table to get you started

The only major flaw is currently you need to update the end # of the comics if your comics list is dynamic, mine is static so it doesnt need to change.  a simple way of doing this could be instead of

comic.php

$lastcomic = "100";

create a new file called end.php which you update as you go

comic.php

//$lastcomic = "100"; commented out not useing this anymore
@include end.php;

end.php

$lastcomic = "616";

And now you can edit that end.php as you update. It would be much smarter to use Mysql for this as it would be a really simple call to find out the end but I wanted this comic to be flat and not to require SQL

Leave a Reply

Your email address will not be published.

Name *
Email *
Website

Protected by WP Anti Spam