Manuel Pear

<SELECT NAME="name">

<SELECT NAME="name"> -- creates PHP variable and code for select lists

Synopsis

Usage (<SELECT NAME="name">)

Description

fills in the select values based on the form name and the tag name and adds code to check if the object variable matches them. If flexyignore is used, it is left alone. If static is set, the currently defined options will be used.

Exemple

Exemple 47-1. Using an element to change a template.

  1. <?php
  2. $form = new HTML_Template_Flexy();  
  3. $form->compile('some_file_name');  
  4.  
  5. // create an instance (note you dont have to specify any details..)
  6.  
  7. // select options
  8. $elements['test_select'] = new HTML_Template_Flexy_Element;  
  9. $elements['test_select']->setOptions( array(  
  10. '123' => 'a select option',  
  11. '1234' => 'another select option'  
  12. ));  
  13. $elements['test_select']->setValue('1234');  
  14.  
  15.  
  16. $form->outputObject(new StdClass, $elements);  
  17.  
  18. // in the example below, the new data you have added is to the existing attribut
  19. ?> 

Exemple 47-2. template example

<BODY>
  <FORM name="theform" flexy:ignoreonly="yes">
       <SELECT name="test_select"></SELECT>
   
    
  </FORM>
</BODY>

Exemple 47-3. compiled template

  1. <?php
  2. <BODY>  
  3. <FORM name="theform"> 
  4.  
  5.    <?php echo $this->elements['test_select']->toHtml();?>
  6.    
  7.    
  8. </FORM>
  9. </BOD
  10. ?> 

Exemple 47-4. output from the Template

<BODY>
  <FORM name="theform">
  
    
    <SELECT name="test_select">
      <option value="123">a selection option</option>
      <option value="1234" selected>another selection option</option>
      
    </SELECT>
    
  </FORM>
</BODY>

Remonter Remonter
Jamma Play - L'éditeur javascript - CSS - Tutoriaux PHP - Tutoriels PHP - Bretagne - php - Moto - Kit graphique