Creating a new page in LiteCart is pretty simple. Basically just place a file in the pages folder and name it name.inc.php. The .inc in the extension prevents the file from being executed alone. The .php in the extension tells us this is PHP logic.
<?php document::$snippets['title'][] = 'Your head title here'; document::$snippets['description'] = 'Your meta description here'; ?> <h1>Hello World</h1> <p>Lorem ipsum dolor...</p>
The page is then accessed by http://www.yourdomain.com/mypage
The look or layout of pages is usually unique to each and every template. That's when separating HTML from the PHP logic comes in handy.
This is how simple it is to create a new page that can be uniquely styled within each template:
<?php document::$layout = 'default'; // Uses includes/templates/...catalog/layouts/default.inc.php for to wrap the content of the page document::$snippets['title'][] = 'Your head title here'; document::$snippets['description'] = 'Your meta description here'; $_mypage = new ent_view(); $_mypage->snippets = array( 'title' => 'Hello World', 'content' => 'Lorem ipsum dolor', ); echo $_mypage->stitch('pages/mypage'); // Uses includes/templates/...catalog/pages/mypage.inc.php for content
Here is an example of a template view file:
<main id="content"> <h1><?php echo $title; ?></h1> <p><?php echo $content; ?></p> </main>