feulf / raintpl3

The easiest Template Engine for PHP
https://feulf.github.io/raintpl
258 stars 57 forks source link

Question: How to get.. #125

Closed prisis closed 9 years ago

prisis commented 10 years ago

Hi, i did try to registry on the forum but didn't get any email to finish the registration, then her is my question.

What is the right syntax for something like that,

Tpl::registerTag( '({menu=".*?"})', '{menu="(.*?)(?:\|(.*?))(?:\|(.*?))(?:\|(.*?))"}', function( $params ){
        $categorie =        $params[1][0];
        $sorter =           $params[2][0];
        $hidden =           $params[3][0];
        $title_active =     $params[4][0];

        return \Menu::build($categorie,$sorter,$hidden,$title_active);
    });

if i try it like that, then the output is like

<?php 0"(0(0($menu="admin))); ?>
kargnas commented 10 years ago

What's your template code?

prisis commented 10 years ago

{$menu="admin|0|0|0"}

feulf commented 10 years ago

You're using the variable tag here {$menu="admin|0|0|0"} , that's why Rain parse this as a variable.

Don't use the dollar sign ($) and should work:

{menu="admin|0|0|0"}```

On Wed, Nov 20, 2013 at 5:17 AM, prisis <notifications@github.com> wrote:

> {$menu="admin|0|0|0"}
>
> —
> Reply to this email directly or view it on GitHub<https://github.com/rainphp/raintpl3/issues/125#issuecomment-28876347>
> .
>
kargnas commented 10 years ago

agree with @rainphp

Additional, you can check your expression in this site: http://regexr.com?379g8

prisis commented 10 years ago

nope, dont work... the output is then, like my Tag {menu="admin|0|0|0"} and didnt parse it

prisis commented 10 years ago

ps.: ~~Stupid question, but can i load the Tags with autoloder? if not than i now why they dont work... i will test it~~

Okey, i can't autoload tags... stupid

and big thx for that page and help ;)