|
Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon. |
|
View previous topic :: View next topic |
Author |
Message |
Ligustri Smarty n00b
Joined: 10 Jun 2018 Posts: 3
|
Posted: Sun Jun 10, 2018 11:12 am Post subject: Something wrong with the installation |
|
|
I've been trying to install with these instructions:
https://www.smarty.net/docs/en/installing.smarty.basic.tpl
I've configured the php.ini file to include the right path. And this script worked in /var/www/html/try_smarty/ -folder:
Code: | <?php
require_once('Smarty.class.php');
$smarty = new Smarty();
$smarty->testInstall();
?>
|
Then I made all needed access rights to folders and everything seemed to be all right.
And url was:http://localhost/try_smarty/
But in this point:
Example 2.9. Editing /web/www.example.com/docs/guestbook/index.php
I did the folders mentioned above: docs, questbook and the index.php with this script:
Code: | <?php
require_once(SMARTY_DIR . 'Smarty.class.php');
$smarty = new Smarty();
$smarty->setTemplateDir('/var/www/html/try_smarty/templates/');
$smarty->setCompileDir('/var/www/html/try_smarty/templates_c/');
$smarty->setConfigDir('/var/www/html/try_smarty/configs/');
$smarty->setCacheDir('/var/www/html/try_smarty/cache/');
$smarty->assign('name','Ned');
//** un-comment the following line to show the debug console
$smarty->debugging = true;
$smarty->display('index.tpl');
?> |
of course I changed the paths as they are in my linux-pc
but the browser gives the error(url:http://localhost/docs/try_smarty/):
This page isn’t working
localhost is currently unable to handle this request.
HTTP ERROR 500
because I had configured the php.ini I put these lines into comments, but it didn't help:
Code: | /*
$smarty->setTemplateDir('/var/www/html/try_smarty/templates/');
$smarty->setCompileDir('/var/www/html/try_smarty/templates_c/');
$smarty->setConfigDir('/var/www/html/try_smarty/configs/');
$smarty->setCacheDir('/var/www/html/try_smarty/cache/');
*/ |
What went wrong? How the folders should be? |
|
Back to top |
|
bsmither Smarty Elite
Joined: 20 Dec 2011 Posts: 322 Location: West Coast
|
Posted: Sun Jun 10, 2018 2:47 pm Post subject: |
|
|
Is the PHP constant SMARTY_DIR defined anywhere? |
|
Back to top |
|
AnrDaemon Administrator
Joined: 03 Dec 2012 Posts: 1785
|
Posted: Sun Jun 10, 2018 4:31 pm Post subject: Re: Something wrong with the installation |
|
|
Ligustri wrote: | I've been trying to install with these instructions:
https://www.smarty.net/docs/en/installing.smarty.basic.tpl
I've configured the php.ini file to include the right path. And this script worked in /var/www/html/try_smarty/ -folder:
Code: | <?php
require_once('Smarty.class.php');
|
What went wrong? How the folders should be? |
What wrong? The very first line.
It should have been Code: | require_once "/where/is/your/smarty/libs/bootstrap.php"; |
Or even better, use Composer https://getcomposer.org/ |
|
Back to top |
|
Ligustri Smarty n00b
Joined: 10 Jun 2018 Posts: 3
|
Posted: Sun Jun 10, 2018 7:03 pm Post subject: Smarty.class.php doesn't contain assign() & display() |
|
|
OK, not any wonder that it didn't work. Smarty.class.php doesn't contain these functions:
assign()
display() |
|
Back to top |
|
Ligustri Smarty n00b
Joined: 10 Jun 2018 Posts: 3
|
Posted: Sun Jun 10, 2018 7:11 pm Post subject: No need for SMARTY_DIR |
|
|
I did add the library path to the php.ini file, so to set the SMARTY_DIR is unnecessary.
Inadvertently I had it on my code. I fixed it away, but it didn't help because the functions are missing. |
|
Back to top |
|
AnrDaemon Administrator
Joined: 03 Dec 2012 Posts: 1785
|
Posted: Sun Jun 10, 2018 8:50 pm Post subject: |
|
|
That does not make any sense. |
|
Back to top |
|
|
|
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
|