Categories > Your tips & tricks >

HTML Editor for TBS

The forum is closed. Please use Stack Overflow for submitting new questions. Use tags: tinybutstrong , opentbs
By: itKiwi
Date: 2006-11-21
Time: 15:29

HTML Editor for TBS

I am a beginner, and I am thinking about using a template system.  TBS seems to be simple, but good ;-)

Has anyone written a browser based editor which will find the TBS tags, and allow a non technical person to edit the webpage text, so avoiding the html tags and PHP language ?

Maybe this is a stupid question . . . If so, sorry.

Ciao
By: sheepy
Date: 2006-12-13
Time: 11:29

Re: HTML Editor for TBS

I haven't got any edtior, but I've got a regx that match tbs tags.  You can try how it works with following code:

$src = ''; // Code to find TBS tag in
$match = array();
$pattern = '~\['. // Opening tag (no leading space)
'([\w\.\s\$\#]+)'. // Tag
'((?:\s*;\s*(?:'. // param separator
'[^\];]+' . // param head
'(?:\'[^\']+\'|"[^"]+")?'. // Quoted param
')?)*'. // param group close
'\s*)\]~';

preg_match_all($pattern, $src, $match, PREG_OFFSET_CAPTURE + PREG_SET_ORDER);

foreach ($match as $tag) {
  echo array_shift(explode('.',$tag[1][0])).': '.$tag[1][0];
}

You don't need offset capture if you just want the tag.  Hope it will help.
By: itKiwi
Date: 2006-12-13
Time: 22:39

Re: HTML Editor for TBS

Thanks Sheepy.  Not exactly what I was looking for, but it's given me food for thought.
Merry Christmas !
By: sheepy
Date: 2006-12-14
Time: 10:51

Re: HTML Editor for TBS

Although TBS is much more designer-friendly, I think it is still something beyond what most users can master, espcially if they don't know html.

By the way, in order to allow my designer to work on it in dreamweaver, I let him use SSI include and src/href/url translation.  Not what you want, either, but it may help someday or someone else...

  $root = $config['path']['root'];
  $src = &$tbs->Source;
  // Translate Server Side Include into onload
  $src = preg_replace('/<!--#include\s+file\s*=\s*"?([^"\s\]]+)"?\s*-->/','[onload;file=$1]', $src);
  $tbs->MergeField('onload');
  // Convert ../inc/ and ../images/ for url("???"), src="???" and href="???"
  $src = preg_replace('~(?<=\W)(url\s*\(|src\s*=|href\s*=)\s*([\'"]?)../(inc/|images/)~',
                          '$1$2'.$root.'$3', $src);
By: itKiwi
Date: 2006-12-14
Time: 23:22

Re: HTML Editor for TBS

Thanks again.
By: Lifetimewebhost.com
Date: 2007-07-31
Time: 03:51

Re: HTML Editor for TBS

One thing that will help you is the xinhahere plugin for firefox.

https://addons.mozilla.org/firefox/addon/1449