alquist42 / querytemplates Goto Github PK
View Code? Open in Web Editor NEWAutomatically exported from code.google.com/p/querytemplates
Automatically exported from code.google.com/p/querytemplates
Report from Andreas Kalsch.
Following code from "output.code.php" causes "Fatal error: Cannot use object
of type stdClass as array".
$d = new stdclass;
$d->a = 1;
var_dump(isset($d['a']));
Solution:
if (is_array($data) && isset($data['objs'])) $__242d2 = $data['objs']; else
if (isset($data->{'objs'})) $__242d2 = $data->{'objs'};
Original issue reported on code.google.com by [email protected]
on 28 Dec 2009 at 8:03
Static loop support.
$t['>ul > li']->valuesToLoop($d, function($row, $li1) {
$node->valuesToSelector($row['User'], 'span.%k')->
find('> ul')->
valuesToLoop($row['Tags'], function($tag, $li2) {
$li2->valuesToSelector($tag);
})
;
});
Original issue reported on code.google.com by [email protected]
on 24 Feb 2009 at 10:37
printVar support multiple var
first non-empty var is printed
Original issue reported on code.google.com by [email protected]
on 7 Mar 2009 at 11:19
Port QT to other languages. First will be JS. Ruby and python are considered.
Original issue reported on code.google.com by [email protected]
on 3 Dec 2008 at 2:22
pqt() shortcut to pq(), to easily wrap DOMNodes into QueryTemplates objects
(additional methods available).
Original issue reported on code.google.com by [email protected]
on 24 Feb 2009 at 10:37
Addign JSON input for template using one-line script.
Should support:
- passing thou pipe
- passing as parameter
-- more than one variable
Original issue reported on code.google.com by [email protected]
on 27 Mar 2009 at 11:05
What steps will reproduce the problem?
1.
find('div.comments')->ifVar('is_entry')
we have a var in context $in_entry=false
..not to show comments on index pages
What is the expected output? What do you see instead?
error in generated php code ... if(is_entry...)
instead of if($is_entry)...
workaround here is to use find('div.comments')->ifVar('$is_entry')
What version of the product are you using? On what operating system?
latest
Please provide any additional information below.
I find it a bit confusing writing variables with or without $, why not make it
everywhere without the php $ ?
Original issue reported on code.google.com by [email protected]
on 17 Sep 2010 at 2:49
This mode wont need any file write-read, as it would use:
eval('?>'.$code);
Original issue reported on code.google.com by [email protected]
on 27 Apr 2009 at 6:30
Present JS loops doesn't skip inherited fields and are slower for arrays
than they can be.
Todo:
* use hasOwnProperty
* use classic "for" loop for arrays
Original issue reported on code.google.com by [email protected]
on 28 Dec 2009 at 8:18
Missing manual pages should be created. Existing checked and finished.
Original issue reported on code.google.com by [email protected]
on 3 Dec 2008 at 2:20
This functionaliy:
->sourceCollect('input.html')
->parse()
->source('input.html')->returnReplace()
Will be equal to:
->parse('input.html')
Then shortest template will be like this:
template('output')->parse('input.html')
->find('.my-div')
->ifVar('showMyDiv')
->find('ul > li')
->loopOne('data', 'row')
->varsToSelector('row', $rowFields)
;
Original issue reported on code.google.com by [email protected]
on 23 Jan 2009 at 12:07
What steps will reproduce the problem? Example:
1. $template->varPrintAttr('href', 'row.name')
2. Results in compiled code:
a) PHP: ... <a href="" class="name" row.name="<?php if
(isset($row['name'])) print $row['name'];
else if (isset($row->{'name'})) print $row->{'name'}; ?>"> ...
b) JavaScript: ... <a href="" class="name" row.name="';
19
20 print(row['name']);
21;
22 __template += '"> ...
It seems that the documentation says, that
1) the first arg is the attribute's name,
2) and the second arg is the var name
Original issue reported on code.google.com by [email protected]
on 28 Dec 2009 at 1:50
When using paths to access the data tree, it is possible in PHP that some
are arrays and some are objects, so there must be made a distinction
between more than 2 cases in the compiled script. This is how it currently
looks like for "varPrint('data.foo.bar.0')"
<div>
<p><?php if (isset($data['foo']['bar']['0'])) print
$data['foo']['bar']['0'];
else if (isset($data->{'foo'}->{'bar'}->{'0'})) print
$data->{'foo'}->{'bar'}->{'0'}; ?></p>
</div>
Solution:
function find ($object, array $path) {
if (!$path) return $object;
$next = array_shift($path);
if (is_array($object)) return isset($object[$next]) ? find($object[$next],
$path) : null;
elseif (is_object($object)) return isset($object->$next) ?
find($object->$next, $path) : null;
else return $object;
}
$a = array();
$a[]=array();
$a[0]['OK'] = new stdclass;
$a[0]['OK']->test = 0;
$a[0]['OK']->c = 1;
var_dump(find($a, array(0, 'OK', 'c', 'a')));
And now it looks like:
<div>
<p><?php print(find($data, array('foo', 'bar', '0'))); ?></p>
</div>
Original issue reported on code.google.com by [email protected]
on 28 Dec 2009 at 2:11
Allowing to include templates on both client and server sided with no need
for a markup change.
Original issue reported on code.google.com by [email protected]
on 3 Dec 2008 at 2:21
When template is actively cached (void object is returned to simulate the
chain), toReference() doesn't change passed variable. This can lead up to
"Call to a member function ... on a non-object". Thus toReference called on
void object should also return void object.
Original issue reported on code.google.com by [email protected]
on 15 Jan 2009 at 10:14
->ifVar('va1', 'var2')
->elseIfVar('va1', 'var2')
applies also to ifNotVar, elseIfNotVar
Original issue reported on code.google.com by [email protected]
on 8 Mar 2009 at 12:58
JS generator undefined checks are wrong:
typeof $var != undefined
Should be
$var !== undefined
Original issue reported on code.google.com by [email protected]
on 28 Dec 2009 at 8:16
Values are just inserted plain text into the markup. This adds security issues.
To just escape object properties beforehand is possible, but I don't want
to use an own object just for templating (think of encoding the object to
JSON in the next step)
So what about adding extra methods or an additional argument to define, if
a value's special chars should be encoded?
Original issue reported on code.google.com by [email protected]
on 28 Dec 2009 at 1:54
Support callbacks in template filling methods
eg need to remove field's class name from node, after injecting data
$callbackRemoveClass = new Callback(
create_function('$node, $fieldName', 'pq($node)->removeClass($fieldName);')
);
...->varsToSelector('variable', $fields, null, $callbackRemoveClass)->...
Original issue reported on code.google.com by [email protected]
on 30 Dec 2008 at 1:58
Formatter should properly intend final code. There are already HTML Tidy
and XML_Beautifier integrations, but those have issues. Either this issues
will be solved or formatting in DOMDocument level will be achieved.
Original issue reported on code.google.com by [email protected]
on 25 Dec 2008 at 11:29
Rapid table creation.
Original issue reported on code.google.com by [email protected]
on 10 Dec 2008 at 10:49
Generate template in other languages. First will be JS. Ruby is considered.
Original issue reported on code.google.com by [email protected]
on 3 Dec 2008 at 2:21
Support array fields in data injecting methods. By array fields i mean
ending with '[]' and creating array on the server side.
Original issue reported on code.google.com by [email protected]
on 22 Dec 2008 at 10:51
eg:
->varsFilter('htmlentities', 'stripslashes')
Applies callbacked filters to each variable injection.
Support last boolean parameter to switch 'sticky filter'.
Original issue reported on code.google.com by [email protected]
on 24 Jan 2009 at 7:24
->ifCodeContinue($code)
->ifCodeBreak($code)
Original issue reported on code.google.com by [email protected]
on 8 Mar 2009 at 12:59
Collection of QueryTemplates and jQuery-like patterns useful when dealing
with templates. Best place is probably the wiki.
Original issue reported on code.google.com by [email protected]
on 3 Dec 2008 at 7:14
Additional suffixes: after, before, append, prepend; eg varsToSelectorPrepend()
Original issue reported on code.google.com by [email protected]
on 3 Dec 2008 at 2:19
Light version will contain all valuesTo and formFromValues methods types
and will be implemented as jQuery plugin.
Original issue reported on code.google.com by [email protected]
on 25 Feb 2009 at 12:08
CSS stylesheet support can be used for Event Delegation directly from the
stylesheet to specially prepared methods. Simple mockup:
#browser.ie4 div.contents .section:load {
stripTables: "odd-tr";
modifySection: 10 arg1 "argument 2";
}
In this example selector is root for delegation with event stated at the
end. Properties are methods (what would class looks like ? :: ?) and
parameters are method's parameters, separated by space.
Additionally above example contains some browsercheck, which illustrates
another usecase for such functionality.
Probably best tool for this will be CSSTidy[1] with native PHP
implementation. Other possibility is PEAR class. Own implementation is also
considered.
[1] http://csstidy.sourceforge.net/
Original issue reported on code.google.com by [email protected]
on 26 Jan 2009 at 12:04
unsets all var at the end of template
implement in language class
Original issue reported on code.google.com by [email protected]
on 7 Mar 2009 at 11:19
Actual cache method (1.0 beta2) caches only internal QueryTemplates code
and supplied callbacks. Every code executed before going into template
chain is executed always, also when template is read from cache. That's why
new cache method should be available to target this issue. Consider
following code:
require templateFile('my-template-formula.php', __FILE__);
Unfortunately this would NOT work with $monitorCodeModification and
$monitorSourceModification, only with $cacheTimeout. __FILE__ is needed for
determining templates path.
Original issue reported on code.google.com by [email protected]
on 15 Jan 2009 at 11:34
support quoting var names to not be quoted as strings ex
'obj.param.`scopeVar`.subkey'
would became
$obj->param->{$scopeVar}->subkey;
Original issue reported on code.google.com by [email protected]
on 8 Mar 2009 at 12:57
Cascade-inherited filter declaration:
$dom['div']->varsFilter('htmlentities', 'stripslashes');
$dom['div p']->varPrint('foo');
Would result in:
<div>
<p><?php print htmlentities(stripslashes($foo)); ?></p>
</div>
Original issue reported on code.google.com by [email protected]
on 27 Mar 2009 at 11:17
->valuesToLoopReference($data, $referenceArray)
foreach($referenceArray as $r) {
$record = $r[0];
$node = $r[1];
}
Original issue reported on code.google.com by [email protected]
on 8 Mar 2009 at 12:56
->ifVarIsset('var.name')
->ifVarNotIsset('var.name')
->elseIfVarIsset
->elseIfNotVarIsset
Original issue reported on code.google.com by [email protected]
on 8 Mar 2009 at 12:55
template('mandatory-name')->
pq("<form/>")->
attr('id', 'my-id')
;
Original issue reported on code.google.com by [email protected]
on 7 Mar 2009 at 11:21
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.