Forum Moderators: coopster
Do you build a template for each main category or one template for all?
What is the best way to pass variables?
Thanks for any advice!
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=1mysite.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
mysite.com/template.php/1
$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
www.mysite.com/artist.php?id=1 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!