Truth and Beauty Bombs

it's different, i think it's different
TaBB Archives!
It is currently Wed May 22, 2013 3:48 pm

All times are UTC - 5 hours [ DST ]




Post new topic Reply to topic  [ 26 posts ] 
Author Message
 Post subject: How does DC comic navigation work?
PostPosted: Sat Jul 30, 2011 11:49 pm 
Offline
User avatar

Joined: Thu Apr 22, 2010 6:14 pm
Posts: 8484
Location: pleasemail
I'd like to do something similar for my site. I mean how you switch comics without reloading the page and having the url change so you can still link to particular comics.

_________________
I tread on air and contemplate the sun.


Post details Warn user
Top
 Profile  
 
 Post subject: Re: How does DC comic navigation work?
PostPosted: Sun Jul 31, 2011 12:23 am 
Offline
User avatar

Joined: Thu Apr 22, 2010 6:14 pm
Posts: 8484
Location: pleasemail
Like I notice the url dons a similar cap to this message board url:

.php?(something here)

viewtopic.php?f=6&t=6218&p=250719#p250719

http://www.qwantz.com/index.php?comic=2010

_________________
I tread on air and contemplate the sun.


Post details Warn user
Top
 Profile  
 
 Post subject: Re: How does DC comic navigation work?
PostPosted: Sun Jul 31, 2011 1:09 am 
Offline
User avatar

Joined: Wed May 27, 2009 10:25 pm
Posts: 9929
Location: A Sweet Oscilloscope
It doesn't do anything crazy like you're thinking, it's just fast.

_________________
Please stop, sir, I have half your teeth out.


Post details Warn user
Top
 Profile  
 
 Post subject: Re: How does DC comic navigation work?
PostPosted: Sun Jul 31, 2011 1:11 am 
Offline
User avatar

Joined: Thu Apr 22, 2010 6:14 pm
Posts: 8484
Location: pleasemail
well regardless, it looks like I can avoid making individual webpages for each comic which is something I find enticing right now.

Do you know how it goes?

_________________
I tread on air and contemplate the sun.


Post details Warn user
Top
 Profile  
 
 Post subject: Re: How does DC comic navigation work?
PostPosted: Sun Jul 31, 2011 1:12 am 
Offline
User avatar

Joined: Thu Apr 22, 2010 6:14 pm
Posts: 8484
Location: pleasemail
There are several webcomics that seem to do this now that I look around. It seems to me like it's a favorable system.

_________________
I tread on air and contemplate the sun.


Post details Warn user
Top
 Profile  
 
 Post subject: Re: How does DC comic navigation work?
PostPosted: Sun Jul 31, 2011 1:31 am 
Offline
User avatar

Joined: Wed May 27, 2009 3:15 pm
Posts: 3806
Do you have any sort of CMS installed? cos it sounds like you want an S to M your C


Post details Warn user
Top
 Profile  
 
 Post subject: Re: How does DC comic navigation work?
PostPosted: Sun Jul 31, 2011 1:35 am 
Offline
User avatar

Joined: Wed May 27, 2009 3:15 pm
Posts: 3806
I once installed wordpress on a shared server so I think I know a little about what it means when "php" is in the url like that


Post details Warn user
Top
 Profile  
 
 Post subject: Re: How does DC comic navigation work?
PostPosted: Sun Jul 31, 2011 1:36 am 
Offline
User avatar

Joined: Thu Apr 22, 2010 6:14 pm
Posts: 8484
Location: pleasemail
I have a little. I vaguely familiar with word press and drupal. I'm not exactly sure they do what I want to do. Or I donno. I'm having trouble finding out how to use them.

_________________
I tread on air and contemplate the sun.


Post details Warn user
Top
 Profile  
 
 Post subject: Re: How does DC comic navigation work?
PostPosted: Sun Jul 31, 2011 1:38 am 
Offline
User avatar

Joined: Mon Apr 26, 2010 12:03 am
Posts: 26263
"php" is onomatopoeia, right

_________________
JUST BELIEVE WHATEVER YOU WANT DANIEL FUCK EVERYBODY DONT TAKE THEIR SHIT AND HAVE FUN


Post details Warn user
Top
 Profile  
 
 Post subject: Re: How does DC comic navigation work?
PostPosted: Sun Jul 31, 2011 1:39 am 
Offline
User avatar

Joined: Mon Apr 26, 2010 12:03 am
Posts: 26263
the sound you make when
you see some pleb
thinking he can use the internet
:ugeek:

_________________
JUST BELIEVE WHATEVER YOU WANT DANIEL FUCK EVERYBODY DONT TAKE THEIR SHIT AND HAVE FUN


Post details Warn user
Top
 Profile  
 
 Post subject: Re: How does DC comic navigation work?
PostPosted: Sun Jul 31, 2011 1:28 pm 
Offline
User avatar

Joined: Thu Apr 22, 2010 6:14 pm
Posts: 8484
Location: pleasemail
Hmm. I think I stumbled on how it happens.

_________________
I tread on air and contemplate the sun.


