-
Notifications
You must be signed in to change notification settings - Fork 120
Template Variables
Jorge Castro edited this page Jan 14, 2021
·
10 revisions
Tag | Note | Example |
---|---|---|
{{$variable}} | It shows a variable or evaluates a function. The result is escaped (i.e. encoding special characters) | {{$country}} |
{!!$variable!!} | It shows a variable or evaluates a function. The result is not escaped. | {!!$country!!} |
{{-- text --}} | It is a comment (the content inside is not evaluated) | {{-- hi there --}} |
@{{$variable1}} | show the value of the content directly (not evaluated, useful for js) | @{{$country}} |
{{ $name or 'Default' }} | value or default | {{$country or "no country"}} |
It shows the current date of the compiled template
@compileStamp() // returns the current date and time as "Y-m-d H:i:s"
@compileStamp('d') // returns the current date AND TIME AS "d" (day)
It shows the name of the template
@viewname('compiled') // the full filename of the compiled file
@viewname('template') // the full filename of the template
@viewname('') // the name of the filename
It sets a variable inside the template. Technically, it could allow any PHP expression.
@set($variable=[value])
@set($variable=2000)
@set($variable='2222')
@set($variable=$othervar)
@set($variable=$aa['aaa'])
@set($variable=444+555)
@set($variable=somefn('hi'))
@set($variable)
is equals to @set($variable=$variable+1)
-
$variable
defines the variable to add. If not value is defined and it adds +1 to a variable. - value (option) define the value to use.
Copyright Jorge Castro Castillo
- BladeOne Manual
- Template tags (views)
- Custom control
- Methods of the class
- Injecting logic before the view (composer)
- Extending the class
- Using BladeOne with YAF Yet Another Framework
- Differences between Blade and BladeOne
- Comparision with Twig (May-2020)
- Changelog
- Changes between 2.x and 3.0 and TODO
- Code Protection (Sourceguardian and similars)