Plugin Directory

Changeset 142857


Ignore:
Timestamp:
08/04/2009 10:25:31 PM (17 years ago)
Author:
godfreykfc
Message:

Fixed README AGAIN...

Location:
php-shortcode
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • php-shortcode/tags/1.3/README.txt

    r142855 r142857  
    1717= Usage =
    1818
    19 The plugin provides two pairs of shortcodes - `[php]code[/php]` and `[echo]code[/echo]`. these two pairs of shortcodes resembles the functionality of the `<?php code ?>` and `<?= code ?>` tags in a normally PHP script, respectively.
     19The plugin provides two pairs of shortcodes - `[php]code[/php]` and `[echo]code[/echo]`. these two pairs of shortcodes resembles the functionality of the `<?php code ?>` and `<?= code ?>` tags in a normal PHP script, respectively.
    2020
    2121
    2222For example:
     23
    2324    The answer to the <em>ultimate</em> math challenge, <strong>1+2</strong>, is...
    2425    [php]
     
    3132
    3233Will become:
     34
    3335    The answer to the <em>ultimate</em> math challenge, <strong>1+2</strong>, is...
    3436    3
     
    4345
    4446Although I said the shortcode pairs resembles a `<?php code ?>` tag pair, there is an important difference. The PHP code in the shortcodes are executed in a "throw-away" local namespace, instead of the global one. All variables defined in a `[php] code [/php]` block **cannot** be accessed outside the block. Therefore, this will not work:
     47
    4548    [php]
    4649      $a = 1;
     
    5255
    5356And neither would this:
     57
    5458    [php]
    5559      $my_array = array('apple','orange');
     
    6468
    6569To work around the first problem, you may use the `global` keyword:
     70
    6671    [php]
    6772      global $a, $b;
     
    7479
    7580And to work around the second problem, you may use "real" PHP closing tags within your `[php] code [/php]` block to switch between PHP and HTML mode:
     81
    7682    [php]
    7783      $my_array = array('apple','orange');
  • php-shortcode/trunk/README.txt

    r142855 r142857  
    1717= Usage =
    1818
    19 The plugin provides two pairs of shortcodes - `[php]code[/php]` and `[echo]code[/echo]`. these two pairs of shortcodes resembles the functionality of the `<?php code ?>` and `<?= code ?>` tags in a normally PHP script, respectively.
     19The plugin provides two pairs of shortcodes - `[php]code[/php]` and `[echo]code[/echo]`. these two pairs of shortcodes resembles the functionality of the `<?php code ?>` and `<?= code ?>` tags in a normal PHP script, respectively.
    2020
    2121
    2222For example:
     23
    2324    The answer to the <em>ultimate</em> math challenge, <strong>1+2</strong>, is...
    2425    [php]
     
    3132
    3233Will become:
     34
    3335    The answer to the <em>ultimate</em> math challenge, <strong>1+2</strong>, is...
    3436    3
     
    4345
    4446Although I said the shortcode pairs resembles a `<?php code ?>` tag pair, there is an important difference. The PHP code in the shortcodes are executed in a "throw-away" local namespace, instead of the global one. All variables defined in a `[php] code [/php]` block **cannot** be accessed outside the block. Therefore, this will not work:
     47
    4548    [php]
    4649      $a = 1;
     
    5255
    5356And neither would this:
     57
    5458    [php]
    5559      $my_array = array('apple','orange');
     
    6468
    6569To work around the first problem, you may use the `global` keyword:
     70
    6671    [php]
    6772      global $a, $b;
     
    7479
    7580And to work around the second problem, you may use "real" PHP closing tags within your `[php] code [/php]` block to switch between PHP and HTML mode:
     81
    7682    [php]
    7783      $my_array = array('apple','orange');
Note: See TracChangeset for help on using the changeset viewer.