Re: [PHPLIB-DEV] cvs commit - strict template variable names From: David Orr (orrd101 <email protected>)
Date: 04/10/00

This may be too restrictive for some users. I've been using template
variables names such as {search:name} with a colon, and other symbols. I'm
sure other people are using other names that aren't just alphanumeric or
underscores. Personally, I got around the javascript problem by making it
not consider code in brackets if contains carriage returns. Can we consider
doing that way, or some other compromise?

dave.

--- kk <phplib-dev <email protected>> wrote:
> From: kk
> Date: Mon Apr 10 12:07:19 2000
> Modified files:
> php-lib/CHANGES
> php-lib/php/template.inc
>
> Log message:
> Javascript in Templates is now no longer reported as
> an undefined variable. Change is experimental.
>
>
> Index: php-lib/CHANGES
> diff -u php-lib/CHANGES:1.169 php-lib/CHANGES:1.170
> --- php-lib/CHANGES:1.169 Wed Apr 5 15:49:01 2000
> +++ php-lib/CHANGES Mon Apr 10 12:06:46 2000
> @@ -1,7 +1,11 @@
> -$Id: CHANGES,v 1.169 2000/04/05 13:49:01 kir Exp $
> +$Id: CHANGES,v 1.170 2000/04/10 10:06:46 kk Exp $
>
> -05-Apr-2000 kir
> +10-Apr-2000 kk
> + - Stricter regex for variable names in Template: [A-Za-z0-9_]+
> + Otherwise Javascript is detected as variable and reported
> + as undefined variables. Please test this and report problems.
>
> +05-Apr-2000 kir
> - Ignore empty queries for db_oracle.inc and db_oci.inc. It is done
> to process calls from constructor without agruments - PHP4 fix.
>
> Index: php-lib/php/template.inc
> diff -u php-lib/php/template.inc:1.16 php-lib/php/template.inc:1.17
> --- php-lib/php/template.inc:1.16 Thu Mar 30 16:57:57 2000
> +++ php-lib/php/template.inc Mon Apr 10 12:06:47 2000
> @@ -5,7 +5,7 @@
> * (C) Copyright 1999 NetUSE GmbH
> * Kristian Koehntopp
> *
> - * $Id: template.inc,v 1.16 2000/03/30 14:57:57 kir Exp $
> + * $Id: template.inc,v 1.17 2000/04/10 10:06:47 kk Exp $
> *
> */
>
> @@ -271,7 +271,7 @@
> */
> function get_undefined($varname) {
> $str = $this->get_var($varname);
> - preg_match_all("/\\{([^}]+)\\}/", $str, $m);
> + preg_match_all("/\\{([a-zA-Z0-9_]+)\\}/", $str, $m);
> $m = $m[1];
> if (!is_array($m))
> return false;
> @@ -297,11 +297,11 @@
> break;
>
> case "remove":
> - $str = preg_replace("/\\{[^}]+\\}/", "", $str);
> + $str = preg_replace("/\\{[a-zA-Z0-9_]+\\}/", "", $str);
> break;
>
> case "comment":
> - $str = preg_replace("/\\{([^}]+)\\}/", "<!-- Template $varname:
> Variable \\1 undefined -->", $str);
> + $str = preg_replace("/\\{([a-zA-Z0-9_]+)\\}/", "<!-- Template
> $varname: Variable \\1 undefined -->", $str);
> break;
> }
>
>
>
> -
> PHPLIB Developers Mailing List. Send messages to
> <phplib-dev <email protected>>.
> To unsubscribe, send "unsubscribe" to <phplib-dev-request <email protected>>
> in
> the body, not the subject, of your message.
>

__________________________________________________
Do You Yahoo!?
Talk to your friends online with Yahoo! Messenger.
http://im.yahoo.com
-
PHPLIB Developers Mailing List. Send messages to <phplib-dev <email protected>>.
To unsubscribe, send "unsubscribe" to <phplib-dev-request <email protected>> in
the body, not the subject, of your message.