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

How to reference the Smarty 3 template engine

 
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 -> General
View previous topic :: View next topic  
Author Message
blockergroup
Smarty n00b


Joined: 24 Mar 2016
Posts: 1

PostPosted: Thu Mar 24, 2016 9:49 pm    Post subject: How to reference the Smarty 3 template engine Reply with quote

Hello,
I recently changed servers and have run into a lot of problems.
on my old server in my PHP front-end config.inc file, the reference to the smarty directory path was:

define('SMARTY_DIR', '/usr/share/php/smarty3/');

On new server I do not have access to a /usr/share/php.... path.

I was told by a tech with the new server company that I should include the PHP library into my own website and reference the Smarty 3 template engine.

I have all the smarty files in a folder on the server with all my front-end php files but, i don't know how i should correctly write define('SMARTY_DIR', '/usr/share/php/smarty3/');
or how to reference the Smarty 3 template.

when i go to the domain name www.dessinsllcportal.com, i get a page of errors, which basically tell me Warning: include_once..... no such file or directory.

any help would be appreciated.
thank you.
B
Back to top
View user's profile Send private message
AnrDaemon
Administrator


Joined: 03 Dec 2012
Posts: 1785

PostPosted: Thu Mar 24, 2016 10:17 pm    Post subject: Reply with quote

Learn the power of Composer.
Back to top
View user's profile Send private message
elpmis
Smarty Elite


Joined: 07 Jun 2007
Posts: 321

PostPosted: Tue Mar 29, 2016 10:56 am    Post subject: Re: How to reference the Smarty 3 template engine Reply with quote

blockergroup wrote:

I have all the smarty files in a folder on the server with all my front-end php files but, i don't know how i should correctly write define('SMARTY_DIR', '/usr/share/php/smarty3/');
or how to reference the Smarty 3 template.


Think system file path on your new server is different. Create a little script named path.php with

Code:
<?php
echo __DIR__;
?>


inside and load this to the root folder for your website. After running that script with http://www.dessinsllcportal.com/path.php you will get an output which tells you the complete path to your website root so you can modify the line. Don't forget to delete this script after path check!

Or as alternative - modify the line like this

Code:
define('SMARTY_DIR', __DIR__ . DIRECTORY_SEPARATOR . 'php'  . DIRECTORY_SEPARATOR . 'smarty3' . DIRECTORY_SEPARATOR);
Back to top
View user's profile Send private message
AnrDaemon
Administrator


Joined: 03 Dec 2012
Posts: 1785

PostPosted: Tue Mar 29, 2016 2:49 pm    Post subject: Reply with quote

Only ever use "DIRECTORY_SEPARATOR" to parse input data.
Always use "/" in your code, where you work internally.
Output may or may not require "DIRECTORY_SEPARATOR", but prefer to not use it, if you can.
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 -> General 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