Smarty Forum Index Smarty
The discussions here are for Smarty, a template engine for the PHP programming language.

Something wrong with the installation

 
Post new topic   Reply to topic    Smarty Forum Index -> Installation and Setup
View previous topic :: View next topic  
Author Message
Ligustri
Smarty n00b


Joined: 10 Jun 2018
Posts: 3

PostPosted: Sun Jun 10, 2018 11:12 am    Post subject: Something wrong with the installation Reply with quote

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?
Code:
Back to top
View user's profile Send private message
bsmither
Smarty Pro


Joined: 20 Dec 2011
Posts: 176
Location: West Coast

PostPosted: Sun Jun 10, 2018 2:47 pm    Post subject: Reply with quote

Is the PHP constant SMARTY_DIR defined anywhere?
Back to top
View user's profile Send private message
AnrDaemon
Administrator


Joined: 03 Dec 2012
Posts: 1299

PostPosted: Sun Jun 10, 2018 4:31 pm    Post subject: Re: Something wrong with the installation Reply with quote

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
View user's profile Send private message
Ligustri
Smarty n00b


Joined: 10 Jun 2018
Posts: 3

PostPosted: Sun Jun 10, 2018 7:03 pm    Post subject: Smarty.class.php doesn't contain assign() & display() Reply with quote

OK, not any wonder that it didn't work. Smarty.class.php doesn't contain these functions:

assign()
display()
Back to top
View user's profile Send private message
Ligustri
Smarty n00b


Joined: 10 Jun 2018
Posts: 3

PostPosted: Sun Jun 10, 2018 7:11 pm    Post subject: No need for SMARTY_DIR Reply with quote

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
View user's profile Send private message
AnrDaemon
Administrator


Joined: 03 Dec 2012
Posts: 1299

PostPosted: Sun Jun 10, 2018 8:50 pm    Post subject: Reply with quote

That does not make any sense.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    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