存档

‘技术’ 分类的存档

zend framework下的分页类

2010年1月28日

zf的分页类感觉还不是很好,于是找了个,记录一下。
阅读全文…

分类: 技术

Warning: Missing argument 2 for vmGet()

2010年1月27日

VirtueMart 1.1.3版本中,在Shipper list创建一个Shipper可能会报错。

Warning: Missing argument 2 for vmGet(), called in …/administrator/components/com_virtuemart/classes/ps_shipping.php on line 138 and defined in …/administrator/components/com_virtuemart/classes/request.class.php on line 26

解决的办法也很简单,
打开administrator/components/com_virtuemart/classes/ps_shipping.php,

$fields = array( ’shipping_carrier_name’ => vmGet($d["shipping_carrier_name"]),

替换为

$fields = array( ’shipping_carrier_name’ => vmGet($d, ’shipping_carrier_name’),

问题就解决了。

分类: 技术

zf中controller之间的action跳转执行

2010年1月23日

zf从一个controller的action跳转执行另一个controller action方法怎么操作?

$this->_forward($action, $controller = null, $module = null, array $params = null)

$this->_redirect(‘/controller/action’) 会向浏览器发出一个 “Location: /controller/action” 这样的 header ,致使浏览器再产生一个 URL 为 /controller/action 的 web 请求

$this->_forward() 却不是这样,它不依赖于浏览器,而是在执行完 actionA 后在继续执行一个 actionB,这完全是在服务端完成,中间没有跟浏览器打交道过程。

对用户来说,$this->_forward() 时他会在地址栏上看到一个/controller/actionA,虽然还做了个 /controller/actionB 的动作,这是一个请求,两个动作。而$this->_redirect() 则是两个个请求,两个动作。

显然两种不同的机制会造成两种不同的结果,$this->_redirect() 会将两个action 的结果分别显示在两个页面上,而 $this->_forward()  则会在一个页面同时输出两个动作的结果。

$this->_forward(‘index’,'zipcode’,”,’id’ => ‘10001′)
$this->_forward(‘index’,'zipcode’,'default’,'id’ => ‘10001′)

接收参数页面

$id = (int)$this->_request->getParam(‘id’, 0);

分类: 技术

zf读取在config.ini里的配置信息

2010年1月23日

zend framework如何读取在config.ini里的配置信息?

$this->registy_i = Zend_Registry::getInstance();
$db_a = $this->registy_i->dbarray;
$db = Zend_Db::factory(‘PDO_MYSQL’, $db_a);

分类: 技术

怎样使用Zend_View与Zend_Layout玩布局

2010年1月14日

当您打算要使用Zend_Layout时.您需要在你的入口文件(index.php)或是在你需要的控制器里先初始化Zend_Layout,让它和MVC一起使用.
其代码如下:

<?php
//startMvc里面的数组是你指定存放Layout文件的路径
Zend_Layout::startMvc(array(‘layoutPath’ => ROOT_DIR.’/app/views/layouts’));
?>

阅读全文…

分类: 技术