I am thinking in theory include() the file in to a "wrapper" php file
that can then do as Marco says evaluate or do a series of
str_replaces?

[quote from previous emails]

I'm sure there are. For example you can convert the string using
htmlspecialchars, and then convert only allowed tags back:

$text = htmlspecialchars($_POST['text']);

$replace_to = array('<b>', '</b>');

$replace_from = array();
foreach($replace_to as $tag) {
  $replace_from[] = htmlspecialchars($tag);
}

$text = str_replace($replace_from, $replace_to, $text);


Or you can install pear in your account, just unpack the archive and set
include_path.

====
 Matthew Fonda  to GH, php-general 
  More options  Sep 29 

Typically people use BBCode to do this.
This mean the user will enter something like
[b]this is bold[/b] or [i]italic[/u] and the BBCode will be parsed and
transformed into HTML when the page is displayed. There are many parsers
already written to do this, or you could make your own, or use PEAR:
http://pear.php.net/package/HTML_BBCodeParser




[/quote]


On Tue, 19 Oct 2004 22:09:31 +0200, Marco Bambini <[EMAIL PROTECTED]> wrote:
> 
> On 19/ott/04, at 20:34, Greg Donald wrote:
> 
> > On Tue, 19 Oct 2004 20:13:23 +0200, Marco Bambini
> > <[EMAIL PROTECTED]> wrote:
> >> I need to write a PHP extension or a PHP template system (this is the
> >> question) to parse some commands enclosed in square brackets inside
> >> web
> >> pages. Please note that the commands are in the form [command1] and
> >> not
> >> <?php [command1] ?>.
> >> I want use PHP because these commands needs to be remapped with a "web
> >> oriented" language.
> >>
> >> Is it technically possible to remap these square brackets tags to php?
> >> And if yes, what is the best way? A custom template system or a C PHP
> >> extension?
> >
> > Why not just write PHP code normally and use eval() to parse it out?
> 
> I can't alter the "code". I need PHP to execute these commands but I
> can't write PHP code inside that pages.
> 
> Any help?
> 
> Thanks,
> Marco Bambini
> 
> 
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
>

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to