View previous topic :: View next topic |
Author |
Message |
lorderunion Smarty Rookie
Joined: 13 Jun 2008 Posts: 8 Location: San Francisco, CA
|
Posted: Thu May 28, 2009 5:44 pm Post subject: smarty-lint v2.0 released |
|
|
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 |
|
jLix Smarty Regular
Joined: 01 Apr 2009 Posts: 59 Location: Lowlands, EU
|
|
Back to top |
|
djn Smarty Rookie
Joined: 15 Nov 2004 Posts: 13 Location: Trst
|
Posted: Tue Jun 23, 2009 1:51 am Post subject: |
|
|
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 |
|
lorderunion Smarty Rookie
Joined: 13 Jun 2008 Posts: 8 Location: San Francisco, CA
|
Posted: Mon Jul 27, 2009 5:39 am Post subject: |
|
|
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 |
|
elpmis Smarty Elite
Joined: 07 Jun 2007 Posts: 321
|
Posted: Tue Jul 28, 2009 9:19 am Post subject: |
|
|
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 |
|
djn Smarty Rookie
Joined: 15 Nov 2004 Posts: 13 Location: Trst
|
Posted: Thu Jul 30, 2009 3:07 am Post subject: |
|
|
@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 |
|
lorderunion Smarty Rookie
Joined: 13 Jun 2008 Posts: 8 Location: San Francisco, CA
|
Posted: Thu Jul 30, 2009 3:52 am Post subject: |
|
|
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 |
|
elpmis Smarty Elite
Joined: 07 Jun 2007 Posts: 321
|
Posted: Fri Jul 31, 2009 6:45 am Post subject: |
|
|
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 ... |
|
Back to top |
|
djn Smarty Rookie
Joined: 15 Nov 2004 Posts: 13 Location: Trst
|
Posted: Mon Aug 31, 2009 1:45 pm Post subject: |
|
|
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 |
|
|