PHP Zend框架:部分

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了PHP Zend框架:部分相关的知识,希望对你有一定的参考价值。

// article.phtml
<article>
    <header>
        <h2><a href="javascript:;"><?php echo $this->header; ?></a></h2>
    </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>")
));

以上是关于PHP Zend框架:部分的主要内容,如果未能解决你的问题,请参考以下文章

Zend:PHP框架结束的开始?

PHP,Zend 框架错误被 Apache 消耗

查找有关 PHP、Zend 框架、JavaScript 安全问题的新闻的最佳来源是啥

Rackspace 云站点上的 PHP(Zend 框架)代码分析

Zend 框架与 PHP,更改类标签

Xampp 中的 Zend 框架