473,385 Members | 1,919 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

code meaning in zend

pradeepjain
563 512MB
Expand|Select|Wrap|Line Numbers
  1.   $other->setDecorators(array(
  2.         'Description' ,
  3.         'Label' ,
  4.         array(
  5.             array('divLabel' => 'HtmlTag') ,
  6.             array('tag' => 'div' , 'class' => 'fieldItemLabel')
  7.         ) ,
  8.         array(
  9.             array('divInput' => 'HtmlTag') ,
  10.             array('tag' => 'div' ,
  11.                   'class' => 'fieldItemValue',
  12.                   'openOnly' => true,
  13.                   'placement' => Zend_Form_Decorator_Abstract::APPEND)
  14.         ),
  15.         'ViewHelper',
  16.         'Errors',
  17.         array(
  18.             array('divInputClose' => 'HtmlTag') ,
  19.             array('tag' => 'div' ,
  20.                   'closeOnly' => true,
  21.                   'placement' => Zend_Form_Decorator_Abstract::APPEND)
  22.         ),
  23.         array(
  24.             array('divField' => 'HtmlTag') ,
  25.             array('tag' => 'div' , 'class' => 'field80Pct')
  26.         ),
  27.         array(
  28.             array('divClear' => 'HtmlTag') ,
  29.             array('tag' => 'div' ,
  30.                   'class' => 'clear',
  31.                   'placement' => Zend_Form_Decorator_Abstract::APPEND)
  32.         ),
  33.     ));
after searching for many days i found this for the zend form decorators .
i am new to zend . can anyone just explain me how this code will be executed and how do i tell tht the class is for labels or for values or for whole element ! and what does it mean 'ViewHelper' and 'Errors' . where are the code for these 2 elements.

I dono if i can ask zend question here .since it was php ,asking here.If its not allowed please discard the question.
Mar 8 '10 #1
3 2168
zorgi
431 Expert 256MB
This is some sort of Zend_Form Decorator and probably single most difficult par of ZF to understand. Others can agree or disagree with that statement but that is my opinion. I love working with ZF but I absolutely hate Decorators.

Tutorial: Decorators with Zend_Form is the bets tutorial on the subject I know of. However I am not sure that approaching to ZF like this is good idea. I would recommend you first learn ZF basics and how to use Zend_Form with default Decorators. Tutorial: Getting Started with Zend Framework 1.10 is good place to start. Very basic example but very good to get you going.
Mar 8 '10 #2
pradeepjain
563 512MB
yeah i know.i have gone through both the tutorials!but the decorators i was not able to understand a bit .so tot to seek help !!
Mar 8 '10 #3
pradeepjain
563 512MB
i got a beautiful explained code on zend forum .i would like to share the code over here .

Expand|Select|Wrap|Line Numbers
  1. $yourElement->addDecorator('Label')
  2.         ->addDecorator('HtmlTag', array('tag'=>'div', 'class'=>'fieldItemLabel'))
  3.         ->addDecorator('HtmlTag', array('tag'=>'div', 'class'=>'fieldItemValue', 'openOnly'=>true, 'placement'=>'append'))
  4.         ->addDecorator('ViewHelper')
  5.         ->addDecorator('HtmlTag', array('tag'=>'div', 'closeOnly'=>true, 'placement'=>'append'))
  6.         ->addDecorator('HtmlTag', array('tag'=>'div', 'class'=>'field50Pct'));
with explanation


HtmlTag is rendered around all previously rendered content, unless you supply 'placement' option, like in that third and fifth call of addDecorator() method.

So, here's how that example from my previous post works:
1. label is rendered first
2. div tag with class "fieldItemLabel" wraps around everything that is previously rendered (in this case only label)
3. then we must only append opened next div tag with "fieldItemValue" CSS class
4. viewHelper decorator is rendered, which is the actual textfield element
5. then we close opened div from step 3
6. And finally, we wrap div with "field50Pct" CSS class around everything that is previously rendered.
Mar 9 '10 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Google alias | last post by:
My trial period for Zend studio has just ended, I've requested a personal licence, and got it. After I've entered and rebooted by computer I still get a popup saying "Licence expired!" everytime I...
13
by: AJ | last post by:
Hi all At the moment, I use Dreamweaver to develop the basics of my PHP stuff and then hand tune anything that I need to. I'm now looking at the next level and was wondering about Zend. What...
22
by: Harold Crump | last post by:
Greetings, I have a PHP/MySQL application that I am deploying at a client's. I am fairly certain that they will steal my source code and re-sell to other companies. I would like to somehow...
1
by: Toni | last post by:
I've tried to reinstall the zend environment and debugger on my new computer. I almost succeeded but when I try to debug or profile a webpage by clicking on the buttons on the toolbars I get the...
0
by: cantelow | last post by:
Greetings. I am getting some Arithmetic Exception exit signal messages in my apache logs and intermittent lost pages in a photopost app, dating from an upgrade to php 4.3.10, and I'm...
3
by: nntp | last post by:
What is ZEND. Why it has anything to do with programming PHP?
1
by: Xristos Nikolopoulos | last post by:
Hello, I have made an application that needs to upload files, the application is deployed in several folders, and each folder has its php files. The problem is, I have in the folder I want to...
2
by: hup | last post by:
One of my Linux (CentOS) server stop interpret php code any more. I did try to compile and installed other version of php, but it's still not working. # cat /tmp/phpinfo.php <? phpinfo() ?>...
4
by: Blueparty | last post by:
I am going to use Ioncube or Zend compiler/encoder to deploy PHP5 applications on servers at customers premisses. The factors that affect choice are: - reliability - easy of deployment at...
0
by: corretge | last post by:
Zend outsourced the news service to businesses. NET ...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.