Welcome to WebmasterWorld Guest from 54.224.0.153

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

Dynamic php/mysql driven site

question/advice on link structure

     
12:20 pm on Oct 21, 2002 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Apr 22, 2002
posts:2546
votes: 0


Hello. I'm working on building my first dynamic site. I was wondering about how most of you with dynamic sites structure your links.

Do you build a template for each main category or one template for all?

What is the best way to pass variables?

  • mysite.com/template.php?category_id=1
  • mysite.com/template.php/1

Thanks for any advice!

12:30 pm on Oct 21, 2002 (gmt 0)

Senior Member

WebmasterWorld Senior Member nick_w is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:Feb 4, 2002
posts:5044
votes: 0


Hi Birdman,

I prefer the latter. As for templates, just depends on how you want it to look....

Nick

12:32 pm on Oct 21, 2002 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Dec 6, 2001
posts:2213
votes: 0


BM

Methods may vary. For one i have been involed in the template stays the same and the variable passed is used to get the information out. You may need to include a bit of IF empty do nothing else echo variable to avoid strange looking blank spaces. If you want different colours or looks for each section that is fine also. Depends what you want.

mysite.com/template.php?category_id=1

mysite.com/template.php/1

It looks like the first one is the way in which you will be doing it but the second hase been rewritten using the rewrite module, but that is a different beast right now.

If you want to keep the URL parameter name down to a minimum you dont have to call it the name of the DB feild. There is nothing to stop you calling it id=

Cheers and best of luck

1:38 pm on Oct 21, 2002 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Apr 22, 2002
posts:2546
votes: 0


Sorry, I thought I posted this earlier. Lost connection:(

mysite.com/template.php/1

I was experimenting with this method.
$res = explode("my_product_catalog.html/", $REQUEST_URI);
$vars = explode("/", $res[1]);
$var1 = $vars[0]; //now var1 holds value1
$var2 = $vars[1]; //and var2 holds value2

It just seem like a more natural url that SEs might prefer. I read somewhere today that engines don't index?dynamic_urls. Do you agree that this option may be more 'search engine friendly'?
4:59 pm on Oct 21, 2002 (gmt 0)

Junior Member

10+ Year Member

joined:May 2, 2002
posts:141
votes: 0


When I first developed my site, I used the form
www.mysite.com/artist.php?id=1

However I felt it looked better (and probably crawled better) if I used the form
www.mysite.com/artista/1/artist_name.html

To get to the second form is not difficult at all, just added a rewrite rule for this domain:

RewriteRule ^/artista/(.*)/(.*)\.html$ /artista/artista.html?id=$1 [PT,L]

And, of course, told PHP to parse HTML pages as well:

AddType application/x-httpd-php .php .html

There, from a SEO viewpoint, you have a link and a page with keywords, isn't that just great? :)

Hope that helps!