bowphp / tintin Goto Github PK
View Code? Open in Web Editor NEWThe very small php Template
Home Page: https://bowphp.com/docs/tintin
License: MIT License
The very small php Template
Home Page: https://bowphp.com/docs/tintin
License: MIT License
The %json should parse the parsed variable to json
%json(['name' => 'tintin'])
The output should be
<?php echo json_encode(['name' => 'tintin']); ?>;
or
<?= json_encode(['name' => 'tintin']); ?>;
The templating definition and rendering output
%isset($is_service_side)
The content should be shown when $is_service_side variable is defined
%endisset
And the output should be:
<?php if (isset($is_service_side): ?>
The content should be shown when $is_service_side variable is defined
<?php endif; ?>
Cannot have an expression like the following
#for ($i=0; $i<count($names); $i++)
{{ $name }}
#endfor
Problem with #loop and #for loops.
The #string is parsed by tintin like comment syntax
<a href="#" class="btn btn-primary" data-target="#createMember" data-toggle="modal">Add</a>
Is compile to:
<a href="#" class="btn btn-primary" data-target="" data-toggle="modal">Add</a>
The verbatim tag marks sections as being raw text that should not be parsed.
For example, to put Twig syntax as an example into a template you can use this snippet:
#verbatim
<ul>
#loop($collection as $item)
<li>{{ item }}</li>
#endloop
</ul>
#endverbatim
And the output should be:
<ul>
#loop($collection as $item)
<li>{{ item }}</li>
#endloop
</ul>
The templating definition and rendering output
%includeif($age > 18, 'name')
or
%includewhen($age > 18, 'name')
And the output should be:
<?php if ($age > 18): ?>
<?php include('name'); ?>
<?php endif; ?>
The templating definition and rendering output
%lang('fr')
Contenu en français
%endlang
And the output should be:
<?php if (client_locale() == 'fr'): ?>
Contenu en français
<?php endif; ?>
Duplicate rendering output
N/A
macro
should allow you to define reusable chunks of content. It is similar to a function in a programming language. Here's an example:
%macro('field', $type, $name, $value)
<div class="field">
<input type="{{ $type }}" name="{{ $name }}" value="{{ $value }}"/>
</div>
%endmacro
Now field
is available to be called like a normal function:
{{ field('text', 'username', 'bow') }}
Add the new tag for #php #endphp
This tag should be used for executing the if isset
PHP code:
#isset($name)
{{ $name }}
#endisset
The output should be
if (isset($name)):
echo $name;
endif
The verbatim tag marks sections as being raw text that should not be parsed.
For example, to put Twig syntax as an example into a template you can use this snippet:
%verbatim
<ul>
%loop($collection as $item)
<li>{{ $item }}</li>
%endloop
</ul>
%endverbatim
And the output should be:
<ul>
%loop($collection as $item)
<li>{{ $item }}</li>
%endloop
</ul>
Bow plugin return blank page
Fail to make render when we update the template file
Since the Travis CI building is not friendly for the open source projects, I think it's time to migrate to the GitHub actions.
And the GitHub actions YAML file can also refer the build.yml.
N/A
The templating definition and rendering output
%guest('admin')
The content should be shown when the user is connected to the admin guard
%endguest
If the guard is not defined the template should be used as the default define a guard
%guest
The content should be shown when the user is connected to the admin guard
%endguest
And the output should be:
<?php if (!auth()->check()): ?>
The content should be shown when the user is connected to the admin guard
<?php endif; ?>
Or if the guard is defined as:
<?php if (!auth('admin')->check()): ?>
The content should be shown when the user is connected to the admin guard
<?php endif; ?>
The templating definition and rendering output
%env
%env('production')
The content should be shown on production env
%endenv
The
production
passed on argument could bedevelopment
And the output should be:
<?php if (app_mode() == 'production'): ?>
The content should be shown on production env
<?php endif; ?>
%production
%production
The content should be shown on production env
%endproduction
And the output should be:
<?php if (app_mode() == 'production'): ?>
The content should be shown on production env
<?php endif; ?>
The comment parse does not work on the multiline comment
{#
This is a comment
#}
The render skips the comment
macro
should allow you to define reusable chunks of content. It is similar to a function in a programming language. Here's an example:
#macro('field')
<div class="field">
<input type="{{ $type }}" name="{{ $name }}" value="{{ $value }}"/>
</div>
#endmacro
Now field
is available to be called like a normal function:
{{ field(['name' => 'username']) }}
{{ field(['name' => 'password', 'type' => 'password']) }}
The compilation of the code like:
#include('greeting', [
'name' => 'papac'
])
The compiler skip this instruction
Add the new tag for #php #endphp
This tag should be used for executing the raw PHP code:
#php
$user = pdo()->exec('SELECT * FROM users');
#endphp
The output should be
<?php
$user = pdo()->exec('SELECT * FROM users');
?>
When Tintin have load in my Bow configuration an error occure.
Undefined the Config class.
The compilation of the code like:
%include('greeting', [
'name' => 'papac'
])
The compiler skip this instruction
When i add comment on all line. Tintin display the comment in the browser.
{# <script type="text/javascript" src="/js/app.js"></script> #}
The templating definition and rendering output
%auth('admin')
The content should be shown when the user is connected to the admin guard
%endauth
If the guard is not defined the template should be used as the default define a guard
%guest('admin')
The content should be shown when the user is connected to the admin guard
%endguest
And the output should be:
<?php if (auth()->check()): ?>
The content should be shown when the user is connected to the admin guard
<?php endif; ?>
Or if the guard is defined as:
<?php if (auth('admin')->check()): ?>
The content should be shown when the user is connected to the admin guard
<?php endif; ?>
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.