Home  ›  ClipBucket v2  ›  How-To's  ›  How to add new page in Clip bucket

How to add new page in Clip bucket

In the this How-to, we will learn how can we add a new page in Clip bucket script. First let’s see basic addition of new page.

Create php file

First you need to create a php file on root, where index.php is located. Name your php file on your page. For example, if you are making new page for categories, your file name will be ‘categories.php’.

Now open your newly created file and paste following.

<?php
define("THIS_PAGE","page_name");
require 'includes/config.inc.php';
subtitle('page_name');
template_files('page_name.html');
display_it(); ?>

Change ‘page_name’ with your original page name. If you go our above example, page_name will be ‘categories’. Let’s break down above code one by one.

define("THIS_PAGE","page_name");

This line sets the value of THIS_PAGE to name the of your page. This way you can check if your user is on this page or not.

require 'includes/config.inc.php';

This line enables us to use all php classes and functions written in Clipbucket.

subtitle('page_name');

This line sets the subtitle.

template_files('page_name.html');

This line put your template file, which we will create in a moment, in an array.

display_it();

This function is used to display your template file.

Adding HTML File

Our work in php file is done. Now all you have to is create HTML file. HTML file name should be same as provided in template_files() function. This file will be created in your template layout folder. Write some content in it for testing. To access your page, open following in your browser.

http://site.com/page_name.php

Making SEO URL

Now are going to make SEO URL for our new page. This requires adding a new line in your .htaccess file located in root folder. Open your .htaccess and add following line anywhere in it.

RewriteRule ^page_name      page_name.php [nc]

Now your page is accessible like this : http://site.com/page_name

This is asked by sixinco. Here is link to topic.


1 Star2 Stars3 Stars4 Stars5 Stars (4 votes, average: 5.00 out of 5)
Loading ... Loading ...
Help us improve the wiki Send Your Comments