Re: [SMARTY-DEV] Formsess developement: matching a variable in a string
| From: | messju mohr | Date: | Tue, 13 Jan 2004 16:44:59 +0000 |
| Subject: | Re: [SMARTY-DEV] Formsess developement: matching a variable in a string | ||
| References: | 1 | Groups: | php.smarty.dev |
| Request: | Send a blank email to php-smarty-dev+get-2036@lists.php.net to get a copy of this message | ||
On Tue, Jan 13, 2004 at 05:04:30PM +0100, Katana wrote:
> Hello guys,
>
> I'm still working in order to improve formsess, my forms generation &
> validation library for smarty.
>
> At the moment, I'm attempting to cleanup the mess I have when dealing
> with variables inside formsess tags.
>
> To summarize, all the tags look like this:
> <fs:input type="text" name="foo" />
> Of course, you are supposed to be able to use a smarty variable as the
> name. So I had to build a regexp in order to match smarty variables, but
> I'm realizing that it's quite stupid to reinvent the wheel, and it would
> be better to let smarty handle that.
>
> So, the actual question is: what method could I cleanly use in order to
> check if a string is a smarty variable, or a string containing a smarty
> variable with backticks ?
there is no method. if you have $compiler in your prefilter you could
use the $compiler->_var_regexp property. it's not a very clean way:
$_var_regexp is considered internal but it would work with 2.5 and
2.6. you have to ponder.
> Thanks in advance,
>
> Katana