Jump to content

code logic for selecting specific templates


adrianmak
 Share

Recommended Posts

My pw website has few templates

home.php

basic-page

article-page

photo-page

picture-page

The site has a search with few option provided.

When a user search by all, the search will filter only artilce-page, photo-page and picture-page

instead of building selector with hard-code template

i.e.  $pages->find("template=article-page|photo-page|picture-page")

could selector be more dynamic ?

let say, get all site templates and excluded those templates, in this case, home.php and basic-page will be excluded in the selector

Link to comment
Share on other sites

you could build your selector with some variables/arrays then you could set those in your init and be able to use them in multiple places,...

$excludeArr = array(
	"template!=home",
	"template!=basic-page"
);

$exsel = implode(',', $excludeArr);
$pages->find($exclude);
Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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