-
Notifications
You must be signed in to change notification settings - Fork 18
Working with ghost
SilverEngine edited this page Jan 12, 2018
·
6 revisions
Route
<a href="{{ route('home') }}"></a>
url
<a href="{{ url('/home') }}"></a>
lang
{{ lang('master.title') }}
or
{{ $data->title ?: 'empty' }}
dump and die
{{ dd($test) }}
not dump and die
{{ ndd($test) }}
if if else else
example
#if(true)
<p>is true</p>
#else
<p>is not true</p>
#endif
#foreach($item as $row)
{{ $row->id }}
#endforeach
#for($i=0; $i <= 10; $i++)
... your code here ...
#endfor
App\Views\welcome.ghost.php
{{ extends('layouts.master') }}
#set(content)
{{ include('includes.navbar') }}
Welcome to SilverEngine
<!-- {{ component('comments') }} -->
#end
App\Views\extends\master.ghost.tpl
<!DOCTYPE html>
<html lang="en">
<head>
<title>Bootstrap Example</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="styles.css">
</head>
<body>
#block(content)
</body>
</html>
App\Views...\sidebar.ghost.tpl
<div class="sidebar">
<ul>
<li><a href="#">Home</a></li>
</ul>
</div>
Components provide direct access to the model on dynamical way in controller use
View::make('...')->withComponent('name');
App\Views\components\comments.ghost.tpl
<div class="comments">
<ul>
#foreach($example as $data)
<li>{{ $data->title }}</li>
#endforeach
</ul>
</div>