Skip to content

Instantly share code, notes, and snippets.

@hunk
Created May 13, 2009 18:39
Show Gist options
  • Save hunk/111197 to your computer and use it in GitHub Desktop.
Save hunk/111197 to your computer and use it in GitHub Desktop.
<?php
//strings:
//in main.php
Breeze::set_var('name', 'Edgar');
//in template (default.php)
{name} --> Edgar
//numbers:
//in main.php
Breeze::set_var('age', 26);
//in template (default.php)
{age} --> 26
//objects:
//in main.php
$obj = new stdClass;
$obj->students = Array('muse' =>'Kalle', 'Ross', 'Felipe');
Breeze::set_var('friends', $obj);
//in templte (default.php)
{friends->students[muse]} --> Kelle
{friends->students[0]} --> Ross
//or We can add an object of WP ;)
//in main.php
$my_last_published = new WP_Query('showposts=2');
while ($my_last_published->have_posts()):
$my_last_published->the_post();
Breeze::set_var('wp'.$i, $my_last_published); $i++;
endwhile;
//in template (default.php)
{wp0->query_vars[showposts]} --> 2
{wp0->post->[post_content]} --> the content of the post
//arrays:
//in main.php
$me_array = array("hunk"=> array("work" => "freshout","foo"=> array("foo2"=>array("foo3"=>"bar3","foo4"=>"bar4"))),"more"=>"this is one string");
Breeze::set_var('me', $me_array);
//in template (default.php)
{me[more]} ---> this is one string
{me[hunk][foo][foo2][foo4]} --> bar4
{me[hunk][work]} --> freshout
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment