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

Strip Error?
Goto page 1, 2  Next
 
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 -> Smarty 3
View previous topic :: View next topic  
Author Message
rustybucket
Smarty Regular


Joined: 28 Jan 2009
Posts: 60

PostPosted: Wed Mar 24, 2010 4:01 pm    Post subject: Strip Error? Reply with quote

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


Joined: 22 Nov 2006
Posts: 5068
Location: Hamburg / Germany

PostPosted: Wed Mar 24, 2010 5:19 pm    Post subject: Reply with quote

It looks like that $smarty->plugins_dir does not point to the plugins folder.
Back to top
View user's profile Send private message
rustybucket
Smarty Regular


Joined: 28 Jan 2009
Posts: 60

PostPosted: Wed Mar 24, 2010 6:00 pm    Post subject: Reply with quote

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


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

PostPosted: Wed Mar 24, 2010 6:03 pm    Post subject: Reply with quote

Try:

$smarty->utility->testInstall();

See if all folders are setup correctly.
Back to top
View user's profile Send private message Visit poster's website
rustybucket
Smarty Regular


Joined: 28 Jan 2009
Posts: 60

PostPosted: Wed Mar 24, 2010 6:26 pm    Post subject: Reply with quote

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


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

PostPosted: Wed Mar 24, 2010 6:32 pm    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
U.Tews
Administrator


Joined: 22 Nov 2006
Posts: 5068
Location: Hamburg / Germany

PostPosted: Wed Mar 24, 2010 6:34 pm    Post subject: Reply with quote

There was recently a bug fix for smarty_internal_utility.php.
You must use the latest SVN version.
Back to top
View user's profile Send private message
rustybucket
Smarty Regular


Joined: 28 Jan 2009
Posts: 60

PostPosted: Wed Mar 24, 2010 6:36 pm    Post subject: Reply with quote

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


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

PostPosted: Wed Mar 24, 2010 6:42 pm    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
rustybucket
Smarty Regular


Joined: 28 Jan 2009
Posts: 60

PostPosted: Wed Mar 24, 2010 6:43 pm    Post subject: Reply with quote

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


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

PostPosted: Wed Mar 24, 2010 6:44 pm    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
U.Tews
Administrator


Joined: 22 Nov 2006
Posts: 5068
Location: Hamburg / Germany

PostPosted: Wed Mar 24, 2010 6:45 pm    Post subject: Reply with quote

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


Joined: 28 Jan 2009
Posts: 60

PostPosted: Wed Mar 24, 2010 6:48 pm    Post subject: Reply with quote

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


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

PostPosted: Wed Mar 24, 2010 6:49 pm    Post subject: Reply with quote

I think U.Tews found the issue.
Back to top
View user's profile Send private message Visit poster's website
rustybucket
Smarty Regular


Joined: 28 Jan 2009
Posts: 60

PostPosted: Wed Mar 24, 2010 6:58 pm    Post subject: Reply with quote

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
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 -> Smarty 3 All times are GMT
Goto page 1, 2  Next
Page 1 of 2

 
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