- 浏览: 314434 次
- 性别:
- 来自: 广州
文章分类
- 全部博客 (107)
- Linux (16)
- Android (20)
- Network Pay (0)
- UI (8)
- Program Language (13)
- Java (8)
- Web Design (3)
- Database (5)
- SQLite (2)
- Vi/Vim (4)
- CSS (2)
- Network (3)
- PHP (20)
- Web Service (3)
- Troubleshooting (37)
- MySQL (3)
- System Management (3)
- Tools (27)
- Others (7)
- Eclipse (3)
- Framework (5)
- Python (1)
- JavaScript (1)
- Git (1)
- SCM (1)
- Video (0)
- Testing (0)
- Windows (1)
- http://service.oray.com/question/116.html (1)
- Python Troubleshooting (1)
最新评论
-
xwv:
能对你有启发和帮助就好
为什么Android的Adapter中,bindview被调用了多次 -
lipei.98:
哈哈 谢谢你的博客,解决了我一个头痛的问题。
为什么Android的Adapter中,bindview被调用了多次
【转】Using partial helpers in Zend Framework
在了解Zend Framework的Partial View Helper的过程中,Google了一篇相关的使用入门介绍,现转贴于下。文中提供的
源码下载,也上传了一份。
Using partial helpers in Zend Framework
ZendFrameworkQuickstart application
is demo guestbook with Zend library files included,
basic folder structure and some sample data for fetching and entering new.
It is already configured for usage and always updated with the latest release of Zend Framework.
The quickest way to setup Zend FrameworkQuickstart app for you is next 2 steps:
1.you need to download ZendFrameworkQuickstart application files
2.and setup virtual host pointing to public folder (e.g. /var/www/zend.quickstart/public/)
I used ZendFrameworkQuickstart application
for you so you can easier test the code I provided.
You just need to download and setup latest ZendFrameworkQuickstart
and replace default files with files I posted.
Here is the post:
In layout file (our case “layout.phtml” in application/layouts/scripts/)
we just need to call helper $this->partial and correct path to partial file
<div id="categories"> < ?php echo $this->partial('partials/categories.phtml', array('categories' => $this->data)); ?> </div>
with correct “keys” and “values” (our case ‘categories’ and $this->data).
Key (‘categories’) will stand for entity which is iterrated in our partial file in foreach loop
(our case “categories.phtml” in application/layouts/scripts/partials)
<ul> < ?php foreach($this->categories as $item) : ?> <li class="item"> <a href="<?php echo $this->url( array( "cat"=>$item['key'], "action"=>"index", "controller"=>"index", "module"=>"default" ))?>"> < ?php echo $item['value']; ?></a> </li> < ?php endforeach; ?> </ul>
and value ($this->data) must be defined in our controller class file as a view helper ($this->view->data),
I defined it in init() method so it will be set for all actions in IndexController.
public function init() { $this->view->data = array( array('key' => 'key_1', 'value' => 'category_1'), array('key' => 'key_2', 'value' => 'category_2'), array('key' => 'key_3', 'value' => 'category_3'), array('key' => 'key_4', 'value' => 'category_4'), ); }
I added demoAction so you can try to set different data set or you
can try to play with the code and create some data set from query
result.
Enjoy.
- application.rar (3.6 KB)
- 下载次数: 1
发表评论
-
Linux的文件权限和ACL的一些问题
2016-06-20 18:48 0关于Linux上的权限和ACL的一些问题: ... -
关于PHP的数据库连接池
2016-06-20 18:39 0关于PHP数据库连接池的一些资料: ... -
linux中find命令的mtime参数使用问题
2016-05-12 17:43 0在Linux中,使用find的参数mtime时的 ... -
关于MySQL的主机名解析问题
2016-05-12 12:03 0在实际中遇到MySQL错误日志中有类似这样的信息 ... -
PHP提供文件下载功能
2016-05-09 16:40 0关于PHP提供文件下载功能,基本的思路是相同, ... -
PHP使用OpenSSL进行RSA签名和验证的一些资料
2015-10-16 17:57 0在PHP使用OpenSSL来进行RSA签名和验 ... -
Vim中如何转换字母大小写
2015-10-16 15:25 0如何在Vim中对字母大小写进行转换? ... -
Linux Shell如何解析JSON格式数据
2015-09-24 15:27 0今天遇到一个,如果在Linux系统下,想要使用 ... -
MySQL中进行授权和取消授权的操作
2015-08-26 18:18 0一些关于MySQL中对用户授权和取消授权操作的资 ... -
SVN的反向合并
2015-08-21 13:58 0关于SVN的反向合并,查些资料帮助熟悉: ... -
MySQL中修改数据库名的方式
2015-08-20 16:13 0MySQL中如何修改数据库名,找找资料: ... -
通过网络服务获取本地的外网IP地址
2015-08-03 14:26 1497想要在Linux环境下,通过网络服务获取本地的 ... -
PHP的内存泄漏的检测方法资料
2015-07-14 15:53 0今天遇到PHP内存泄漏的问题,如何检查,下面是些 ... -
关于PHP Quality Assurance的资料
2015-07-07 11:20 01. "Quality Assuran ... -
关于Widget的资料
2015-07-03 14:48 0最近,对Widget进行一些了解: ... -
关于PHP的HHVM
2015-06-19 16:54 0关于PHP HHVM的资料: 1. ... -
PHP的日志服务log4php
2015-06-19 11:27 0关于Apache log4php ... -
使用XHProf做PHP性能剖析
2015-06-18 17:12 01. xhprof安装&&使用 ... -
YAML资料
2015-06-04 17:32 0YAML资料: 1. XML 问题 ... -
浏览器端结合ZendStudio调试PHP
2015-04-08 17:39 0需要使用XDebug和ZendStudio调试 ...
相关推荐
1. Introduction to Zend Framework 1.1. 概述 1.2. 安装 2. Zend_Acl 2.1. 简介 2.1.1. 关于资源(Resource) 2.1.2. 关于角色(Role) 2.1.3. 创建访问控制列表(ACL) 2.1.4. 注册角色(Role) 2.1.5. 定义访问...
基于Caputo-Fabrizio偏导数定义的边缘检测 Edge Detection using partial derivative Definition of Caputo-Fabrizio
Taking Partial Derivatives in Calculus.zip
索末菲大作,热学、电磁学等领域可用。出版于上世纪中期
复杂网络上的部分同步,敖滨,郑志刚,本文研究了规则网络加上少量非局域连接后所导致的部分同步,并从理论上给出了出现部分同步的条件和判据。
Lambda FIX II/Xho I Partial Fill-In Vector Kit
This book publishes a collection of original scientific research articles that address the state-of-art in using partial differential equations for image and signal processing. The topics covered in ...
Mining Textual Stream with Partial Labeled Instances Using Ensemble Framework
First Course in Partial Differential Equations - H. Weinberger (1965) WW.djv
偏微分方程数值求解 matlab 适合工科研究生博士生参考 也可作为工程人员参考
During the four years since the publication of the first edition, there has been substantial progress in the range of image processing applications covered by the PDE framework. The main goals of the...
Partial Discharge Localization in Power Transformers
英文局部放电资料、高电压、绝缘。介绍了局部放电的原理、种类和其对电气设备的危害。介绍了局部放电特征值提取的方法以及各种模式识别
This book publishes a collection of original scientific research articles that address the state-of-art in using partial differential equations for image and signal processing. The topics covered in ...
Active contour extraction method using partial shape constraint contour model Active Contour Extraction Method Using Partial Shape Constraint Contour Model Masahide Nishiura, Mayumi Yuasa, and ...
Numerical Partial Differential Equations in Finance Explained An Introduction to Computational Finance 英文epub 本资源转载自网络,如有侵权,请联系上传者或csdn删除 查看此书详细信息请在美国亚马逊官网...
using System; using System.IO; using System.Text.RegularExpressions; using System.Windows.Forms; using Microsoft.Win32; namespace MRU { public partial class FormMRU : Form { public FormMRU() { #...
Prerequisites suggested for using this book might include one semester of partial differential equations and some programming capability. This book will be a good reference text for students." -- ...
Isom H. Herron Rensselaer Polytechnic Institute Michael R. Foster The Ohio State University and Rensselaer Polytechnic Institute