WebsiteBaker Support (2.8.x) > Templates, Menus & Design

How to preview template?

<< < (2/4) > >>

Ruud:
Maybe the combination is the best solution ;-)

Do your template development on a XAMPP/WAMP server (like most of us do). That is convenient and faster editing and previewing.
If you really want to test first on your live server, use the template switcher solution for a live check.

Ruud

Ale:
Thank you all for your input.

I discovered a another way. The file class.frontend.php defines which template to use. I just added this code:


--- Code: ---if(isset($_GET['template']))
    define('TEMPLATE', $_GET['template']);

--- End code ---

Now I can give the template's name on URL and test it this way.

Ruud:
The template switcher solution here on the forum is one step further.

In your root index.php, just before the line $wb->get_page_details();, you can put this code snippet:


--- Code: ---// Sticky Template switcher
if ($_GET['template']!="") {  // get the template to display from URL
   if(file_exists(WB_PATH.'/templates/'.$_GET['template'].'/index.php')) {
      define('TEMPLATE',$_GET['template']);
      $_SESSION['TEMPLATE']=TEMPLATE;
    }
} else {   // else get the template to display from Session Variable
    if(isset($_SESSION['TEMPLATE']) AND $_SESSION['TEMPLATE'] != '')
        define('TEMPLATE',$_SESSION['TEMPLATE']);
}
--- End code ---

It first tests to be sure it is an existing template.
Next it is stored in a session variable, so next page will stay in the same template.
It works great.

Ruud

weiry:
How do you specify the new template in the url?

Ruud:
using the name of the template (sub)directory. (Not the template name)

so for the round template, use template=round

Ruud

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version