| 
 | 
  daniel tygel - 2006-11-27 03:10:18  
Hi Seth, 
 
   Congratulations for the great class! 
 
   I would like to know how could I write HTML code to put explanations between some fields? I thought something like form->addElement('html','<p>this is a sentence</p>'); would work, but it doesn't exist. 
 
   So what's the correct way to do it? 
 
      Thanks a lot for any help there... 
 
            greetings from brasil, 
 
                daniel tygel 
  
  Seth Price - 2006-11-28 18:34:18 -  In reply to message 1 from daniel tygel 
Wouldn't it be more appropriate to put that HTML directly into your template? It is certainly possible to do this with an SForm element, but I question whether it's needed. 
  
  daniel tygel - 2006-11-29 03:26:49 -  In reply to message 2 from Seth Price 
Well, maybe I don't know sufficiently about templates handling.  
 
I thought that a template just says where and how the "display" command will be executed (design). But sometimes I want a comment between one field and other, or between two fieldsets (small instructions and explanations --> help ad hoc). Is that possible through templates? 
 
   daniel 
  
  Seth Price - 2006-11-29 04:57:42 -  In reply to message 3 from daniel tygel 
I'm not sure if I completely understand you, so we may be saying the same thing. 
 
I've tried to reduce the size of SForm by only including form functionality. A command like "$form->addElement('html','<p>this is a sentence</p>');" seems to me to be template functionality. 
 
For example, using the Smarty template engine my commands would look like this: 
<?php 
$form = new SForm(); 
 
//Construct form 
 
$tpl = new Smarty(); 
 
$rndr = new SForm_Renderer_Array(); 
$this->render($rndr); 
 
$arr = $rndr->fetch($form); 
 
$tpl->assign($arr); 
 
$tpl->assign('additionalText', '<p>this is a sentence</p>'); 
$tpl->assign('evenMoreText', '<p>this is another sentence</p>'); 
 
$tpl->display('myTemplate.xhtml'); 
?> 
 
Does this make sense? 
  
   |