Reference > view

A view usually displays the result of an action.

Let's say you have a controller called "shopping_cart" and an action called "checkout".

By default, alahup! will look for the corresponding view in "views/shopping_cart/checkout.tpl"

Views are rendered inside a main "layout" template which you can find in "views/layouts" folder. You can override the default "main.tpl" template with :

$this->layout = "anotherlayout.tpl";

Smarty functions you can call from a module's view

{link_to [controller="controllername" text="label" _var1=value1 _var2=value2...]}

Examples :

  • {link_to text="Go to checkout" class="st0">"checkout"}

    Displays a "Go to checkout" link which executes the "checkout" action in the current controller.

  • You can specify another controller :

    {link_to text="Go to checkout" class="st0">"checkout" controller="shopping_cart"}
  • If you omit "text", the link is named after the name of the action :

    {link_to class="st0">"next"}
  • You can pass a parameter in the link by prefixing it with an underscore :

    {link_to class="st0">"delete" _id=3}

    The link will be path/to/module?a=delete&id=3

{form}...{/form}

Inserts the opening and closing tags with the expected parameters that post the form to the current action. (see the tutorial for a detailed example).