Every repository with this icon (
Every repository with this icon (
| Description: | A beautiful template engine for PHP in Django style edit |
-
I cannot get the following to work with the with tag. What am I doing wrong?
{% with dashboard.team.projectManager as pm %}
<img src="/common/assets/employees/{{ pm.contact_id }}.jpg" />{% endwith %}
Comments
-
1 comment Created 22 days ago by speedmax@Taylor lukxautoescapexfilterxvariablex|M| 0•4xautoescape all variable output|S| resolvedxautoescape all variable output will improve security against XSS attacks and script injections.
This ticket has 0 attachment(s).
Comments
-
1 comment Created 22 days ago by speedmax@Taylor lukxfilterx|M| 0•4xdate filter does not work with integer timestamps|S| resolvedxHi there...
If I have a variable (say "my_timestamp") containing an integer timestamp, the following {{ my_timestamp | date }} does not work (it always displays Jan 1 1970).
The current code for this filter passes integers to strtotime, but that returns FALSE for integer input (at least on my system, php 5.3).
static function date($time, $format = ’jS F Y H:i’) {
if ($time instanceof DateTime) $time = (int) $time->format(’U’); return date($format, strtotime($time));}
I would suggest this should be:
static function date($time, $format = ’jS F Y H:i’) {
if ($time instanceof DateTime) $time = (int) $time->format(’U’); if (!is_numeric($time)) $time = strtotime($time); return date($format, $time);}
This ticket has 0 attachment(s).
Comments
-
2 comments Created 22 days ago by speedmax@Taylor lukx|M| 0•4xParse error in latest download|S| resolvedxHi there...
Just downloaded the latest from github (0.4)... Got this error:
(2048) Non-static method H2O_RE::init() should not be called statically, assuming $this from incompatible context /Volumes/Work/www/sites/testsparks.com/modules/Sparks.View/ext/h2o/h2o/parser.php (185)
Cheers...
This ticket has 0 attachment(s).
Comments
Parse error in latest download
Actually this also occurs when trying to use an if statement in the old version:
Non-static method Evaluator::exec() should not be called statically, assuming $this from incompatible context /Volumes/Work/www/sites/testsparks.com/modules/Sparks.View/ext/h2o/h2o/tags.php (39)
I think some methods need to be declared static....
by al.james (at gmail)
-
5 comments Created 22 days ago by speedmax@Taylor lukx|M| 0•3 releasexrelative_date and relative_time|S| resolvedxHi there...
Cant seem to get relative_date and relative_time to work with integer timestamps.
E.g. {{ mytime|relative_time }} where mytime is an integer timestamp always returns the current date / time.
I can see why. In filters.php line 250:
$timestamp = strtotime($timestamp);
Maybe this should be:
$timestamp = (!is_numeric($timestamp)) ? strtotime($timestamp) : $timestamp;
And, line 278:
$time = strtotime($time);
Should be:
$time = (!is_numeric($time)) ? strtotime($time) : $time;
Cheers!
This ticket has 0 attachment(s).
Comments
relative_date and relative_time
Also.... it may be sensible to allow these functions to accept a php DateTime object.
I.e.
if ($timestamp instanceof DateTime) $timestamp = intVal($timestamp->format(’U’));
$timestamp = (!is_numeric($timestamp)) ? strtotime($timestamp) : $timestamp;by al.james (at gmail)
relative_date and relative_time
H2o is targetted to be PHP 5.1+ compatible, since there are still large
number of PHP5.1 (think redhat servers), PHP 5.1.x doesn’t have DateTime
class (needs optional compiling flag) i will see if i can implement in a
backward compatible way.Thanks again for another awesome input.
Yours
Taylor Luk
by Taylor luk
relative_date and relative_time
Sure, good point.
I suppose adding a if class_exists(’DateTime’) would be suitable?
by al.james (at gmail)
-
1 comment Created 22 days ago by speedmax@Taylor lukxfilterx|M| 0•3 releasexFilter nl2pbr does not work|S| resolvedxTemplate code:
{{ myvariable|nl2pbr }}
Results in:
Fatal error: Call to undefined function h2o_nl2br() in h2o/filters.php on line 218
This ticket has 0 attachment(s).
Comments
-
2 comments Created 22 days ago by speedmax@Taylor lukxactiverecordxdataxobjectsxormxoutputxprotectedxtemplatex|M| 0•3 releasexProblem with outputting protected class data through h2o|S| resolvedxUsing the ORM framework found at: http://lukebaker.org/projects/activerecord-in-php/ I was unable to output data in the template because the model’s object’s "attributes" array (where it keeps its row data, accessed through a custom getter __get()) was protected.
In the PHP file, if I have a $user object, I can do print $user->username and it will output "bob", but if I display a template, with vars "user" => $user ... and then try to {{ user.username }} in template, nothing is output.
This ticket has 0 attachment(s).
Comments
Problem with outputting protected class data through h2o
Hello alex,
Thanks again for submitting this ticket, this isn’t really a bug of h2o template, but a issue with that ORM library you are using.
As i have demonstrated in this code paste which isset() php function will always return false on overloaded properties using magic method (get()) unless (isset()) is also implemented.
Here is the patch file to fix the problem for you and feel free to pass on the patch to the original author, at the mean time i will mark this ticket as invalid and feel free to contact me if u need help
please add this method to your activerecord.php
by Taylor luk
Problem with outputting protected class data through h2o
The library you were using contribute some of the problem where h2o also contains problem working with php overloaded objects since all magical object methods in php doesn’t return the variable reference (alias) by default.
Latest commit should fix this issue with updated specs.
https://github.com/speedmax/h2o-php/tree/5026bf372cb7fc93d9d477c17f0bb838ee2c5a87
by Taylor luk
-
3 comments Created 22 days ago by speedmax@Taylor lukxcommentsx|M| 0•3 releasexWarning thrown when a comment is added to a template|S| resolvedxIntermittent problem which is hard to nail down, only affects single-line comments AFAICT. { a comment }
example:
@@@ {% extends ’gmap_layout.html’ %}{%block title %}{{ service.title|excape }} in {{ place_name }}{% endblock %}
{% block header %}
{{ service.title|excape }} in {{ place_name }}
{% endblock %} { with a comment } {% block place %}About {{ place_name }}
Information about your chosen place more ... {% endblock %} @@@PHP Warning shown:
Warning: Missing argument 2 for H2o_Node::__construct(), called in C:\var\www\includes\h2o\h2o\parser.php on line 80 and defined in C:\var\www\includes\h2o\h2o\nodes.php on line 8
Call stack:
Time Memory Function Location
1 0.9379 129168 {main}( ) ..\index.php:0
2 1.0018 1277784 H2o->construct( ) ..\index.php:292
3 1.0071 1280568 H2o->loadTemplate( ) ..\h2o.php:83
4 1.0071 1280568 H2o_File_Loader->read_cache( ) ..\h2o.php:87
5 1.0090 1299704 H2o_File_Loader->read( ) ..\loaders.php:59
6 1.0101 1300656 H2o->parse( ) ..\loaders.php:47
7 1.0230 1465704 H2o_Parser->parse( ) ..\h2o.php:103
8 1.0235 1467360 H2o::createTag( ) ..\parser.php:88
9 1.0236 1467928 Extends_Tag->construct( ) ..\h2o.php:148
10 1.0238 1469568 H2o_Parser->parse( ) ..\tags.php:176
11 1.0406 1474472 H2o_Node->__construct( ) ..\parser.pWorkround:
1 hide php warnings ;-)
2 call a second template beneath it.$footer = new h2o( ’tpl/footer.html’); echo $footer->render();Win32, php 5.2.6, h20 beta 3
This ticket has 0 attachment(s).
Comments
Warning thrown when a comment is added to a template
its solved in the git or svn version
by Taylor luk
Warning thrown when a comment is added to a template
Hi pual,
Looks like constructor of comment_node is not compatible with h2o_node
class, i have fixed the problem and updated tests.Thanks a lot mate
Taylor luk
by Taylor luk
-
1 comment Created 22 days ago by speedmax@Taylor lukx|M| 0•3 releasexCharacter encoding problem when UTF8 is use in html|S| resolvedxThis looks like a string encoding issue for gettext processing, some latin character is broken when html is set to UTF8 but works fine without it.
This ticket has 0 attachment(s).
Comments
-
1 comment Created 22 days ago by speedmax@Taylor lukxi18nxinternationalizationx|M| 0•3 releasexSupport non-standardized gettext implementations|S| resolvedxCurrently i18n only supports gettext native php extension, it is good but contains serious limitation on some deployment platform.
For instance apache1/2 caches translation mo file aggressively with no way to flush the gettext cache when apache is setup with mod_php, (php fastcgi is not affected)
Ideal gettext support
php-gettext php extension php-gettext pure php library * other i18n implementation such as CakePHP I18n classThis ticket has 0 attachment(s).
Comments
-
1 comment Created 22 days ago by speedmax@Taylor lukxvariablex|M| 0•3 releasexvariables starting with ’or’ cause errors|S| resolvedxecho $h2o->render(array(
’org’=>’My People’, ’job’ => ’templater’ , ’days’ => $arr , ));In the above example the var named "org" fails to show and chucks up 4 warnings, below, xdebug output.
Change the var name to "porg" and all works as it should !
It is repeatable with the word "andy" as well.
Call the var "andy", it fails, "randy" it works.
However, "indy" works fine, so it not because it starts with a vowel.
Sorry I couldn’t fix it but I think you might find that a parser is sensing the words ’or’ and ’and’ as being one of the permitted tags/filters.
I couldn’t spot it though.
A very subtle bastard of a bug, lost half a day, but am gratified if it helps you.
Win32, server2003, apache 2, PHP5.2.6.
Paul
==========================================================
Notice: Undefined offset: 0 in C:\var\www\includes\h2o\h2o\context.php on line 92
Call Stack
Time Memory Function Location
1 1.0543 121392 {main}( ) ..\index.php:0
2 1.0999 1002640 H2o->render( ) ..\index.php:291
3 1.1005 1003872 NodeList->render( ) ..\h2o.php:133
4 1.1005 1003928 Extends_Tag->render( ) ..\nodes.php:27
5 1.1006 1004040 NodeList->render( ) ..\tags.php:200
6 1.1007 1004672 VariableNode->render( ) ..\nodes.php:27
7 1.1007 1004944 H2o_Context->resolve( ) ..\nodes.php:59========================================================
( ! ) Warning: preg_match() expects parameter 2 to be string, array given in C:\var\www\includes\h2o\h2o\context.php on line 102 Call Stack
Time Memory Function Location
1 1.0543 121392 {main}( ) ..\index.php:0
2 1.0999 1002640 H2o->render( ) ..\index.php:291
3 1.1005 1003872 NodeList->render( ) ..\h2o.php:133
4 1.1005 1003928 Extends_Tag->render( ) ..\nodes.php:27
5 1.1006 1004040 NodeList->render( ) ..\tags.php:200
6 1.1007 1004672 VariableNode->render( ) ..\nodes.php:27
7 1.1007 1004944 H2o_Context->resolve( ) ..\nodes.php:59
8 1.1047 1006256 preg_match ( ) ..\context.php:102=====================================================
( ! ) Warning: preg_match() expects parameter 2 to be string, array given in C:\var\www\includes\h2o\h2o\context.php on line 106 Call Stack
Time Memory Function Location
1 1.0543 121392 {main}( ) ..\index.php:0
2 1.0999 1002640 H2o->render( ) ..\index.php:291
3 1.1005 1003872 NodeList->render( ) ..\h2o.php:133
4 1.1005 1003928 Extends_Tag->render( ) ..\nodes.php:27
5 1.1006 1004040 NodeList->render( ) ..\tags.php:200
6 1.1007 1004672 VariableNode->render( ) ..\nodes.php:27
7 1.1007 1004944 H2o_Context->resolve( ) ..\nodes.php:59
8 1.1087 1006408 preg_match ( ) ..\context.php:106===========================================================
( ! ) Warning: array_shift() [function.array-shift]: The argument should be an array in C:\var\www\includes\h2o\h2o\context.php on line 164 Call Stack
Time Memory Function Location
1 1.0543 121392 {main}( ) ..\index.php:0
2 1.0999 1002640 H2o->render( ) ..\index.php:291
3 1.1005 1003872 NodeList->render( ) ..\h2o.php:133
4 1.1005 1003928 Extends_Tag->render( ) ..\nodes.php:27
5 1.1006 1004040 NodeList->render( ) ..\tags.php:200
6 1.1007 1004672 VariableNode->render( ) ..\nodes.php:27
7 1.1126 1005800 H2o_Context->applyFilters( ) ..\nodes.php:61
8 1.1127 1006928 array_shift ( ) ..\context.php:164This ticket has 0 attachment(s).
Comments
variables starting with ’or’ cause errors
Thanks Paul for spotting that bug, i couldn’t able to find it without your help..
Its fixed in latest revision on github, you can checkout specs/parser_spec.php for updated spec, i will improve the spec when i have more time
by Taylor luk
-
1 comment Created 22 days ago by speedmax@Taylor lukxfilterxnamed argumentxparserx|M| 0•3 releasexvariable in named argument is not resolved|S| resolvedxWhen applying named argument to filters, when use a variable as name:value pair, the variable is not resolved with the given context.
could be the it be Parser or Context::applyFilters()
This ticket has 0 attachment(s).
Comments
-
1 comment Created 22 days ago by speedmax@Taylor lukx|M| 0•3 releasexHtmlFilters::htmlAttribute and HtmlFilters::extract method should be protected|S| resolvedxcurrent these two methods are declare as private, they should change to protected so, its easier for subclass to reuse those methods
This ticket has 0 attachment(s).
Comments
-
1 comment Created 22 days ago by speedmax@Taylor lukx|M| 0•3 releasexHtmlFilter class is inconsistent|S| resolvedx- css_tag, script_tag, image_tag should use asset_url
This ticket has 0 attachment(s).
Comments
-
1 comment Created 22 days ago by speedmax@Taylor lukx|M| 0•3 releasexE_STRICT warning|S| resolvedxStrict standards: Non-static method CoreFilters::first() cannot be called statically in /home/tkn/public/h2o-php/h2o.php on line 211
This ticket has 0 attachment(s).
Comments
- @Taylor luk▾
- activerecord▾
- autoescape▾
- comments▾
- data▾
- filter▾
- i18n▾
- internationalization▾
- named argument▾
- objects▾
- orm▾
- output▾
- parser▾
- protected▾
- template▾
- variable▾
- |M| 0•3 release▾
- |M| 0•4▾
- |S| resolved▾
- Apply to Selection
-
Change Color…
Preview:preview
- Rename…
- Delete











