slam4:php:phalcon:viewhelpers

Ceci est une ancienne révision du document !


View Helpers

La classe Phalcon\Tag fourni un ensemble de méthode facilitant l'écriture des vues, avec phtml ou avec volt.

Définition du doctype dans le contrôleur :

...
public function testAction(){
    $this->tag->setDoctype(\Phalcon\Tag::HTML401_STRICT);
    echo $this->view->render("test");
}

Utilisation du docType dans la vue :

<?php echo $this->tag->getDocType();

Résultat

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
	"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head></head>
...

<!-- for the default route -->
<?= $this->tag->linkTo("products/search", "Search") ?>

<!-- with CSS attributes -->
<?= $this->tag->linkTo(array('products/edit/10', 'Edit', 'class' => 'edit-btn')) ?>

<!-- for a named route -->
<?= $this->tag->linkTo(array(array('for' => 'show-product', 'title' => 123, 'name' => 'carrots'), 'Show')) ?>

  • slam4/php/phalcon/viewhelpers.1443736232.txt.gz
  • Dernière modification : il y a 6 ans
  • (modification externe)