|
Posted by Lars Eighner on 09/23/07 14:04
In our last episode,
<1190554783.204395.89330@w3g2000hsg.googlegroups.com>,
the lovely and talented Kai Schlamp
broadcast on comp.lang.php:
> Hello!
> I am thinking of a way to define my own tags like <my_tag> or {my_tag}
> or something like that, and later substitute these with real html
> code.
> For example, lets say I have a code snippet:
> {content_title}The Title{/content_title}
> Before echoing it out, I would do the following substitution:
> {content_title} = <table class="title_table"><th><td>
> {/content_title} = </td></th></table>
Why do you want to convert it into nonsense? <th><td> is not only
invalid in every version of HTML but also makes no sense whatever.
Try learning HTML first.
> This is a very simple example. But in a big site with many of the same
> components, such a scheme would make sense to alter the page layout
> pretty quick.
It seems you are trying to invent XML.
> Are there some helper classes or functions, or perhaps a whole package
> already for such a task?
> Or should I simply create the content with my tags and then subsitute
> all my tags with the real html code via preg_repalce function before
> printing it out? If yes, are there any better performance options
> instead of using preg_replace?
The most important thing is to learn HTML. If you cannot make valid pages
without PHP, you cannot make valid pages with HTML.
--
Lars Eighner <http://larseighner.com/> <http://myspace.com/larseighner>
Countdown: 485 days to go.
What do you do when you're debranded?
[Back to original message]
|