/ Published in: PHP
                    
                                        
`article.phtml` looked up in `views/scripts` by default. \r\n\r\ncan use `$this->partial(\"blog/article.phtml\", array(...))` to look for it in the `views/scripts/blog` folder too
                
                            
                                Expand |
                                Embed | Plain Text
                            
                        
                        Copy this code and paste it in your HTML
// article.phtml
<article>
<header>
</header>
<?php echo $this->body; ?>
</article>
// view script
// basic usage with array
echo $this->partial("article.phtml", array(
"header" => "This is a single post ...",
"body" => '<p>rendered via <code>$this->partial()</code></p>')
);
// passing an object with public properties
$article = new stdClass();
$article->header = "This is a \$article->header";
$article->body = "This is the \$article->body ... ";
echo $this->partial("article.phtml", $article);
// basic usage of partialLoop() with array
echo $this->partialLoop("article.phtml", array(
array(
"header" => "This is a title",
"body" => '<p>This is the body. rendered 1st post rendered via <code>$this->partialLoop()</code></p>'),
array(
"header" => "This is a 2nd article",
"body" => "<p>This is the body</p><p>some more content</p>"),
array(
"header" => "Then the 3rd",
"body" => "<p>This is the body</p><p>yet more content</p>")
));
Comments
 Subscribe to comments
                    Subscribe to comments
                
                