slam4:php:phalcon:viewhelpers

Différences

Ci-dessous, les différences entre deux révisions de la page.

Lien vers cette vue comparative

Les deux révisions précédentes Révision précédente
Prochaine révision
Révision précédente
slam4:php:phalcon:viewhelpers [2016/01/31 14:04] – [5- Modification des attributs des éléments] jcheronslam4:php:phalcon:viewhelpers [2019/08/31 14:21] (Version actuelle) – modification externe 127.0.0.1
Ligne 65: Ligne 65:
 {{end_form()}} {{end_form()}}
 </sxh> </sxh>
-===== -- Eléments de formulaires =====+===== -- Éléments de formulaires =====
  
 +==== phtml ====
 +
 +<sxh php>
 +<?php 
 +echo $this->tag->textField("username");
 +
 +echo $this->tag->textArea(array(
 +    "comment",
 +    "This is the content of the text-area",
 +    "cols" => "6",
 +    "rows" => 20
 +));
 +
 +echo $this->tag->passwordField(array(
 +    "password",
 +    "size" => 30
 +));
 +
 +echo $this->tag->hiddenField(array(
 +    "parent_id",
 +    "value"=> "5"
 +));
 +</sxh>
 +
 +==== volt ====
 +
 +<sxh html>
 +{{ text_field("username") }}
 +
 +{{ text_area("comment", "This is the content", "cols": "6", "rows": 20) }}
 +
 +{{ password_field("password", "size": 30) }}
 +
 +{{ hidden_field("parent_id", "value": "5") }}
 +</sxh>
 ===== -- Modification des valeurs des éléments ===== ===== -- Modification des valeurs des éléments =====
  
 Les éléments de formulaire possédant un attribut **value** peuvent être affectés à la création : Les éléments de formulaire possédant un attribut **value** peuvent être affectés à la création :
 +
 +==== phtml ====
  
 <sxh php> <sxh php>
Ligne 80: Ligne 117:
     "rows" => 20     "rows" => 20
 )) ?> )) ?>
 +</sxh>
 +
 +==== volt ====
 +
 +<sxh html>
 +{{ text_field("username","value":"SMITH") }}
 +
 +{{ text_area("comment", "This is the content", "cols": "6", "rows": 20) }}
 +</sxh>
 +
 +Il est également possible, préférable (pour l'architecture MVC) et inévitable pour certains tags (select par exemple) de faire cette affectation dans le contrôleur :
 +
 +
 +<sxh php;title:app/controllers/ProductsController.php>
 +class ProductsController extends Controller
 +{
 +    public function indexAction()
 +    {
 +        $this->tag->setDefault("username", "SMITH");
 +    }
 +}
 </sxh> </sxh>
 ===== -- Contenus statiques ===== ===== -- Contenus statiques =====
  • slam4/php/phalcon/viewhelpers.1454245448.txt.gz
  • Dernière modification : il y a 6 ans
  • (modification externe)