The look or layout of pages is usually unique to each and every template. That's when separating HTML from the PHP logic becomes handy.
This is how simple it is to create a new view that can be uniquely styled within each template:
<?php $_myview = new ent_view(); $_myview->snippets = [ 'title' => 'Hello World', 'content' => 'Lorem ipsum dolor', ]; echo $_mypage->stitch('subdirectory/myview'); ?>
Here is an example of a template view file:
<main id="content"> <h1><?php echo $title; ?></h1> <p><?php echo $content; ?></p> </main>
Any snippet can be retrieved by one of the following syntax, depending on when most suitable:
If a {snippet:parameter} is not defined it can be inserted later by a value from a parent view. LiteCart will clean up any remaining snippets after rendering the page.