Example Page
This is an Example page to show several features of Xframes2. Please have a look around.
Get Variables
- p => example
- q =>
Xframes2 Environment
$XF->Environment
You can assign get variables to any Xframes2 variable you want, and it's fail safe! And access them via the XF::Environment or via Smarty directly.
To see what it actually does click this.
PHP Part
/** * @author nanashiRei * * */ class PageExample extends XFrames { function __construct() { parent::__construct(); $this->caching = false; } public function DisplayPage() { $this->assignEnvironment('var1','othervar','whatever'); $this->display('examplePage.tpl'); } }
Template Part
<table> <thead> <tr> <th>Variable</th> <th>Value</th> </tr> </thead> <tbody> {foreach $XF->Environment as $var} <tr> <td>$XF->Environment['{$var@key}']</td> <td>{$XF->Environment[$var@key]}</td> </tr> <tr> <td>${$var@key}</td> <td>{${$var@key}}</td> </tr> {/foreach} </tbody> </table>
Result
| Variable | Value |
|---|---|
| $XF->Environment['var1'] | |
| $var1 | |
| $XF->Environment['othervar'] | |
| $othervar | |
| $XF->Environment['whatever'] | |
| $whatever |