LoginSignup
4
4

More than 5 years have passed since last update.

voltテンプレートを使ってみる

Posted at

タイトルを表示する

view側
{{ get_title()}}
controller側
use Phalcon\Mvc\Controller,
    Phalcon\Tag;//忘れずに記述。


class IndexController extends ControllerBase
{
    function initialize()
    {
    Tag::setTitle('hoge');//タイトルを指定します。
    parent::initialize();
    }

    public function indexAction()
    {
    }

CSS,js読み込み

css読み込み
{{ stylesheet_link('cssのパス') }}
js読み込み
{{ javascript_include('jsのパス') }}

foreach文

{% for follow in follows %}
<div>{{ follow }}</div>
{% endfor %}

複数のviewに分割して読み込む

//partialを使用する
<div class="hoge">
    {{ partial("cook/chicken") }}
</div>

<div class="hoge">
    {{ partial("cook/beef") }}
</div>
4
4
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
4