View previous topic :: View next topic |
Author |
Message |
rustybucket Smarty Regular
Joined: 28 Jan 2009 Posts: 60
|
Posted: Wed Mar 24, 2010 4:01 pm Post subject: Strip Error? |
|
|
I'm just trying to get my feet wet with v3 right now. Fired up a test environment with 3 and brought in one of my v2 sites. I'm getting this error.
Fatal error: Uncaught exception 'Exception' with message 'Syntax Error in template "/Users/computer/Sites/name/public_html/templates/dnr/public/content/showAll.tpl" on line 33 " {$content.content|strip}" unknown modifier "strip"' in .....
I know exactly where I think this error is coming from.
in the template file: {$content.content|strip}
It used to strip all the whitespace out of the html ($content.content). Is strip still available in 3? Am I just using it wrong? |
|
Back to top |
|
U.Tews Administrator
Joined: 22 Nov 2006 Posts: 5068 Location: Hamburg / Germany
|
Posted: Wed Mar 24, 2010 5:19 pm Post subject: |
|
|
It looks like that $smarty->plugins_dir does not point to the plugins folder. |
|
Back to top |
|
rustybucket Smarty Regular
Joined: 28 Jan 2009 Posts: 60
|
Posted: Wed Mar 24, 2010 6:00 pm Post subject: |
|
|
I checked that and everything looks good with the path.
I am testing smarty this way, (maybe this is my problem?)
I have a directory /smarty/libs/
I can run a v2 site just fine with this setup (it is my local dev environment).
When I replace the /libs/ v2 folder with the /libs/ folder from v3 I begin getting the errors.
If the path was correctly set with the v2 /lib/ in place shouldn't it be the same with the v3? |
|
Back to top |
|
mohrt Administrator
Joined: 16 Apr 2003 Posts: 7368 Location: Lincoln Nebraska, USA
|
Posted: Wed Mar 24, 2010 6:03 pm Post subject: |
|
|
Try:
$smarty->utility->testInstall();
See if all folders are setup correctly. |
|
Back to top |
|
rustybucket Smarty Regular
Joined: 28 Jan 2009 Posts: 60
|
Posted: Wed Mar 24, 2010 6:26 pm Post subject: |
|
|
ok, yup definitely something going on here.
as per mohrt's instructions
Smarty Installation test...
Testing template directory...
FAILED: ./templates/ is not a directory.
Testing compile directory...
Catchable fatal error: Object of class Smarty could not be converted to string in /Users/rustycoan/Sites/name/smarty/libs/sysplugins/smarty_internal_utility.php on line 177
Last edited by rustybucket on Wed Mar 24, 2010 6:41 pm; edited 1 time in total |
|
Back to top |
|
mohrt Administrator
Joined: 16 Apr 2003 Posts: 7368 Location: Lincoln Nebraska, USA
|
Posted: Wed Mar 24, 2010 6:32 pm Post subject: |
|
|
is the compile_dir a string? It cannot be an array. Also your template_dir seems to not be found. Use absolute filepaths to everything to be safe. |
|
Back to top |
|
U.Tews Administrator
Joined: 22 Nov 2006 Posts: 5068 Location: Hamburg / Germany
|
Posted: Wed Mar 24, 2010 6:34 pm Post subject: |
|
|
There was recently a bug fix for smarty_internal_utility.php.
You must use the latest SVN version. |
|
Back to top |
|
rustybucket Smarty Regular
Joined: 28 Jan 2009 Posts: 60
|
Posted: Wed Mar 24, 2010 6:36 pm Post subject: |
|
|
Yes, it's a string. All paths are absolute paths. Again, all of this setup info works just fine if I switch back to the v2 smarty libs.
Here's where I define the paths
Code: |
// smarty configuration
//class Guestbook_Smarty extends Smarty {
class Dealer_Smarty extends Smarty {
function Dealer_Smarty() {
$this->template_dir = APP_DIR . 'templates/'.SITE_FOLDER_NAME.'/';
$this->plugin_dir = SERVER_PATH.''.SITE_PATH_NAME.'/smarty/libs/plugins/';
$this->compile_dir = APP_DIR . 'perfectStorm/'.SITE_FOLDER_NAME.'/templates_c';
$this->config_dir = APP_DIR . 'perfectStorm/'.SITE_FOLDER_NAME.'/configs';
$this->cache_dir = APP_DIR . 'perfectStorm/'.SITE_FOLDER_NAME.'/cache';
}
}
|
if I var_dump compile_dir I get
Code: |
string(72) "/Users/computer/Sites/name/public_html/perfectStorm/dnr/templates_c" |
Definitely a string. And definitely the correct path. |
|
Back to top |
|
mohrt Administrator
Joined: 16 Apr 2003 Posts: 7368 Location: Lincoln Nebraska, USA
|
Posted: Wed Mar 24, 2010 6:42 pm Post subject: |
|
|
and if you do:
Code: | var_dump(is_writable('/Users/computer/Sites/site/public_html/perfectStorm/dnr/templates_c')); |
You get a response of "true" or 1?
Also, what is the value of APP_DIR, is it just "." or an absolute path? |
|
Back to top |
|
rustybucket Smarty Regular
Joined: 28 Jan 2009 Posts: 60
|
Posted: Wed Mar 24, 2010 6:43 pm Post subject: |
|
|
U.Tews wrote: | There was recently a bug fix for smarty_internal_utility.php.
You must use the latest SVN version. |
I just downloaded the newest beta (3.0b8) this morning from the smarty.net site. Is there somewhere else I should be getting the files from? |
|
Back to top |
|
mohrt Administrator
Joined: 16 Apr 2003 Posts: 7368 Location: Lincoln Nebraska, USA
|
Posted: Wed Mar 24, 2010 6:44 pm Post subject: |
|
|
rustybucket wrote: | U.Tews wrote: | There was recently a bug fix for smarty_internal_utility.php.
You must use the latest SVN version. |
I just downloaded the newest beta (3.0b8) this morning from the smarty.net site. Is there somewhere else I should be getting the files from? |
You will want to checkout the latest version from SVN, see the download page. |
|
Back to top |
|
U.Tews Administrator
Joined: 22 Nov 2006 Posts: 5068 Location: Hamburg / Germany
|
Posted: Wed Mar 24, 2010 6:45 pm Post subject: |
|
|
See the following in the SMARTY3_BC_NOTES
== Extending the Smarty class ==
Smarty 3 makes use of the __construct method for initialization. If you are extending
the Smarty class, its constructor is not called implicitly if the your child class defines
its own constructor. In order to run Smarty's constructor, a call to parent::__construct()
within your child constructor is required.
<source lang="php">
class MySmarty extends Smarty {
function __construct() {
parent::__construct();
// your initialization code goes here
}
}
</source> |
|
Back to top |
|
rustybucket Smarty Regular
Joined: 28 Jan 2009 Posts: 60
|
Posted: Wed Mar 24, 2010 6:48 pm Post subject: |
|
|
Response to the var_dump(is_writable())
bool(true)
APP_DIR is a path that's defined earlier. I wanted/needed a more 'portable' way of implementing smarty and transferring between servers so all my possible variable paths are defined.
In this particular case APP_DIR = /Users/computer/Sites/name/public_html/ |
|
Back to top |
|
mohrt Administrator
Joined: 16 Apr 2003 Posts: 7368 Location: Lincoln Nebraska, USA
|
Posted: Wed Mar 24, 2010 6:49 pm Post subject: |
|
|
I think U.Tews found the issue. |
|
Back to top |
|
rustybucket Smarty Regular
Joined: 28 Jan 2009 Posts: 60
|
Posted: Wed Mar 24, 2010 6:58 pm Post subject: |
|
|
so, something like this? I'm not sure I'm understanding fully...
Code: | class Dealer_Smarty extends Smarty {
function __construct() {
parent::__construct();
$this->template_dir = APP_DIR.'templates/'.SITE_FOLDER_NAME.'/';
$this->plugin_dir = SERVER_PATH.''.SITE_PATH_NAME.'/smarty/libs/plugins/';
$this->compile_dir = APP_DIR.'perfectStorm/'.SITE_FOLDER_NAME.'/templates_c';
$this->config_dir = APP_DIR.'perfectStorm/'.SITE_FOLDER_NAME.'/configs';
$this->cache_dir = APP_DIR.'perfectStorm/'.SITE_FOLDER_NAME.'/cache';
}
} |
|
|
Back to top |
|
|