[web] Making new xhtml tags?

Started by
14 comments, last by Rob Loach 19 years, 5 months ago
You can create an XML schema that looks like that, then act on it using SAX or transorm it to HTML with XSLT.
Free Mac Mini (I know, I'm a tool)
Advertisement
My CMS looks like this:


== Wow, a Heading ==

Do something insanely cool here - like an http://www.gamedev.net autolink, anyone?


How about a custom source box?


**How about bold?** \\Or Itallics?\\ \\**Or both?!"**\


You get the gist. I parse the content with regular expressions and generate XHTML from that. Not too tricky, really.
Nice, that is basically what I plan on doing. Eventually when my darn smary question gets answered on their forums. http://www.phpinsider.com/smarty-forum/viewtopic.php?t=3896
You could also go with BBCode and use square brackets:
[good]This is good text!  Don't you think![/good]


Aftermath has a nice way of formating text.
Rob Loach [Website] [Projects] [Contact]
I have it working. I call it block xml. ;)

Very easy todo, and it still works with my template system.
The function:
function parse_block($message) {  $preg = array(          '/(?<!\\\\)\<cms_block(?::\w+)?\>(.*?)\<\/cms_block(?::\w+)?\>/si'  			 => "\n<table>\n<tr>\n<td>\\1</td>\n</tr>\n</table><br />",		  '/(?<!\\\\)\<cms_block=(?::\w+)?(.*?)\>(.*?)\<\/cms_block(?::\w+)?\>/si'  => "\n<table>\n<tr>\n<th>\\1</th>\n</tr>\n<tr>\n<td>\\2</td>\n</tr>\n</table><br />",  );  $message = preg_replace(array_keys($preg), array_values($preg), $message);  return $message;}

and an example of what it looks like in the template:
<cms_block>This is a simple blockthere will be no title header,just a border</cms_block><!-- or for title/header --><cms_block=Title>block contents</cms_block>


That is all there is to it. BBcodes can also be made that way, but I am going to pull them from a database.
Quote:Original post by jumpjumpjump
...

Coolness.
Rob Loach [Website] [Projects] [Contact]

This topic is closed to new replies.

Advertisement