/** * Outputs a child template. Pass the template name (with extension) and * an associative array context of variables to be passed to the child. * * @param string The filename of the template, with extension, relative to AssertiveTemplate paths. * @param array The associative array of context the child template expects. * @return boolean Returns true on success. */ public static function draw($template, $context) { Buffer::to($body); $context = self::includeTemplate($template, $context); Buffer::end(); if (empty(self::$parentStack)) { echo $body; return true; } else { if (!isset($context['body'])) { $context['body'] = $body; } while ($parent = array_pop(self::$parentStack)) { try { $parentInputs = self::getInputs($parent, 'Layout'); } catch (RecessFrameworkException $e) { // if(RecessConf::$mode == RecessConf::DEVELOPMENT) { $trace = array_pop(self::$debugTraces); throw new RecessErrorException('Extended layout does not exist.', 0, 0, $trace[0]['file'], $trace[0]['line'], $trace[0]['args']); // } else { // throw $e; // } } $context = array_intersect_key($context, $parentInputs); $context = self::includeTemplate($parent, $context); } // if(RecessConf::$mode == RecessConf::DEVELOPMENT) { array_pop(self::$debugTraces); // } return true; } }
/** * Get the string representation of the ListBlock. * @see recess/recess/recess/framework/helpers/blocks/Block#__toString() */ function __toString() { try { Buffer::to($block); $this->draw(); Buffer::end(); return (string) $block; } catch (Exception $e) { die($e); } }
/** * Converts the PartBlock to a string based on inputs available. This will * only succeed if all required inputs have been satisfied by currying or * out-of-order assignment. If not, throws 'MissingRequiredDrawArgumentsException'. * * @see recess/recess/recess/framework/helpers/blocks/Block#__toString() */ public function __toString() { Buffer::to($returnsBlock); try { $this->draw(); } catch (MissingRequiredDrawArgumentsException $e) { die($e->getMessage()); } catch (Exception $e) { die($e->getMessage()); } Buffer::end(); return (string) $returnsBlock; }
function testStartOverwrite() { $original = 'This should still be the content.'; Buffer::to($block); echo $original; Buffer::end(); Buffer::to($block, Buffer::OVERWRITE); $expected = 'This will override.'; echo $expected; Buffer::end(); $this->assertType('Block', $block); $this->assertEquals($expected, (string) $block); }
/** * Get the string representation of the ListBlock. * @see recess/recess/recess/framework/helpers/blocks/Block#__toString() */ function __toString() { Buffer::to($block); $this->draw(); Buffer::end(); return (string) $block; }
<?php Layout::extend('layouts/apps'); $title = $app; Buffer::to($scripts); include 'newModelJQuery.php'; Buffer::end(); ?> <h1>New <strong>Model</strong> Helper</h1> <p>The purpose of this helper is to help speed the process of creating Recess Models. Please note <span class="highlight">this form is <strong>not</strong> child proof</span>!</p> <form class="modelForm" method="POST" action="<?php echo $controller->urlTo('generateModel', $app); ?> "> <h2>Step 1) Name Your Model</h2> <label for="modelName">Model Class Name:</label> <input id="modelName" type="text" name="modelName" /> <p>The name of your model must be a <span class="highlight">valid PHP class name</span>.</p> <hr /> <h2>Step 2) Pick Your Database Table</h2> <div class="span-19" id="tableOptions"> <div class="span-7"> <h3><input type="radio" name="tableExists" value="no" /> Table does not exist.</h3> <table style="display:none"> <tr> <td><label for="dataSource">Data Source:</label></td> <td><select name="dataSource"> <option value="Default">Default</option> <?php foreach ($sources as $sourceName => $source) { if ($sourceName != "Default") {