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

smarty-lint v2.0 released

 
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 -> Tips and Tricks
View previous topic :: View next topic  
Author Message
lorderunion
Smarty Rookie


Joined: 13 Jun 2008
Posts: 8
Location: San Francisco, CA

PostPosted: Thu May 28, 2009 5:44 pm    Post subject: smarty-lint v2.0 released Reply with quote

Wrapped up this last night. v2.0 changes include:
    - almost a complete rewrite of the way it works
    - inclusion of its own copy of Smarty, so you can just download it and go; no more having to deal with tinkering with its source so it works under your project environment
    - support for extensions

http://code.google.com/p/smarty-lint/

Quote:
smarty-lint is a lint implementation for the Smarty templating engine.

smarty-lint was developed out of necessity and with simplicity of use in mind. Many of us all have committed broken templates file into our VCS without proper testing only to have it break a page because of a missing $, or that you forgot to close out your {foreach} statement.

From here you can easily integrate smarty-lint into your build system, so that before committing anything into your source tree you can run template lint checks alongside your normal code lints.
[list=][/list]
Back to top
View user's profile Send private message Send e-mail AIM Address
jLix
Smarty Regular


Joined: 01 Apr 2009
Posts: 59
Location: Lowlands, EU

PostPosted: Fri May 29, 2009 10:28 pm    Post subject: Reply with quote

Sounds interesting. Haven't tested it though.
_________________
http://jlix.net/extensions/smarty
Back to top
View user's profile Send private message Visit poster's website
djn
Smarty Rookie


Joined: 15 Nov 2004
Posts: 13
Location: Trst

PostPosted: Tue Jun 23, 2009 1:51 am    Post subject: Reply with quote

Very useful. I was already using the first version.
Could you explain me again how one is to declare an extension? I'm using a lot PhpMarkdown as a Smarty modifier and I tried to put this dummy code:
Code:
<?php
   class markdown {
         static public function markdown($tplsource, &$smarty) {
         return $tplsource;
         }
      }

in a file named markdown.php in the extensions directory, but it still gives me an error. Where did I misread the instructions? Renaming the function to modifier_markdown or smarty_modifier_markdown didn't change the result.
Thanks in advance.
Back to top
View user's profile Send private message Visit poster's website
lorderunion
Smarty Rookie


Joined: 13 Jun 2008
Posts: 8
Location: San Francisco, CA

PostPosted: Mon Jul 27, 2009 5:39 am    Post subject: Reply with quote

What's the error that you're receiving? That markdown hasn't been defined?

What's the filename of the markdown class in extensions/?

djn wrote:
Very useful. I was already using the first version.
Could you explain me again how one is to declare an extension? I'm using a lot PhpMarkdown as a Smarty modifier and I tried to put this dummy code:
Code:
<?php
   class markdown {
         static public function markdown($tplsource, &$smarty) {
         return $tplsource;
         }
      }

in a file named markdown.php in the extensions directory, but it still gives me an error. Where did I misread the instructions? Renaming the function to modifier_markdown or smarty_modifier_markdown didn't change the result.
Thanks in advance.
Back to top
View user's profile Send private message Send e-mail AIM Address
elpmis
Smarty Elite


Joined: 07 Jun 2007
Posts: 321

PostPosted: Tue Jul 28, 2009 9:19 am    Post subject: Reply with quote

djn wrote:
I'm using a lot PhpMarkdown as a Smarty modifier and I tried to put this dummy code:
Code:
<?php
   class markdown {
         static public function markdown($tplsource, &$smarty) {
         return $tplsource;
         }
      }

in a file named markdown.php in the extensions directory, but it still gives me an error.


Please make a look at /smarty/plugins ... Smarty comes with an own markdown modifier.
Back to top
View user's profile Send private message
djn
Smarty Rookie


Joined: 15 Nov 2004
Posts: 13
Location: Trst

PostPosted: Thu Jul 30, 2009 3:07 am    Post subject: Reply with quote

@lordreunion: it says "Call to undefined function smarty_modifier_markdown()" in the compiled template file and "[plugin] modifier 'markdown' is not implemented (core.load_plugins.php, line 11
8 )". I guess it doesn't load my custom extension, whose name is 'markdown.php' exactly.
I solved my immediate problem putting Michel Fortin's file into the plugins folder, renamed as modifier.markdown.php, but I'd still like to understand where my error is, as this extension thing might come handy someday.

@elpmis: are you sure? I've checked both my local installation and the original Zip file (2.6.26), but I don't see anything like that...

