Stoppt die Vorratsdatenspeicherung! Jetzt klicken & handeln!Willst du auch bei der Aktion teilnehmen? Hier findest du alle relevanten Infos und Materialien:

Step 7: How to structure a single page

November 22nd, 2004, 14:56

After quite a bit of thinking of how to structure a single page in a CMS, I’ve came up with the following (written in my struct-file, so please forgive me the shortness/strangeness of this entry):

template-struct:
- per page/category (articles):
- page_template - contains page template:
- <!–#insert: [post name] –> - inserts post with given name
- <!–#insert-id: [post id] –> - inserts post with given id
- <!–#include: [/path/to/file.php] –> - includes given file from given path (html, php, etc)
- determination between category and page via enum('category','page') (eg. page_type)

We also would have to change the name ‘post’ - instead we would have to call it a ‘page’ or maybe even ‘page content’.

Next on my to-do-list is how to structure the URLs, so maybe instead of using 'category/subcategory/' (and 'category/subcategory/23-my-name-is-dumb.html') we should use ‘http://www.my-domain.com/my-category/’ using the trailing slash as a determiner for categories and a file extension like as shown in the following example as the one for pages: ‘http://www.my-domain.com/my-category/welcome.php’.

Then, there is still this problem about adding a query string to a URL - wouldnt the mod_rewrite engine do remove the query string, maybe mix it all up or just do the crapper? We also wouldnt want to have any query string to make the URLs proper crawl-able by any given search engine. To avoid all of that trouble, let’s think about it for a moment, and then use something like this: If the URL containts above mentioned file extension, anything after it get’s added to the internal big query string, as it should be. Following example should make my idea better understand-able: 'http://www.my-domain.com/hosting/plans.php/id/bizpro/' would be translated into 'http://www.my-domain/index.php?id=2&amp;category=3&amp;query_id=bizpro' - to avoid trouble with variables of the same name (doublets of a variable), we add a ‘query_’ to any variable passed to the script via the query string from ‘outside’.

Using these simple rules, we wouldnt have to quarrel with stuff like how to set up a proper URL structure, using semi-dynamic files instead of this only virtual available directory structure (thanks to the mod_rewrite engine). If we want to include stuff like a script part that displays data stored in a different table, like I do with my hosting plans (they’re generated on the fly), you simply would have to include them via above mentioned template structure. And if there was some query string you might want to add, you’re still on the safe side as search engines, web hosting lists like Webhostlist.de, etc. would still be able to proper crawl to or link to your website ;)

Codework, WordPress CMS | Comments Jump to the top of this page

Dear User:

Please note that this blog is not being updated anymore and only exists now for archival purposes.

Lieber Leser:

Dieses Weblog wird nicht mehr aktualisiert und existiert daher nur noch als Archiv.

Comments are closed.