Author Topic: Making a webcomic: "dynamic hyperlinks"  (Read 11304 times)

0 Members and 1 Guest are viewing this topic.

Offline sqrt(Time)

  • LV2 Member (Next: 40)
  • **
  • Posts: 37
  • Rating: +4/-0
    • View Profile
Re: Making a webcomic: "dynamic hyperlinks"
« Reply #30 on: September 24, 2011, 08:44:34 pm »
As for the difficulty of adding a new comic - you could create a PHP page, sort of as an admin interface, to let you upload the file, and then automatically increment $max and store the title/alt text for you. Password protected, of course.
It might not work too well, if your web host doesn't let you do file uploads like that through some sort of stupid/weird restrictions.
Another way to make it somewhat simpler, perhaps, is to have a .txt file with all the titles and alt text (or a large number, 1 per comic), which the PHP script looks through. Also, just by checking if a file/line is present, it could then remove the need for $max.

You can do some fancy URL replacement stuff in what for you will probably be a .htaccess file. Googling for "RewriteRule" or "mod_rewrite" should tell you how; you can do stuff like making the comic URLs be http://www.shakespearescomics.tk/8, or http://www.shakespearescomics.tk/comic/8, or http://www.shakespearescomics.tk/hr7389i/uqhr8yug/lolol if you feel like it.

Offline squidgetx

  • Food.
  • CoT Emeritus
  • LV10 31337 u53r (Next: 2000)
  • *
  • Posts: 1881
  • Rating: +503/-17
  • rawr.
    • View Profile
Re: Making a webcomic: "dynamic hyperlinks"
« Reply #31 on: September 24, 2011, 10:13:48 pm »
I googled and I became hopelessly confused...Does anyone have a table or something for the syntax and special char parameters for RewriteRule?

Edit: I added this line to .htaccess
Code: [Select]
RewriteRule ^([^/]*)$ /index.php?p=$1 [L] and it just killed my CSS...aka the page loads with no styling O_o.
« Last Edit: September 24, 2011, 10:42:30 pm by squidgetx »

Offline Eeems

  • Mr. Dictator
  • Administrator
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 6266
  • Rating: +318/-36
  • little oof
    • View Profile
    • Eeems
Re: Making a webcomic: "dynamic hyperlinks"
« Reply #32 on: September 24, 2011, 11:19:25 pm »
You could have the script dynamically parse what $max should be, and you could create a form for yourself to upload the file as well as update the title/text ( just make sure to make it secure ).
There should be, at the least, you could just do a substr() but I'm pretty sure there are more advanced methods.
I'd say stick with the dynamic design and just try to make it more streamlined.
/e

Offline sqrt(Time)

  • LV2 Member (Next: 40)
  • **
  • Posts: 37
  • Rating: +4/-0
    • View Profile
Re: Making a webcomic: "dynamic hyperlinks"
« Reply #33 on: September 25, 2011, 09:26:57 pm »
Squidgetx, the reason that breaks your CSS is because that regex is too general... when the browser sends a request for http://www.shakespearescomics.tk/comic.css, Apache will look for http://www.shakespearescomics.tk/index.php?p=comic.css instead.
You could try
Code: [Select]
RewriteRule ^([0-9]*)$ /index.php?p=$1 [L] instead, this will only match numeric inputs.

Offline squidgetx

  • Food.
  • CoT Emeritus
  • LV10 31337 u53r (Next: 2000)
  • *
  • Posts: 1881
  • Rating: +503/-17
  • rawr.
    • View Profile
Re: Making a webcomic: "dynamic hyperlinks"
« Reply #34 on: September 26, 2011, 12:19:10 pm »
Thanks, that worked :D