$this->pages('templates^=shop_product');
currently?
Operator '^=' is not yet supported for fields native to pages table
Started by Oliver, Feb 20 2012 05:10 PM
7 replies to this topic
#2
Posted 20 February 2012 - 05:20 PM
ah get it.
@somartist | modules created | support me, flattr my work flattr.com
#3
Posted 20 February 2012 - 05:30 PM
You could do something like this:
more likely...
Fun.
$tpl = $templates->find('name^=basic-')->first();
$pa = $pages->find("template=$tpl");more likely...
$pa = new PageArray();
$tpl = $templates->find('name^=basic-');
foreach($tpl as $tp) {
$pa->import( $pages->find("template=$tp") );
}Fun.
@somartist | modules created | support me, flattr my work flattr.com
#6
Posted 20 February 2012 - 06:04 PM
I've left that to you Ryan... was going to put it but thought someone else will 
BTW why can't this work? with 12,32,42,42 instead of |, would be even shorter ?
EDIT: Problem is it doesn't seem to work for me here. ?
EDIT: Ok got it
This is the right one:
BTW why can't this work? with 12,32,42,42 instead of |, would be even shorter ?
$pa = $pages->find('template=' . $templates->find('name^=basic-')); EDIT: Problem is it doesn't seem to work for me here. ?
EDIT: Ok got it
This is the right one:
$pa = $pages->find("template=" . implode("|", $templates->find('name^=basic-')->getArray()));
@somartist | modules created | support me, flattr my work flattr.com
#7
Posted 20 February 2012 - 06:32 PM
Comma can't be used to separate the template names because comma is used to separate individual components of a selector. However, the default output of WireArray::__toString isn't really that useful at present, so I've modified it to return a selector compatible string instead (like PageArray does). So if you've got the latest commit, you can do this (copied from your example):
$pa = $pages->find('template=' . $templates->find('name^=basic-'));
#8
Posted 20 February 2012 - 06:39 PM
Great thanks Ryan! The shorter the better.
@somartist | modules created | support me, flattr my work flattr.com
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users













