z0r Forums
A sudden coding question. - Printable Version

+- z0r Forums (https://board.z0r.de)
+-- Forum: English (https://board.z0r.de/forumdisplay.php?fid=3)
+--- Forum: Smalltalk (https://board.z0r.de/forumdisplay.php?fid=6)
+--- Thread: A sudden coding question. (/showthread.php?tid=46)



A sudden coding question. - buhruf - 26-08-2010

I have a question to site coder(s). How did you make every page to assign to it's number?

I have tried both ways to do something like that on my local site and I had this pictures on a quit:
1. Every page with it's flash (for example) file locates in it's own folder like 7324, but it was originally a failed structure after I saw I can enter any number in your site's address and there will be a z0r.de page anyway.
2. When writing this, I just thought I can create a page like 312.html in a root and use it in a navigation. But I ain't sure.

I also saw I can print xxxx or 12xxxxxx on your site and it works the same way.

As a noob in php coding I wonder how did you do that.
Can you give me an advice, please?

- respectfully. john.


RE: A sudden coding question. - eins - 26-08-2010

I forward the number via htaccess to a php script.
For example http://z0r.de/4 forwards to http://z0r.de/index.php?id=4
The php script then displays the respective animation.


RE: A sudden coding question. - buhruf - 26-08-2010

So you use a rewrite module for that?


RE: A sudden coding question. - eins - 26-08-2010

jup

Code:
RewriteEngine on
RewriteRule ^([0-9]+)$ index.php?id=$1
This will forward only numbers so subfolders that begin with letters still work


RE: A sudden coding question. - buhruf - 26-08-2010

Huge thanks. Didn't think it is that easy.