loadTemplatefile() throwing me for a loop...

Problems with the Windows version of XAMPP, questions, comments, and anything related.

loadTemplatefile() throwing me for a loop...

Postby OrcaSoul » 05. September 2009 07:55

I am new to php, so really need some advice on a problem I am encountering!

I am using a script found in a book on PHP & MySQL, and am getting errors at one point:

The code is:
Code: Select all
 
function orcatoolsTemplate($pageBody, $pageTitle = P_TITLE)
   {
      $this->template = $this->HTML_Template_ITX(D_TEMPLATES);
      $this->loadTemplatefile(T_SKELETON, true, true);  //this is where the error occurs
      $this->setVariable("TITLE", $pageTitle);
      $this->addBlockFile("PAGE_BODY", "pageBody", "{$pageBody}");
   }
 


Where:
D_TEMPLATES = "/usr/local/apache2/htdocs/OrcaTools/templates/"
T_SKELETON = "orcatools.tpl"

The error I get:
Code: Select all
 
[PHP Error 20090904185159]WARNING on line 914 in C:\xampp\php\PEAR\HTML\Template\IT.php.
[PHP Error 20090904185159]Error: "fopen(/usr/local/apache2/htdocs/OrcaTools/templates/orcatools.tpl) [function.fopen]: failed to open stream: No such file or directory" (error #2).
[PHP Error 20090904185159]Client IP: ::1
 
UNHANDLED ERROR on line 915 in C:\xampp\php\PEAR\HTML\Template\IT.php.
[PHP Error 20090904185159]Error: "Non-static method PEAR::raiseError() should not be called statically, assuming $this from incompatible context" (error #2048).
[PHP Error 20090904185159]Client IP: ::1
 
UNHANDLED ERROR on line 993 in C:\xampp\php\PEAR\HTML\Template\IT.php.
[PHP Error 20090904185159]Error: "Non-static method PEAR::isError() should not be called statically, assuming $this from incompatible context" (error #2048).
[PHP Error 20090904185159]Client IP: ::1
 


This seems to indicate that /usr/local/apache2/htdocs/OrcaTools/templates/orcatools.tpl does not exist - and yet it IS in the folder OrcaTools/templates/...

I've tried specifically calling using the file name - both the short & long versions, I still get the same errors.

I did find where D_TEMPLATES is defined, this may be the problem:

Code: Select all
define("D_INSTALL_PATH", "/usr/local/apache2/htdocs");

// Paths -- for these, add trailing slash
define("D_WEB_PATH", "/OrcaTools/");
define("D_CART", D_WEB_PATH . "cart/");
define("D_CARTIMAGES", D_CART . "images/");
define("D_CUSTOMER", D_WEB_PATH . "customer/");
define("D_AUTH", D_WEB_PATH . "auth/");
define("D_ORDER", D_WEB_PATH . "order/");
define("D_SEARCH", D_WEB_PATH . "search/");
define("D_TEMPLATES", D_INSTALL_PATH . D_WEB_PATH . "templates/");


Obviously, the "/usr/local/apache2/htdocs" is not the correct path...

Since I want to code this so it will work on a real server, what should I use in this XAMPP setup?

What am I missing here?
OrcaSoul
 
Posts: 57
Joined: 24. August 2009 23:51

Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 141 guests