User Tools

  • (Use the same account as the official website)

Site Tools


How To Create A View

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:

  $_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>

Any snippet can be retrieved by one of the following syntax, depending on when most suitable:

  • <?php echo $parameter; ?>
  • {snippet:parameter}

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.

how_to_create_a_view.txt · Last modified: 2023/01/16 16:24 by s22_tech