Welcome to the new Zamblek — and the new Sngine website - The new Zamblek website is live — and with it, a new home for Sngine, your licenses, support, and the entire ecosystem. Mehr erfahren
What’s New with v4.5! - Sngine v4.5 comes with a lot of new features Mehr erfahren
Sngine 4.5 Release! - Our Sngine team is so pleased to announce the release of Sngine 4.5! With some improvements, Mehr erfahren

How to create new pages in Sngine?

If you need to create a new page in Sngine and not just a simple static

Zamblek Zamblek 2 Min. Lesezeit
Inhaltsverzeichnis
How to create new pages in Sngine?

If you need to create a new page in Sngine and not just a simple static page that you can create from admin panel you will need 3 things:

1- PHP file of the page (Control)

2- Template file of the page (View)

3- Edit the .htaccess file


1- Create the PHP File

You will add new PHP file in the Sngine root directory like this:

and name it as you want like mypage.php then you will open the new file with any code editor like Notepad++ and add the following code:

<?php

// fetch bootloader
require('bootloader.php'); 

// user access (this code will make the login required)
/* you can remove it if you want */
user_access();

// page header 
page_header("My Page"); 

// page footer 
page_footer("mypage");

?>

There are 2 points

  • page_header() function accept 2 parameters the first one for the Title of the page in the address bar and the second one for the description of the page.
  • page_footer() function accept 1 parameter and it’s for the name of the template file you will use for your page.

2- Create the Template File

Sngine use Smarty template engine so the view is seprated from the code and you can learn more from http://www.smarty.net/

Now you you will create a new template file in the your theme folder so if you’re using the “default theme” you will add the new template in the following folder “content\themes\default\templates

Like this:

Note: the template name should be the same as you passed to the page_footer() function in the previous point and could be like this “mypage” “my_page”

Then you will add the following code

{include file='_head.tpl'}
{include file='_header.tpl'}

MY HTML IS HERE

{include file='_footer.tpl'}

And you can edit the HTML code as you want

3- Edit the htaccess

Now you can access your page directly from like that:

http://localhost/mypage.php

or you can add a new rule in the htaccess file so you can access the page like

http://localhost/mypage

or whatever you want.

Note: You Rewrite Rules must be before the profile rules as you can see in the screenshots

That’s it.

Happy Sngine 🙂

Buy Sngine or Extend your support: https://bit.ly/BuySngine