Views
Display a view
@import(Example.View.display)
Example of a View
The example docs have not been written yet
Make a view
@import(Usage.View.Packaged)
Add a view by hand
This is the exact code used by Package
to add your views, found in your view
directory.
@import(Usage.View.AddView)
Add Callable
@import(Usage.View.AddViewCallable)
Replace an existing view
By default, when a view is added with the same as an existing name, an error will be thrown. To change this, set the view conflict mode:
For your package
Pass 'views.conflict'=>'value'
to your package config where 'value'
is one of 'overwrite'
,
'ignore'
, or 'throw'
$site = new \Lia\Package($lia, __DIR__.'/code/', ['name'=>'MySite', 'views.conflict'=>'overwrite']);
//or
$site = new \Lia\Package($lia, __DIR__.'/code/');
$site->set('views.conflict', 'ignore');
//or
$site = new \Lia\Package($lia, __DIR__.'/code/');
$lia->set('package.MySite.views.conflict', 'throw');
You can also set views.conflict
in your config.json
file.
Directly
// 'throw' is the default. 'ignore' means the earlier view will be used
$lia->setViewConflictMode('overwrite');
$lia->addView('conflictingName', ....); // this will be the view used
Add paramater to views
@import(Usage.GlobalParams)