Jump to content

How to merge these templates with selectors?


Recommended Posts

Below I have the selector codes of 3 templates that are almost identical in Find and Display.
If you are wondering, the sort=$order is an identical switch I use on all 3 templates to sort things I retrieve.

But I think, since the code is almost identical, I can do with one template file, then, using a switch or an if-then-else statement to include the file I need (for display).
In php I can do this of course, but I was wondering about the outcome in PW, since I use parent = page name, and 'something' = page, or simply nothing.

Any advice is appreciated.

	// parents = parent page from seller, vendor, category and department
	$items = $pages->find("parent={$page->name}, sort=$order"); ?>
	<div id="content">   
    	<?php include '_grid-view-parents.php';?>

<?php // browse = child page from sellers, vendors, categories and departments, but NOT the products child pages)
	$items = $pages->find("parent=/products/, seller|vendor|department|category=$page, sort=$order"); ?>
	<div id="content">
    	<?php include '_grid-view-products.php'; ?>

<?php // products = parent page from all product child pages
	$items = $pages->find("parent=/products/, sort=$order"); ?>
	<div id="content">              
    	<?php include '_grid-view-products.php';?>      


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

  • Recently Browsing   0 members

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