View previous topic :: View next topic |
Author |
Message |
Evanescent Smarty Rookie
Joined: 17 Oct 2010 Posts: 18
|
Posted: Tue Feb 22, 2011 7:49 pm Post subject: Couple of questions |
|
|
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 |
|
mohrt Administrator
Joined: 16 Apr 2003 Posts: 7368 Location: Lincoln Nebraska, USA
|
Posted: Tue Feb 22, 2011 8:32 pm Post subject: |
|
|
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 |
|
Evanescent Smarty Rookie
Joined: 17 Oct 2010 Posts: 18
|
Posted: Tue Feb 22, 2011 8:36 pm Post subject: |
|
|
Thanks. Crud. 2.6.26 Here comes all the hassle involved in upgrading. |
|
Back to top |
|
mohrt Administrator
Joined: 16 Apr 2003 Posts: 7368 Location: Lincoln Nebraska, USA
|
Posted: Tue Feb 22, 2011 8:48 pm Post subject: |
|
|
Do you need to upgrade? Don't fix what isn't broke 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 |
|
Evanescent Smarty Rookie
Joined: 17 Oct 2010 Posts: 18
|
Posted: Tue Feb 22, 2011 8:54 pm Post subject: |
|
|
mohrt wrote: | Do you need to upgrade? Don't fix what isn't broke 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 |
|
mohrt Administrator
Joined: 16 Apr 2003 Posts: 7368 Location: Lincoln Nebraska, USA
|
Posted: Tue Feb 22, 2011 9:03 pm Post subject: |
|
|
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 |
|
Evanescent Smarty Rookie
Joined: 17 Oct 2010 Posts: 18
|
Posted: Thu Feb 24, 2011 7:56 pm Post subject: |
|
|
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 |
|
mohrt Administrator
Joined: 16 Apr 2003 Posts: 7368 Location: Lincoln Nebraska, USA
|
Posted: Thu Feb 24, 2011 8:01 pm Post subject: |
|
|
Try this:
echo Smarty::SMARTY_VERSION;
Or:
echo $smarty->_version; |
|
Back to top |
|
Evanescent Smarty Rookie
Joined: 17 Oct 2010 Posts: 18
|
Posted: Thu Feb 24, 2011 8:02 pm Post subject: |
|
|
Bingo. Thanks.
Yes, both works. |
|
Back to top |
|
ocs123 Smarty n00b
Joined: 01 Aug 2011 Posts: 1
|
|
Back to top |
|
|