Oliver Posted February 20, 2012 Posted February 20, 2012 Not yet? Will it be supported? Is there any way to do something like $this->pages('templates^=shop_product'); currently?
Soma Posted February 20, 2012 Posted February 20, 2012 Don't know what you mean by for fields native? ah get it.
Soma Posted February 20, 2012 Posted February 20, 2012 You could do something like this: $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.
ryan Posted February 20, 2012 Posted February 20, 2012 $pa = $pages->find('template=' . implode('|', $templates->find('name^=basic-')));
Soma Posted February 20, 2012 Posted February 20, 2012 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 ? $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()));
ryan Posted February 20, 2012 Posted February 20, 2012 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-'));
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now