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

Couple of questions

 
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
Evanescent
Smarty Rookie


Joined: 17 Oct 2010
Posts: 18

PostPosted: Tue Feb 22, 2011 7:49 pm    Post subject: Couple of questions Reply with quote

Hello,

1. I see a new version (3.0.7) has been released. I know I have an older version, but I'm not sure how to tell what version I have. Can someone please tell me how I can find out the installed version I have and if there is a document that tells me how to upgrade?

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


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

PostPosted: Tue Feb 22, 2011 8:32 pm    Post subject: Reply with quote

To see the version:

Code:
$smarty = new Smarty();
echo $smarty->version;


Or, edit the Smarty.class.php file and look at the version number.
Back to top
View user's profile Send private message Visit poster's website
Evanescent
Smarty Rookie


Joined: 17 Oct 2010
Posts: 18

PostPosted: Tue Feb 22, 2011 8:36 pm    Post subject: Reply with quote

Thanks. Crud. 2.6.26 Here comes all the hassle involved in upgrading. Sad
Back to top
View user's profile Send private message
mohrt
Administrator


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

PostPosted: Tue Feb 22, 2011 8:48 pm    Post subject: Reply with quote

Do you need to upgrade? Don't fix what isn't broke Smile Otherwise, please read the text files that come with the distribution. They are also linked under the resources section on the Smarty website.
Back to top
View user's profile Send private message Visit poster's website
Evanescent
Smarty Rookie


Joined: 17 Oct 2010
Posts: 18

PostPosted: Tue Feb 22, 2011 8:54 pm    Post subject: Reply with quote

mohrt wrote:
Do you need to upgrade? Don't fix what isn't broke Smile Otherwise, please read the text files that come with the distribution. They are also linked under the resources section on the Smarty website.


Need is relative. I was looking to fix some error and the "stuff" I found had different folder structures and one of the things I found told me to run

$smarty->testInstall();

This didn't work, so then I scratched around.

I'm about to do a redesign of a website and the question I have is whether I want to do it on this 2.6.26 codebase or bite the bullet now and upgrade to something that is more recent and might thus be a bit more resilient a year from now.

Granted, I've hardly scratched the surface of everything I can do with Smarty, so maybe you're right.

/me ponders.
Back to top
View user's profile Send private message
mohrt
Administrator


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

PostPosted: Tue Feb 22, 2011 9:03 pm    Post subject: Reply with quote

There no testInstall with Smarty 2, but you can emulate that:

http://www.smarty.net/forums/viewtopic.php?t=4500

However, if you can upgrade to Smarty 3 now with little impact, that may be a good move for the future. Smarty 3 has a lot of new useful stuff (eg. template inheritance.)
Back to top
View user's profile Send private message Visit poster's website
Evanescent
Smarty Rookie


Joined: 17 Oct 2010
Posts: 18

PostPosted: Thu Feb 24, 2011 7:56 pm    Post subject: Reply with quote

I'm having a basic error somewhere, which makes me wonder if I'm running the old 2.6.26 code or the actual new 3.0.7 code. The

Code:

$smarty->testInstall();


works, but the

Code:

echo $smarty->version;


part fails with: Notice: Undefined property: Smarty::$version in C:\www\kccs\index.php on line 38

My code:

Code:

<?php
// NOTE: Smarty has a capital 'S'
// define('SMARTY_DIR', 'c:/www/libs/Smarty-3.0.7/libs/');

$path = $_SERVER['DOCUMENT_ROOT'];                // where the Smarty Class files are kept
$path_parts = pathinfo($_SERVER['REQUEST_URI']);
if ($path_parts['dirname'] == '\\') {              //we've not found a filename, thus we're assuming index.php
    $appRoot = "/" . $path_parts['basename'];
    $thisFile = "index";
} else {
    $appRoot = $path_parts['dirname'];
    $thisFile = $path_parts['filename'];
}

$SMARTY_DIR = $path . '/libs/Smarty-3.0.7/libs/';
$smartyRoot = $path . $appRoot . "/smarty/";     // directories

echo "<br /><---------------------->";
echo "<br />Mike's debugging:";
echo '<br />$path: ' . $path;
echo '<br />$SMARTY_DIR: ' . $SMARTY_DIR;
echo '<br />$appRoot: ' . $appRoot;
echo '<br />$thisFile: ' . $thisFile;
echo '<br />$smartyRoot: ' . $smartyRoot;
echo "<br /><---------------------->";



// require_once('Smarty.class.php');
require_once($SMARTY_DIR . 'Smarty.class.php');
$smarty = new Smarty();
$smarty->template_dir = $smartyRoot . "templates";
$smarty->compile_dir = $smartyRoot . "templates_c";
$smarty->cache_dir = $smartyRoot . "cache";
$smarty->config_dir = $smartyRoot . "config";

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


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

PostPosted: Thu Feb 24, 2011 8:01 pm    Post subject: Reply with quote

Try this:

echo Smarty::SMARTY_VERSION;

Or:

echo $smarty->_version;
Back to top
View user's profile Send private message Visit poster's website
Evanescent
Smarty Rookie


Joined: 17 Oct 2010
Posts: 18

PostPosted: Thu Feb 24, 2011 8:02 pm    Post subject: Reply with quote

Bingo. Thanks.

Yes, both works. Smile
Back to top
View user's profile Send private message
ocs123
Smarty n00b


Joined: 01 Aug 2011
Posts: 1

PostPosted: Mon Aug 01, 2011 3:56 am    Post subject: Reply with quote

Evanescent wrote:
Bingo. Thanks.

Yes, both works. Smile


Good post!




____________________
Babyliss flat irons
Chi hair dryer
T3 hair dryer
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