Jump to content

Operator '^=' is not yet supported for fields native to pages table


Oliver
 Share

Recommended Posts

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.

Link to comment
Share on other sites

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 ? :D

$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())); 
Link to comment
Share on other sites

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-')); 
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...