I recently got an email from Scot Jandly who asked me weather the different sections on my TXP-powered site are hard-coded into the HTML, or am I somehow hiding the article name in the URL.
While different sections on this site really just have a TXP tag to load a certain article, the URLs for different sections include just the section name, but not the article name.
So, how am I doing this?
Sort answer: using Apache directives.
I am basically using 5 templates to show different content. I have setup 5 different sections on my site, each section is using a different template. The section ‘colophon’ uses the template ‘colophon’, ‘elsewhere’ uses ‘elsewhere’ and so on…
The templates are each comprised of a single TXP tag. For example, the template ‘archive’ only writes: <txp:rss_suparchive showsubdate="1" section="article" dateformat="F Y" />
and the section ‘elsewhere’ only writes:
<txp:linklist form="Links" sort="linksort" />
Now, the trick to get all the sections look & feel the same, is to use Apache directives to auto-append and auto-prepend the header and footer files.
To achieve this, do the following:
php_value auto_prepend_file /header.php
php_value auto_append_file /footer.php
Now every time your sections will load, Apache will automatically “wrap” them with your header and footer files, producing your end result.
I recommend using the .html file extension to save server load if your pages are not dynamic pages.
PLEASE NOTE: Your webhost may not allow you to use these Apache directives, so be sure to check that out before hand.
Other entries near here:
« Danielle • Mail.app Identities »
You can also:
browse the archive or return to weblog
advertising, apache, apple, apps, bidmini, blog, blogish, browsers, bsd, business, code, copywriting, danielle, del.icio.us, ebay, elsewhere, emma, family, firefox, funny, gmail, google, gravatars, greetings, hlola, ipod, israel, opera, osx, personal, photoshop, php, politics, projects, rants, safari, textpattern, todo, tools, trackback, tricks, unix, video, web2.0, widgets, windows