Welcome, Guest. Register Now!
   
Mark Forums Read Mark Forums Read Mark Forums Read


Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 07-08-2008, 08:59 AM
Junior Member
 
Join Date: Jul 2008
Posts: 2
Default [ask] Working with Smarty

Hi all,
Today I decide to learn ZF because it meets most of my needs.
But still, I can't leave my previous coding behavior using Smarty.
I plan to use Smarty as the View component.
I also want to make my application themable, easy to redesign.
In this case, where should I put my .tpl files? Do I have to put it in View directory (replace the .phtml files)?

Thanks b4,

Ricky
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 07-09-2008, 05:58 AM
Junior Member
 
Join Date: Jul 2008
Location: Ahmedabad
Posts: 8
Default

Yes rick, You can put tpl files in view folder.

I also want to know that while constructing form element in default template we can assign function for server validation.
e.g.

PHP Code:
$artist = new Zend_Form_Element_Text('artist');
        
$artist->setLabel('Artist')
                 ->
setRequired(true)
               ->
setDescription('Note: Description goes here!!!')
               ->
addFilter('StripTags')
               ->
setAttrib('onBlur''javascript: isUserExist();')
               ->
addFilter('StringTrim')
               ->
addValidator('NotEmpty');

$gender = new Zend_Form_Element_Select('gender');
        
$gender->setLabel('gender')
              ->
setMultiOptions(array('0'=>'Select','male'=>'Male''female'=>'Female'))
              ->
setRequired(true)->addValidator('NotEmpty'true);

$this->addElements(array($artist$gender)); 
While giving above code $form->isValid($formData) will handle server validation itself.

How could we handle server validation using smarty? Shall we put any custom isValid function or we can handle by using helper class.

{$this->formSelect("gender",$this->album.gender,null,$this->gender)}
This is the smarty code to put select option on form. Could we include any JS function with this function?

Thanks in advance.
__________________
Amit Shah
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT. The time now is 04:01 PM.