PhpTags/Differences

From Test foxway
Jump to: navigation, search

This page demonstrates the PhpTags extension

Bucket in the sand.svg You can play it in the namespace sandbox (editing is allowed for anonymous users there)


Differences and limitations

Usage the tag <phptag> Usage the parser function {{#phptag: ... }}
Wrong usage:
{{uc: <phptag>echo 'hello';</phptag> }}

Result: hello

PhpTags returns the "Strip marker" which here may not be processed correctly

Possible usage:
{{uc: {{#phptag: echo 'hello';}} }}

Result: HELLO

PhpTags returns string "hello" and {{uc: hello }} returns "HELLO"

Possible usage:
<phptag>$foo='hello'; echo "{{uc: $foo }}";</phptag>

Result: HELLO

The PhpTags sends to the parser the string {{uc: hello }} which will be processed and return the result HELLO

Wrong usage:
{{#phptag: $foo='hello'; echo "{{uc: $foo }}"; }}

Result: PhpTags Notice: Undefined variable: FOO in PhpTags/Differences on line 1

At first will be done {{uc: $foo }} and further results will be unpredictable

Possible usage:
<phptag>$foo='hello'; echo '{','{','#len:',$foo,'}','}';</phptag>

Result: 5

The PhpTags sends to the parser the string {{#len:hello}} which will be processed and return the result 5

Wrong usage:
{{#phptag: $foo='hello'; echo '{','{','#len:',$foo,'}','}'; }}

Result: {{#len:hello}}

PhpTags returns the string {{#len:hello}} and further results will be unpredictable

Wrong usage:
<phptag>echo '<table border=2>';</phptag>
<phptag>echo '<tr><td>hello</td></tr>';</phptag>
<phptag>echo '</table>';</phptag>

Result:

<tr><td>hello</td></tr> </table>

Each output PhpTags will be processed with separately, and the parser does not allow tags <tr><td> without <table>

Possible usage:
{{#phptag: echo '<table border=2>'; }}
{{#phptag: echo '<tr><td>hello</td></tr>'; }}
{{#phptag: echo '</table>'; }}

Result:

hello

The table will be displayed correctly