Is PHP a better design than having a page for each game? Instead I see sides with .../php?=1
or something like that while addictinggames.com has a .html for every game page.
In other words is it better enough that I would want to learn it?
better or not, i can't really say, but it will be a lot easier to just use different pages. the query in the url should be use only when the page need different value for each parameter.
but if you can cramp everything in 1 page, you can show off to your friends.
Okay. I'm going for a simple site but later on I may sell things on it. Should I then go to PHP because it has better security? In other words could I use PHP so that they can only download something once they paid?
What I prefer is to use .htaccess tweaks to change a query string into a memorable url. This is what a lot of websites, including addictinggames.com (even though it should really be "addictive"!) do.
Here is a basic content management system file structure:
./ <root directory>
./admin/ <directory containing administration pages - a different front-end to the rest of the website>
./components/ <directory containing parts of the website>
./components/component1/ <directory containing all the files under the component "component1">
./includes/ <directory containing anything that you would include in all or some pages>
./templates/ <directory containing styles for the website>
./.htaccess <.htaccess file (see below)>
./index.php <index file through which all of your website is accessed>
Here is what .htaccess would look like:
| Code: |
RewriteEngine On
RewriteCond %{REQUEST_URI} !^/admin
RewriteRule ^([^/\.]+)/([^/\.]+)/([^/\.]+)/([^/\.]+)\.html$ /index.php?name=$1&file=$2&act1=$3&act2=$4 [QSA,L]
RewriteCond %{REQUEST_URI} !^/admin
RewriteRule ^([^/\.]+)/([^/\.]+)/([^/\.]+)([/]?)$ /index.php?name=$1&file=$2&act1=$3 [QSA,L]
RewriteCond %{REQUEST_URI} !^/admin
RewriteRule ^([^/\.]+)/([^/\.]+)([/]?)$ /index.php?name=$1&file=$2 [QSA,L]
RewriteCond %{REQUEST_URI} !^/admin
RewriteRule ^([^/\.]+)([/]?)$ /index.php?name=$1 [QSA,L]
RewriteCond %{REQUEST_URI} !^/admin
RewriteRule ^$ /index.php [QSA,L] |
That looks a little complicated, but basically it'll map any query you enter into the address bar to something else. For example:
Type in http://www.yoursite.com/content/news/article3/page2.html
It reads it as http://www.yoursite.com/index.php?name=content&file=news&act1=article3&act2=page2
That's just an example. Your index.php would then look in ./components/content/news.php and the news.php file would query the database for article 3, page 2.
Last edited by Fire Boar on Sun Feb 10, 2008 12:29 pm; edited 1 time in total
Okay thanks. It looks complicated though to me as I've never done PHP but looking into it now. Hopefully I can learn it to make my site better .
| Game_Maker_User wrote: |
| Okay thanks. It looks complicated though to me as I've never done PHP but looking into it now. Hopefully I can learn it to make my site better . |
I suggest you to learn PHP and rewrite them to look like html like Fire Boar told you. I have used this technique very active and I think that sites like AddictingGames.com use it too.
You can make this in HTML and use IFrames, that way you wont see the extra URL. Alltough when making better websites, this might just not look to good...
| Mazty wrote: |
| You can make this in HTML and use IFrames, that way you wont see the extra URL. Alltough when making better websites, this might just not look to good... |
Why he should use IFrames?! Any kind of frames are last thing to do.
| Game_Maker_User wrote: |
| Okay thanks. It looks complicated though to me as I've never done PHP but looking into it now. Hopefully I can learn it to make my site better . |
I used to use "index.php?id=xxx" url formats on my website Music-Whiz.com (which I have had for about 6 months or so).
I spent yesterday and today changing my links to URL rewritten ones, it was something I'd been meaning to do for a while.
I put it off because someone told me on a forum (i think it was this one) that it was really hard to do URL rewriting.
I just have to say it was so easy - you just have to get a basic understanding and then you are on your way.
My advice to you, is that if you are going to have more than say 10 pages, use PHP instead of HTML. For SEO and ease of use by your site visitors, use URL rewriting where you can.
If you understand HTML already, PHP won't take long to learn because you just insert the php code into your html - so once you learn the basic function you're on your way! Frihost is also a pretty good forum to get help if you really get stuck on something. Try the php tutorial at PHP.net to get you familiar with the basic PHP concepts.
As far as URL rewriting goes, here are a couple of tutorials I found useful:
http://corz.org/serv/tricks/htaccess2.php
http://www.yourhtmlsource.com/sitemanagement/urlrewriting.html
Goodluck!
I agree richard270384. I have lots of experience about this. Search engines like rewritten urls and they look much prettier than php variable urls. Your job will reduce with php.