View previous topic :: View next topic |
Author |
Message |
ihabzy Smarty Rookie
Joined: 27 Jul 2012 Posts: 9
|
Posted: Fri Jul 27, 2012 4:33 am Post subject: Managing subdirectories |
|
|
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 |
|
mohrt Administrator
Joined: 16 Apr 2003 Posts: 7368 Location: Lincoln Nebraska, USA
|
Posted: Fri Jul 27, 2012 2:43 pm Post subject: |
|
|
check your php error log anytime you get blank pages. |
|
Back to top |
|
ihabzy Smarty Rookie
Joined: 27 Jul 2012 Posts: 9
|
Posted: Fri Jul 27, 2012 10:10 pm Post subject: Error Log file |
|
|
I checked my PHP error log which found to be empty of errors |
|
Back to top |
|
ihabzy Smarty Rookie
Joined: 27 Jul 2012 Posts: 9
|
Posted: Fri Jul 27, 2012 10:26 pm Post subject: I checked again |
|
|
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 |
|
mohrt Administrator
Joined: 16 Apr 2003 Posts: 7368 Location: Lincoln Nebraska, USA
|
Posted: Sat Jul 28, 2012 12:20 am Post subject: |
|
|
so a template can't be loaded, try to test:
$smarty->testInstall(); |
|
Back to top |
|
ihabzy Smarty Rookie
Joined: 27 Jul 2012 Posts: 9
|
Posted: Sat Jul 28, 2012 12:27 am Post subject: |
|
|
Where should I have to put this code
Code: | $smarty->testInstall();
|
|
|
Back to top |
|
mohrt Administrator
Joined: 16 Apr 2003 Posts: 7368 Location: Lincoln Nebraska, USA
|
Posted: Sat Jul 28, 2012 1:54 am Post subject: |
|
|
right after you get smarty instantiated and dirs all setup. then run this test and exit. |
|
Back to top |
|
ihabzy Smarty Rookie
Joined: 27 Jul 2012 Posts: 9
|
Posted: Sat Jul 28, 2012 4:30 am Post subject: |
|
|
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 |
|
U.Tews Administrator
Joined: 22 Nov 2006 Posts: 5068 Location: Hamburg / Germany
|
Posted: Sat Jul 28, 2012 8:33 am Post subject: |
|
|
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 |
|
ihabzy Smarty Rookie
Joined: 27 Jul 2012 Posts: 9
|
Posted: Sat Jul 28, 2012 8:42 am Post subject: |
|
|
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 |
|
U.Tews Administrator
Joined: 22 Nov 2006 Posts: 5068 Location: Hamburg / Germany
|
Posted: Sat Jul 28, 2012 9:00 am Post subject: |
|
|
Add the './' or '../' to your $temdir variable and use in your header {$tmpdir}/css/style.css |
|
Back to top |
|
ihabzy Smarty Rookie
Joined: 27 Jul 2012 Posts: 9
|
Posted: Sat Jul 28, 2012 5:57 pm Post subject: |
|
|
I appreciate the long interval support. It helped me a lot
A big thank you |
|
Back to top |
|
|