This is the full error returned (the stack trace should be from Xdebug):
PHP Fatal error: Call to undefined function smarty_modifier_markdown() in C:\php\includes\smarty-lint\smarty\templates_c\%%80^803^80323079%%newsitem.tpl.php on line 7
PHP Stack trace:
PHP 1. {main}() C:\php\includes\smarty-lint\smarty-lint:0
PHP 2. smarty_lint->fetch($template = 'C:\\Apache\\htdocs\\2008\\zetaserv\\templates\\newsitem.tpl') C:\php\includes\smarty-lint\smarty-lint:179
PHP 3. Smarty->fetch($resource_name = 'C:\\Apache\\htdocs\\2008\\zetaserv\\templates\\newsitem.tpl', $cache_id = NULL, $compile_id = NULL, $display = FALSE) C:\php\includes\smarty-lint\smarty-lint:69
PHP 4. include() C:\php\includes\smarty-lint\smarty\Smarty.class.php:1283
Smarty error: [in C:\Apache\htdocs\2008\zetaserv\templates\newsitem.tpl line 2]: [plugin] modifier 'markdown' is not implemented (core.load_plugins.php, line 118)
Back to top
View user's profile Send private message Visit poster's website
lorderunion
Smarty Rookie


Joined: 13 Jun 2008
Posts: 8
Location: San Francisco, CA

PostPosted: Thu Jul 30, 2009 3:52 am    Post subject: Reply with quote

Can you file an issue for this and attach your markdown extension, and also Michel Fortin's that you say worked under smart-lint?

http://code.google.com/p/smarty-lint/issues

Thanks.

djn wrote:
@lordreunion: it says "Call to undefined function smarty_modifier_markdown()" in the compiled template file and "[plugin] modifier 'markdown' is not implemented (core.load_plugins.php, line 11
8 )". I guess it doesn't load my custom extension, whose name is 'markdown.php' exactly.
I solved my immediate problem putting Michel Fortin's file into the plugins folder, renamed as modifier.markdown.php, but I'd still like to understand where my error is, as this extension thing might come handy someday.

@elpmis: are you sure? I've checked both my local installation and the original Zip file (2.6.26), but I don't see anything like that...

This is the full error returned (the stack trace should be from Xdebug):
PHP Fatal error: Call to undefined function smarty_modifier_markdown() in C:\php\includes\smarty-lint\smarty\templates_c\%%80^803^80323079%%newsitem.tpl.php on line 7
PHP Stack trace:
PHP 1. {main}() C:\php\includes\smarty-lint\smarty-lint:0
PHP 2. smarty_lint->fetch($template = 'C:\\Apache\\htdocs\\2008\\zetaserv\\templates\\newsitem.tpl') C:\php\includes\smarty-lint\smarty-lint:179
PHP 3. Smarty->fetch($resource_name = 'C:\\Apache\\htdocs\\2008\\zetaserv\\templates\\newsitem.tpl', $cache_id = NULL, $compile_id = NULL, $display = FALSE) C:\php\includes\smarty-lint\smarty-lint:69
PHP 4. include() C:\php\includes\smarty-lint\smarty\Smarty.class.php:1283
Smarty error: [in C:\Apache\htdocs\2008\zetaserv\templates\newsitem.tpl line 2]: [plugin] modifier 'markdown' is not implemented (core.load_plugins.php, line 118)
Back to top
View user's profile Send private message Send e-mail AIM Address
elpmis
Smarty Elite


Joined: 07 Jun 2007
Posts: 321

PostPosted: Fri Jul 31, 2009 6:45 am    Post subject: Reply with quote

djn wrote:
@elpmis: are you sure? I've checked both my local installation and the original Zip file (2.6.26), but I don't see anything like that...


Upps, my fault ... maybe this can help

http://michelf.com/projects/php-markdown/

there are some informations about Smarty too Smile ...
Back to top
View user's profile Send private message
djn
Smarty Rookie


Joined: 15 Nov 2004
Posts: 13
Location: Trst

PostPosted: Mon Aug 31, 2009 1:45 pm    Post subject: Reply with quote

Yes, that one is exactly the plugin I've been using for years.
Don't get misled by the dummy code in my post; I used it just as a test to see how does this extension thing work (or if I can make it work at all - which right now it seems I can't). The dummy code should just return the argument $tplsource with no action upon it - so I don't see where is the error coming from.
Back to top
View user's profile Send private message Visit poster's website
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 -> Tips and Tricks 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