Post details Warn user
Top
 Profile  
 
 Post subject: Re: How does DC comic navigation work?
PostPosted: Sun Jul 31, 2011 1:40 pm 
Offline
User avatar

Joined: Thu Apr 22, 2010 6:14 pm
Posts: 8484
Location: pleasemail
Hmm. I think I stumbled on how it happens.

_________________
I tread on air and contemplate the sun.


Post details Warn user
Top
 Profile  
 
 Post subject: Re: How does DC comic navigation work?
PostPosted: Sun Jul 31, 2011 2:11 pm 
Offline
User avatar

Joined: Thu Apr 22, 2010 6:14 pm
Posts: 8484
Location: pleasemail
http://php.net/manual/en/function.parse-url.php

Fancy Fancy!

_________________
I tread on air and contemplate the sun.


Post details Warn user
Top
 Profile  
 
 Post subject: Re: How does DC comic navigation work?
PostPosted: Sun Jul 31, 2011 2:26 pm 
Offline
User avatar

Joined: Wed May 27, 2009 1:26 pm
Posts: 1782
you're barking up the wrong tree gbro
look up $_GET


Post details Warn user
Top
 Profile  
 
 Post subject: Re: How does DC comic navigation work?
PostPosted: Sun Jul 31, 2011 2:32 pm 
Offline
User avatar

Joined: Mon Apr 26, 2010 12:03 am
Posts: 26263
GET_$
GET_PAID
CHI_CITY_MAYNE

_________________
JUST BELIEVE WHATEVER YOU WANT DANIEL FUCK EVERYBODY DONT TAKE THEIR SHIT AND HAVE FUN


Post details Warn user
Top
 Profile  
 
 Post subject: Re: How does DC comic navigation work?
PostPosted: Sun Jul 31, 2011 2:34 pm 
Offline
User avatar

Joined: Wed May 27, 2009 1:17 pm
Posts: 16722
DO bitches
WHILE crunk

_________________
俺の歌う聞け!!!!!!
hyaku yon jyuu moji no boku no inori wo
もうなんだか 甘いノンケが食べたい
Follow the 'innernet,' not the internet.


Post details Warn user
Top
 Profile  
 
 Post subject: Re: How does DC comic navigation work?
PostPosted: Sun Jul 31, 2011 3:09 pm 
Offline
User avatar

Joined: Thu Apr 22, 2010 6:14 pm
Posts: 8484
Location: pleasemail
Venerable revfitz, do you have any more clues for me?

_________________
I tread on air and contemplate the sun.


Post details Warn user
Top
 Profile  
 
 Post subject: Re: How does DC comic navigation work?
PostPosted: Sun Jul 31, 2011 3:10 pm 
Offline
User avatar

Joined: Wed May 27, 2009 1:26 pm
Posts: 1782
I don't really know what you're trying to do. Just go find a tutorial about PHP and read it and it will talk about how you use the ? stuff in the URL.


Post details Warn user
Top
 Profile  
 
 Post subject: Re: How does DC comic navigation work?
PostPosted: Sun Jul 31, 2011 3:20 pm 
Offline
User avatar

Joined: Thu Apr 22, 2010 6:14 pm
Posts: 8484
Location: pleasemail
I'm basically trying to do what Ryan North did with his comics. It looks like you can switch comics and have a linkable url without having to make thousands of html pages.

I'm still pretty new to php and programming in general. But it looks like this is something. Although it isn't altogether clear how it all works out. I'll just keep trying out stuff.

_________________
I tread on air and contemplate the sun.


Post details Warn user
Top
 Profile  
 
 Post subject: Re: How does DC comic navigation work?
PostPosted: Mon Aug 01, 2011 9:56 pm 
Offline
User avatar

Joined: Thu Apr 22, 2010 6:14 pm
Posts: 8484
Location: pleasemail
Bwahahahahahahahaha! I have discovered secrets!

http://casualkarate.net/index.php?comic=0001

but the navagation has discovered some bugs

http://www.casualkarate.net/index.php?comic=-3

_________________
I tread on air and contemplate the sun.


Post details Warn user
Top
 Profile  
 
 Post subject: Re: How does DC comic navigation work?
PostPosted: Sat Aug 06, 2011 9:17 pm 
Offline
User avatar

Joined: Thu Apr 22, 2010 6:14 pm
Posts: 8484
Location: pleasemail
Here's the code I use to get this to work in-case anyone is interested. If I'm doing something stupid in there, kindly let me know.


Code:
<?php











   $con = mysql_connect("database-url","login-name","password");

      if (!$con)

        {

        die('Could not connect: ' . mysql_error());

        }



      mysql_select_db("comic_sql", $con);









$comic = $_GET["comic"];

$home_result = mysql_query("SELECT * FROM comic_table ORDER BY ID DESC LIMIT 1");



$comicArray = mysql_fetch_array($home_result);


$home_comic = $comicArray[ID];








if(empty($_GET) || $comic == $home_comic)

   {



   $comic_img = "comic" . $home_comic;



   $alt = $comicArray[comicTitle];



   $previous_comic = "http://www.casualkarate.net/index.php?comic=" . ($home_comic - 1);



   $next_comic = "#";



   }




