Views

Display Views

echo $lia->view('theme'); // theme is a view name  

View Directory

Sample view directory:

view/  
  - theme.js  
  - theme.css  
  - theme.php  
  - theme/autowire.js  
  - theme/Header.css  
  - theme/Header.php  
  • Two views exist here: theme and theme/Header.
  • when theme is shown, every css & js file will be included.
    • includes theme/Header.css... but this is a design failure & in the future that won't happen, since theme/Header is a view as well
  • when theme/Header is shown, theme/Header.css is included

Override a view by ordering app addition

In this example, $mySite's theme view will be used instead of $starter's, since $mySite was setup later.

$liaison = new \Liaison();  
$liaison->set('views.conflict', 'overwrite');  
$starter = new \Lia\Package($liaison, $starterDir);  
//$starter contains a view named 'theme'  
$mySite = new \Lia\Package($liaison, $mySiteDir);  
// $mySite also contains a view named 'theme'  

Override a view explicitly

$lia->setViewConflictMode('overwrite');  
//or  
// $lia->api('lia.view','ConflictMode', 'overwrite');  
$lia->addView('\\Lia\\Obj\\View', $viewDir, $viewName);