Smarty Forum Index Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon.

Managing subdirectories

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Installation and Setup
View previous topic :: View next topic  
Author Message
ihabzy
Smarty Rookie


Joined: 27 Jul 2012
Posts: 9

PostPosted: Fri Jul 27, 2012 4:33 am    Post subject: Managing subdirectories Reply with quote

Hello,

I need to make certain file to be in a sub directory in the form "company/about.php"

The file about.php code is
Code:

<?php
require('includes/smarty/SmartyBC.class.php');
$smarty = new SmartyBC;
$smarty->assign("tmpdir", "templates");
include ('config.php');

$page = array(
         'title' => 'Al Debeiky Pharma | About Company',
         'description' => 'Leading integrated global Pharmaceutical Company engaged in the development, Manufacturing Marketing and sales of pharmaceutical, Herbal Brands, food supplements, cosmetics and Veterinary Products',
         'keywords' => 'DBK, Pharmaceutical, medical, Al Debeiky',
         'nav' => 'home',
      );
$smarty->assign("page", $page);

$smarty->display('header.tpl');
$smarty->display('about.tpl');
$smarty->display('footer.tpl');
?>


but when I go to company/about.php I got a blank page.

I am not very advanced in Smarty so, detailed instruction would be very helpful

Thanks a lor
Back to top
View user's profile Send private message
mohrt
Administrator


Joined: 16 Apr 2003
Posts: 7368
Location: Lincoln Nebraska, USA

PostPosted: Fri Jul 27, 2012 2:43 pm    Post subject: Reply with quote

check your php error log anytime you get blank pages.
Back to top
View user's profile Send private message Visit poster's website
ihabzy
Smarty Rookie


Joined: 27 Jul 2012
Posts: 9

PostPosted: Fri Jul 27, 2012 10:10 pm    Post subject: Error Log file Reply with quote

I checked my PHP error log which found to be empty of errors
Back to top
View user's profile Send private message
ihabzy
Smarty Rookie


Joined: 27 Jul 2012
Posts: 9

PostPosted: Fri Jul 27, 2012 10:26 pm    Post subject: I checked again Reply with quote

i got this error when I enable display errors in PHP

Code:

Fatal error: Uncaught exception 'SmartyException' with message 'Unable to load template file 'header.tpl'' in D:\wamp\www\dbk\includes\smarty\sysplugins\smarty_internal_templatebase.php on line 127
( ! ) SmartyException: Unable to load template file 'header.tpl' in D:\wamp\www\dbk\includes\smarty\sysplugins\smarty_internal_templatebase.php on line 127
Call Stack
#   Time   Memory   Function   Location
1   0.0004   327128   {main}( )   ..\about.php:0
2   0.0170   1667760   Smarty_Internal_TemplateBase->display( )   ..\about.php:15
3   0.0170   1667888   Smarty_Internal_TemplateBase->fetch( )   ..\smarty_internal_templatebase.php:374
Back to top
View user's profile Send private message
mohrt
Administrator


Joined: 16 Apr 2003
Posts: 7368
Location: Lincoln Nebraska, USA

PostPosted: Sat Jul 28, 2012 12:20 am    Post subject: Reply with quote

so a template can't be loaded, try to test:

$smarty->testInstall();
Back to top
View user's profile Send private message Visit poster's website
ihabzy
Smarty Rookie


Joined: 27 Jul 2012
Posts: 9

PostPosted: Sat Jul 28, 2012 12:27 am    Post subject: Reply with quote

Where should I have to put this code

Code:
$smarty->testInstall();
Back to top
View user's profile Send private message
mohrt
Administrator


Joined: 16 Apr 2003
Posts: 7368
Location: Lincoln Nebraska, USA

PostPosted: Sat Jul 28, 2012 1:54 am    Post subject: Reply with quote

right after you get smarty instantiated and dirs all setup. then run this test and exit.
Back to top
View user's profile Send private message Visit poster's website
ihabzy
Smarty Rookie


Joined: 27 Jul 2012
Posts: 9

PostPosted: Sat Jul 28, 2012 4:30 am    Post subject: Reply with quote

Here are the test result

Code:

Smarty Installation test...
Testing template directory...
FAILED: .\templates\ does not exist.
Testing compile directory...
D:\wamp\www\dbk\company\templates_c is OK.
Testing plugins directory...
D:\wamp\www\dbk\includes\smarty\plugins is OK.
Testing cache directory...
FAILED: .\cache\ does not exist.
Testing configs directory...
FAILED: .\configs\ does not exist.
Testing sysplugin files...
... OK
Testing plugin files...
... OK
Tests complete.
Back to top
View user's profile Send private message
U.Tews
Administrator


Joined: 22 Nov 2006
Posts: 5068
Location: Hamburg / Germany

PostPosted: Sat Jul 28, 2012 8:33 am    Post subject: Reply with quote

See in the test results. The template sourc directory was not set with the location of you template file.

Call
$smarty->setTemlateDir(....); with the path to your template files
Back to top
View user's profile Send private message
ihabzy
Smarty Rookie


Joined: 27 Jul 2012
Posts: 9

PostPosted: Sat Jul 28, 2012 8:42 am    Post subject: Reply with quote

Thanks for your reply
I added the code and it got fixed. The only problem is that I had to make a new copy of header.tpl which I made it header2.tpl to change the stylesheet directory from ./{$tmpdir}/css/style.css to ../{$tmpdir}/css/style.css

Is there any other way to correct the template directory to work the same for all files.
Back to top
View user's profile Send private message
U.Tews
Administrator


Joined: 22 Nov 2006
Posts: 5068
Location: Hamburg / Germany

PostPosted: Sat Jul 28, 2012 9:00 am    Post subject: Reply with quote

Add the './' or '../' to your $temdir variable and use in your header {$tmpdir}/css/style.css
Back to top
View user's profile Send private message
ihabzy
Smarty Rookie


Joined: 27 Jul 2012
Posts: 9

PostPosted: Sat Jul 28, 2012 5:57 pm    Post subject: Reply with quote

I appreciate the long interval support. It helped me a lot

A big thank you
Back to top
View user's profile Send private message
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Installation and Setup All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP