Skip to content

Instantly share code, notes, and snippets.

@jamband
Last active November 15, 2017 19:07
Show Gist options
  • Save jamband/1897904 to your computer and use it in GitHub Desktop.
Save jamband/1897904 to your computer and use it in GitHub Desktop.
Yii Framework & Twig: layouts/column1.twig
<div class="form">
{{ C.Html.form() }}
<p class="note">Fields with <span class="required">*</span> are required.</p>
{{ C.Html.errorSummary(model) }}
<div class="row">
{{ C.Html.activeLabel(model, 'userid') }}
{{ C.Html.activeTextField(model, 'userid') }}
{{ C.Html.error(model, 'userid') }}
</div>
<div class="row">
{{ C.Html.activeLabel(model, 'fuga') }}
{{ C.Html.activeTextField(model, 'fuga', {'size' : 60, 'maxlfugath' : 64}) }}
{{ C.Html.error(model, 'fuga') }}
</div>
<div class="row">
{{ C.Html.activeLabel(model, 'piyo') }}
{{ C.Html.activeTextField(model, 'piyo', {'size' : 60, 'maxlfugath' : 64}) }}
{{ C.Html.error(model, 'piyo') }}
</div>
<div class="row buttons">
{{ C.Html.submitButton(model.isNewRecord ? 'Create' : 'Save') }}
</div>
</div><!-- form -->
<div class="view">
<b>{{ data.getAttributeLabel('id')|e }}</b>
<a href="{{ this.createUrl('view', {'id' : data.id}) }}">{{ data.id|e }}</a>
<br />
<b>{{ data.getAttributeLabel('userid')|e }}</b>
{{ data.userid|e }}
<br />
<b>{{ data.getAttributeLabel('fuga')|e }}</b>
{{ data.fuga|e }}
<br />
<b>{{ data.getAttributeLabel('piyo')|e }}</b>
{{ data.piyo|e }}
<br />
</div>
<h1>Manage Hoges</h1>
<p>
You may optionally enter a comparison operator (<b>&lt;</b>, <b>&lt;=</b>, <b>&gt;</b>, <b>&gt;=</b>, <b>&lt;&gt;</b>
or <b>=</b>) at the beginning of each of your search values to specify how the comparison should be done.
</p>
<a href="{{ this.createUrl('#', {'class' : 'search-button'}) }}">Advanced Search</a>
<div class="search-form" style="display:none">
{{ this.renderPartial('_search', {'model' : model}) }}
</div><!-- search-form -->
{{ this.widget('zii.widgets.grid.CGridView', {
'id' : 'hoge-grid',
'dataProvider' : model.search(),
'filter' : model,
'columns' : [
'id',
'userid',
'fuga',
'piyo',
{'class' : 'CButtonColumn'},
],
}, true) }}
{{ this.beginContent('//layouts/main') }}
<div class="container">
<div id="content">
{{ content }}
</div><!-- content -->
</div>
{{ this.endContent() }}
{{ this.beginContent('//layouts/main') }}
<div class="container">
<div class="span-19">
<div id="content">
{{ content }}
</div><!-- content -->
</div>
<div class="span-5 last">
<div id="sidebar">
{{ this.widget('zii.widgets.CMenu', {
'items' : this.menu,
'htmlOptions' : {'class' : 'operations'},
}, true) }}
</div><!-- sidebar -->
</div>
</div>
{{ this.endContent() }}
<h1>Hoges</h1>
{{ this.widget('zii.widgets.CListView', {
'dataProvider' : dataProvider,
'itemView' : '_view',
}, true) }}
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="ja" lang="ja">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="language" content="ja" />
<!-- blueprint CSS framework -->
<link rel="stylesheet" type="text/css" href="{{ App.request.baseUrl }}/css/screen.css" media="screen, projection" />
<link rel="stylesheet" type="text/css" href="{{ App.request.baseUrl }}/css/print.css" media="print" />
<!--[if lt IE 8]>
<link rel="stylesheet" type="text/css" href="{{ App.request.baseUrl }}/css/ie.css" media="screen, projection" />
<![endif]-->
<link rel="stylesheet" type="text/css" href="{{ App.request.baseUrl }}/css/main.css" />
<link rel="stylesheet" type="text/css" href="{{ App.request.baseUrl }}/css/form.css" />
<title>{{ this.pageTitle|e }}</title>
</head>
<body>
<div class="container" id="page">
<div id="header">
<div id="logo">{{ App.name|e }}</div>
</div><!-- header -->
<div id="mainmenu">
{{ this.widget('zii.widgets.CMenu', {
'items' : [
{'label' : 'Home', 'url' : ['/site/index']},
{'label' : 'About', 'url' : ['/site/about']},
{'label' : 'Contact', 'url' : ['/site/contact']},
{'label' : 'Login', 'url' : ['/site/login'], 'visible' : App.user.isGuest},
{'label' : 'Logout ('~App.user.name~')', 'url' : ['/site/logout'], 'visible' : not App.user.isGuest}
]
}, true) }}
</div><!-- mainmenu -->
{% if this.breadcrumbs %}
{{ this.widget('zii.widgets.CBreadcrumbs', {
'links' : this.breadcrumbs,
}, true) }}
{% endif %}
{{ content }}
<div id="footer">
Copyright &copy; {{ now|date('Y') }} by My Company.<br/>
All Rights Reserved.<br/>
</div><!-- footer -->
</div><!-- page -->
</body>
</html>
<h1>View Hoge #{{ model.id }}</h1>
{{ this.widget('zii.widgets.CDetailView', {
'data' : model,
'attributes' : [
'id',
'userid',
'fuga',
'piyo',
],
}, true) }}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment