I want to produce content for a theme based site in XML. I know I can serve XML to the Client via PHP and the Expat Library functions.
The issue I'm grappling with is that the most effecient method would be to write one template file and parse the various XML files as needed. The problem is that the SEs will only see the template file.
So what I'm looking for is a way to show links to the Search Engines that look like somefile.xml or somefile.html and when activated, run the template script and deliver the correct HTML.
I've heard this could be done via .htaccess and/or mod_rewrite. Before I go try to figure out exactly what I need to do, I'd like to know if:
1. what I want to do makes sense 2. may get me into trouble with the SEs 3. could be done differently/more efficiently
As always, your insight would be most appreciated!
you could also do the same effect as mod rewrite with your php. The url could be parsed and then used as vars for your queries.
php reads the url, cuts out $cat = cat1 and $sub = sub1 and then goes and finds all the info about it. I do this for menus and content a lot. The script figures out where it is in the directory structure and loads all pertinent info based on the url.
Similar to mod_rewrite and similar to get strings but all done with pure php and mysql.
when I can't or don't want to use mod_rewrite I often have to fake it. I create the directory structure, in the file I include the template/script. It then reads the url it was called from and does whatever it needs to do based on the url.
I don't know, maybe mod_rewrite is easier depending on the number of pages/links you need to have.
Just the way I have done things a lot of times, it seems to make perfect sense when it's in my head but I don't seem capable of explaining today. Think I will have to get more coffee.
I guess my answers to your questions were something like this 1. yes 2. no 3. differently - yes more efficiently - don't know, probably equal
The current game plan is to parse the XML using PHP's Expat Library and XSLT. That's why I needed to use mod_rewrite in .htaccess so that when a .html or .xml file of a certain type is requested, the script is initiated and serves up the correct HTML version.