Categories > TinyButStrong general >

Defining Template Path

The forum is closed. Please use Stack Overflow for submitting new questions. Use tags: tinybutstrong , opentbs
By: Maz
Date: 2008-01-10
Time: 16:04

Defining Template Path

In my code, I thought that I would set my template path thus:

$app_path = '/home/edited/public_html/';

if ((substr($app_path, -1) != '/') && (substr($app_path, -2) != '\\'))
{
    $app_path .= '/';
}

define("APP_PATH", $app_path);
define("INCLUDE_PATH", APP_PATH."includes/");
define("CLASS_PATH", APP_PATH."classes/");
define("TEMPLATE_PATH", APP_PATH."templates/");

and then call the templates thus:

    $objTBS->LoadTemplate(TEMPLATE_PATH.'home.html');
   
    //---------------------------------------------
    // Merge template data and display
    //---------------------------------------------

    $objTBS->Show();

However, I see that produces an error:

TinyButStrong Error with LoadTemplate() method : file 'TEMPLATE_PATHhome.html' is not found or not readable.

However, if I assign the path to a variable, thus:

$template_path = "/home/edited/public_html/templates/";

And then use:

$objTBS->LoadTemplate($template_path.'home.html');

Is this the expected and correct behaviour? Why can't I use the define?
By: Skrol29
Date: 2008-01-11
Time: 03:29

Re: Defining Template Path

Hi Maz,

Your code
$objTBS->LoadTemplate(TEMPLATE_PATH.'home.html');
should work correctly. This is about PHP syntax, it has nothing to do with TBS.

Could you double check this line ?