elseif($comic > 1)

   {



   $comic_img = "comic" . $comic;



   $result = mysql_query("SELECT * FROM comic_table WHERE ID=" . $comic);

   

   $alt_array = mysql_fetch_array($result);

   

   $alt = $alt_array[comicTitle];



   $previous_comic = "http://www.casualkarate.net/index.php?comic=" . ($comic - 1);



   $next_comic = "http://www.casualkarate.net/index.php?comic=" . ($comic + 1);



   }

else
   {
   
   $comic_img = "comic" . $comic;



   $result = mysql_query("SELECT * FROM comic_table WHERE ID=" . $comic);

   

   $alt_array = mysql_fetch_array($result);

   

   $alt = $alt_array[comicTitle];



   $previous_comic = "#";



   $next_comic = "http://www.casualkarate.net/index.php?comic=" . ($comic + 1);

   }









   mysql_close($con);





echo "<div class='comic'>";

echo   "<img src='comic_jpg/" . $comic_img . ".jpg' alt='" . $alt . "' />";      

echo "</div>";





echo "<ul class='next_previous'>";

echo "   <li><a class='previous_button' href='" . $previous_comic . "' />previous</a></li>";

echo "   <li><a class='next_button' href='" . $next_comic . "'>next</a></li>";

echo "</ul>";







?>

_________________
I tread on air and contemplate the sun.


Post details Warn user
Top
 Profile  
 
 Post subject: Re: How does DC comic navigation work?
PostPosted: Sat Aug 06, 2011 9:40 pm 
Offline
User avatar

Joined: Wed May 27, 2009 1:17 pm
Posts: 16722
$alt = $alt_array[comicTitle];

I don't see what Big Salt has to do with comics
you are doing something stupid here

_________________
俺の歌う聞け!!!!!!
hyaku yon jyuu moji no boku no inori wo
もうなんだか 甘いノンケが食べたい
Follow the 'innernet,' not the internet.


Post details Warn user
Top
 Profile  
 
 Post subject: Re: How does DC comic navigation work?
PostPosted: Sat Aug 06, 2011 11:28 pm 
Offline
User avatar

Joined: Thu Apr 22, 2010 6:14 pm
Posts: 8484
Location: pleasemail
Look how beautiful the code does my site:

http://casualkarate.net/

_________________
I tread on air and contemplate the sun.


Post details Warn user
Top
 Profile  
 
 Post subject: Re: How does DC comic navigation work?
PostPosted: Sun Aug 07, 2011 2:21 am 
Offline
User avatar

Joined: Wed May 27, 2009 10:25 pm
Posts: 9929
Location: A Sweet Oscilloscope
I see two things that pop out at me

1) don't double-space code
2) "http://www.casualkarate.net/index.php?comic=" appears a lot, so you should put it in a constant. I just looked up constants in php and they are kind of weird
but here's what you do (I think)

at the top of the code (right after <?php) write
Code:
define('BASE_URL', 'http://www.casualkarate.net/index.php')
define('COMIC_URL', BASE_URL.'?comic=')

and then replace every instance of "http://www.casualkarate.net/index.php?comic=" with COMIC_URL like so
Code:
$previous_comic = COMIC_URL . ($home_comic - 1);


now you can change the url by changing one line (although if you do change url schemes, please make an effort to not break the old urls). also, now there's less to mistype, and if you do mistype it then you should get an obvious error when the page is loaded instead of a 404 when the user clicks the link.
this is GOOD PROGRAMMER HABITS so whenever you end up using the same string or number a lot for the same reason you should think to yourself "hey dawg" (you call yourself dawg, right? anyway) "hey dawg, let's put this shit in a constant")

though you should probably get BASE_URL programatically. I don't know PHP tho and doing that is different depending on your server software so you're on your own if you want to try that.

_________________
Please stop, sir, I have half your teeth out.


Post details Warn user
Top
 Profile  
 
 Post subject: Re: How does DC comic navigation work?
PostPosted: Sun Aug 07, 2011 4:41 am 
Offline
User avatar

Joined: Wed May 27, 2009 1:26 pm
Posts: 1782
yeah the double-spacing thing is a bit much

also you probably want to check whether $comic - 1 is a valid number, and not show the previous link if it isn't (to fix that one bug)

and if you are feeling really fancy you could redirect to the front page if someone puts something in the url that isn't a real comic number


Post details Warn user
Top
 Profile  
 
 Post subject: Re: How does DC comic navigation work?
PostPosted: Sun Aug 07, 2011 4:42 am 
Offline
User avatar

Joined: Wed May 27, 2009 1:26 pm
Posts: 1782
oh, you already kind of fixed that one thing


Post details Warn user
Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 26 posts ] 

All times are UTC - 5 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 0 guests


Quick-mod tools:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
cron
Powered by phpBB
a softer world : dinosaur comics : oh no robot : the perry bible fellowship : project wonderful : poppycock theater : rsspect : wonderella : wondermark : whispered apologies
wild and paranoid half-truths await you at wooopedia