Welcome to WebmasterWorld Guest from 54.159.26.69

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

Dynamic php/mysql driven site

question/advice on link structure

     

Birdman

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

WebmasterWorld Senior Member 10+ Year Member



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!

Nick_W

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

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



Hi Birdman,

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

Nick

ukgimp

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

WebmasterWorld Senior Member 10+ Year Member



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

Birdman

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

WebmasterWorld Senior Member 10+ Year Member



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'?

transistor

4:59 pm on Oct 21, 2002 (gmt 0)

10+ Year Member



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!

 

Featured Threads

Hot Threads This Week

Hot Threads This Month