Forum

Thread tagged as: Question, Runway

Runway Collections

Hello All

Im creating a website using perch runway

what im wondering is can you merge multiple collections into one array

each collection will be a Car Make and want to merge them into an array to create a Car Make and Model Filter

Anthony Elleray

Anthony Elleray 2 points

  • 4 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

Can you give an example of what you're trying to achieve?

so i have 20 collections each collection is a Car Make contain a list of models with relevant data

i want to create a perch filter https://docs.grabaperch.com/perch/content/functions/user-filtered-lists/

and populate the dropdowns with the data from the collections

i guess it would be something like this but for collections

 <?php perch_content_custom(array('Writing','Podcasts'), array(
      'count'=>10,
          'template'=>'_external_resource.html',
          'page'=>array('/writing/index.php','/podcasts/index.php'),
          'sort'=>'date',
      'sort-order'=>'RAND'
    ));
        ?>
Duncan Revell

Duncan Revell 78 points
Registered Developer

You might find it easier to have just one collection with all the cars in it.

If you want some control over the 'makes' that can be chosen for each car, create a separate collection that just contains the 'makes' available and use a relationship (perch:related) between the two collections.

That would at least make it easier to filter the (one) collection of cars.

Ok one is fine just thought having them separate would make it easier to find individual ones. but hen the filtering in the new perch update will resolve that

Duncan Revell

Duncan Revell 78 points
Registered Developer

Use standard filtering on your page with perch_collection()

You're on Runway, so assuming your urls are potentially going to be along the lines of site.com/make/model/, create a route that gives you /[a:make]/[slug:model] (as an example) and filter using the make and model 'variables'...

Job's a goodun!