Mar 6, 2012
How to add new pages
This question was posted today on the support forum so it’s a decent one to create a tutorial about it.
Hi, i want add page, like “About”, “Privacy Policy”
How to do it?
It’s a little complicated because W-script is not developed to support such functionality but not very hard to add new pages. Following this tutorial you will learn how to create new pages using PHP.
First, let’s assume we need to add a “About us” page. Let’s create a new PHP page called about.php and upload it to system/application/controllers. Now open that file in your editor and place the following content:
<?php
class About extends Controller {
function __construct () {
parent::Controller ();
}
function index () {
$right = get_right_side_content ();
$page = array
(
'content' => file_get_contents ( ROOTPATH . '/pages/about.txt' ),
'right' => $right,
'header_msg' => "About us"
);
$page = assign_global_variables ( $page, 'about_us' );
load_template ( $page, 'template', TRUE );
}
}
We’re almost ready to view our page. If you go to www.yourdomain.com/index.php?/about you will probably see a white page because we didn’t added the contents of our page yet. Go to the root level of your W-script installation (where index.php sits) and create a new directory there called pages. Inside this directory create a new .txt file called about.txt. Add your content inside that page and you should be able to view it’s contents by accessing the url. You can also add html in that text file so it’s flexible.
You can link to those pages by editing your footer template file: templates/default/html/footer.tpl

it’s impossible to registered because your captcha not working correctly.