How To Create A Page

Cím

No changes

Permalink

No changes

Tartalom

OldNew
1# How To Create A New Page1# How To Create A New Page
22
3Creating a new page in LiteCart is pretty simple. Basically just place a3Creating 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.
4file in the pages folder and name it name.inc.php. The .inc in the4
5extension prevents the file from being executed alone. The .php in the5```php pages/mypage.inc.php
6extension tells us this is PHP logic.6<?php
77 document::$snippets['title'][] = 'Your head title here';
8```php pages/mypage.inc.php8 document::$snippets['description'] = 'Your meta description here';
99?>
10Hello World10<h1>Hello World</h1>
1111<p>Lorem ipsum dolor...</p>
12Lorem ipsum dolor...12```
13```13
1414The page is then accessed by http://www.yourdomain.com/mypage
15The page is then accessed by 15
1616## How To Create A New Page Using A View
17# How To Create A New Page Using A View17
1818The 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.
19The look or layout of pages is usually unique to each and every19
20template. That's when separating HTML from the PHP logic comes in20This is how simple it is to create a new page that can be uniquely styled within each template:
21handy.21
2222```php pages/mypage.inc.php
23This is how simple it is to create a new page that can be uniquely23<?php
24styled within each template:24
2525 document::$layout = 'default'; // Uses includes/templates/...catalog/layouts/default.inc.php to wrap the content of the page
26```php pages/mypage.inc.php26
2727 document::$snippets['title'][] = 'Your head title here';
28 28 document::$snippets['description'] = 'Your meta description here';
2929
30```30 $_mypage = new ent_view();
3131
32# See Also32 $_mypage->snippets = [
3333 'title' => 'Hello World',
34[How To Create A View](how_to_create_a_view)34 'content' => 'Lorem ipsum dolor',
35 ];
36
37 echo $_mypage->stitch('pages/mypage'); // Uses includes/templates/...catalog/pages/mypage.inc.php for content
38```
39
40Here is an example of a template view file:
41
42```php includes/templates/mytemplate.catalog/pages/mypage.inc.php
43<main id="content">
44 <h1><?php echo $title; ?></h1>
45 <p><?php echo $content; ?></p>
46</main>
47```
48
49## See Also
50
51* [How To Create A View](how_to_create_a_view)

Edited by tim on 28 dec. 2023 at 06:12