PDA

View Full Version : How: PHP script outputs multiple files?



z01d
02-02-2004, 09:52 PM
I creating a simple MYSQL-driven site where a script outputs meta tags, keywords, and main content from a database. The pages look exactly alike, and I am using a template in the form of include files.

My problem: I would like the script to show the useragent different filenames depnding on the requested link on the template. This is opposed to running the same script with different variables. The obvious approach is to create a different script for each page, but since the scripts are exactly the same (except for the MYSQL query), I was wondering if there could be a shortcut. Perhaps sending some Apache header variables? Is such a thing at all possible?

I'll be clear about my intent: I am planning to link every page to my main site, to improve it SERP. This way i will have 20 or so links pointing to my main site, rather than an all-in-one page.

Your ideas are much appreciated!

z01d

bob_99
02-11-2004, 01:16 PM
I'm not completely clear on what you are trying to accomplish but I'll take a shot at answering ....

I think you want to detect the $HTTP_USER_AGENT variable & then use a switch statement to write the filenames.

If this doesn't cover it maybe you can post more information.

Bob


I creating a simple MYSQL-driven site where a script outputs meta tags, keywords, and main content from a database. The pages look exactly alike, and I am using a template in the form of include files.

My problem: I would like the script to show the useragent different filenames depnding on the requested link on the template. This is opposed to running the same script with different variables. The obvious approach is to create a different script for each page, but since the scripts are exactly the same (except for the MYSQL query), I was wondering if there could be a shortcut. Perhaps sending some Apache header variables? Is such a thing at all possible?

I'll be clear about my intent: I am planning to link every page to my main site, to improve it SERP. This way i will have 20 or so links pointing to my main site, rather than an all-in-one page.

Your ideas are much appreciated!

z01d

z01d
02-11-2004, 01:28 PM
I found the name of the problem, its "dynamic pages indexing". From my reading I don't think that php has the means to achive this.:(

bob_99
02-11-2004, 02:07 PM
PHP is pretty amazing , I wouldn't give up that easily.

You mentioned the user agent in your first post. Are you trying to sniff search engine spiders & feed them different pages than a human visitor gets?

If you are trying to make dynamic URLs easy for the search engine spiders to index, see:

Make URLs search engine friendly (http://www.searchenginepromotionhelp.com/m/articles/search-engine-optimization/dynamic-content-promotion.php)

If you are trying to create index pages with links to your individual pages, you can do that with a foreach loop that goes through each record.

I hope this helps, I'm still not sure I understand what you are trying to do.

Bob


I found the name of the problem, its "dynamic pages indexing". From my reading I don't think that php has the means to achive this.:(

z01d
02-12-2004, 07:09 PM
Thank you Bob.
*burried reading*
I'm wondering if I can do the Apache tweaking on virtual host...hm