Hi,
I'm using PHP (and very nice it is too!) and PostGresQL to run my website. All of the text content of the site is held in a couple of tables - page & para. My main PHP script takes a page ID, selects the paragraphs from the database in the correct order, and simply prints them to the output with appropriate tags.
However, I'd like to be able to simplify adding URLs - in particular, internal URLs.
At the moment, if I want to link between pages on the site, I have to make sure the page I'm linking too a) exists, and b) I know the page ID. Then, I can add the anchor tag direct to the text of the database. This is a bit messy, however, so I'd like to use another scheme. The one I was planning was to use a text analysis mechanism. So, for example, I'd have the following as a paragraph:
"For more information, see !%page=detail page,label=here%!."
The "!%" and "%!" can be considered as tag delimiters (like the less than/greater than symbols in HTML) - I've chosen those arbitrarily, and specifically because the sequences are unlikely to occur in real text.
Within the tag are two properties - page (which is the text name of the page, and may contain spaces but not punctuation), and label - which is what will go between the anchor tags in the finished page.
I can probably write something (unassisted) to do that processing. However, before I get cracking, are there any tips/tricks which people who have done similar things which I should know? Any traps/pitfalls to avoid?
Also, bearing in mind that this S&R will typically run from between 1-20 times per page, it needs to be PDQ, and entirely independant of the database...
Any/all help gratefully received!
Cheers,
Ade.