LoginSignup
0
0

More than 5 years have passed since last update.

ebiでビューの作成

Last updated at Posted at 2015-12-03

シンプルなビューを表示します。
ビューは resources/templates ディレクトリに設置します。
ここでは2つの新しいビュー 「layout.html」「users.html」をこのディレクトリに作成します。

resources/templates/layout.html
<html>
    <body>
        <h1>ebiクイックスタート</h1>

        <rt:block name="content"></rt:block>
    </body>
</html>

resources/templates/users.html
<rt:extends href="layout.html" />

<rt:block name="content">
    Users!
</rt:block>

ebiはテンプレートエンジンも内蔵しています。
テンプレートの継承などパワフルな機能性と同時にifやloopなどの典型的な制御構文の使いやすい代用構文を提供しています。詳細はTemplateのドキュメントをご覧ください。

routes.php を開き(または作成し)ルートを定義します。

routes.php
<?php
include('ebi.phar');

\ebi\Flow::app([
    'users'=>['template'=>'users.html']
]);

Webブラウザーで routes.php/users へアクセスすればレスポンスとしてHTMLが表示されます。
これはtemplateが定義されているためです。

スクリーンショット 2015-12-03 23.19.52.png

参考:
https://github.com/tokushima/ebi
http://readouble.com/laravel/4/2/0/ja/quick.html

0
0
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
0
0