Get custom page attribute in pag list

Permalink
Hi everyone - I need some help with the following:

I am currently building a site for a holiday region comprising 5 destinations, each of them with specific special offers for their guests.

Whenever a guest visits the site of one of the destinations, I would like a page-list to show only the offers relevant for this destination.

How can I convince a custom-built pagelist-template to get the pages by attribute? I have created specific destination attributes in an album under pages and themes but I do not know how to continue ...

A little booster is highly appreciated.....

pixeljunkie
 
MrKDilkington replied on at Permalink Best Answer Reply
MrKDilkington
Hi pixeljunkie,

The results displayed in a Page List block custom template are already sorted and filtered. I don't believe you can add additional attribute filtering to these results. An alternative is creating a custom template that displays its own page list and filtering. This custom template could be applied to the Page List block, but would be independent of it (the block form would not change the results, only the code in the template would).

This documentation describes creating a page list using code:
http://documentation.concrete5.org/developers/working-with-pages/se...

You can filter a page list by attribute:
"Filter by Attribute"
http://documentation.concrete5.org/developers/working-with-pages/se...
JohntheFish replied on at Permalink Reply
JohntheFish
There are enhanced page list blocks such as PageList+ that enable further filtering through the block edit dialog.

if you are on 5.6, there is also my Magic Data + Uber List combination, where you can create pretty much any filtered list you could imagine.
pixeljunkie replied on at Permalink Reply
pixeljunkie
Hi Karl - thank you for your (as usual) very useful response. It got me on the right track.
:D
ob7dev replied on at Permalink Reply
ob7dev
Building upon what MrKDilkington said...

If each special offer is its own page, you could start by making a page template for the offers (to be used for each offer page), inside it add a custom select attribute of 'location' that contains the different destinations. Then build a custom block that filters page types based on the custom attribute defined. The block would need to determine what location you want to filter by. I would start by hard coding the destinations, and add it to the form.php where you can select the destination the block is suppose to filter for.

The API describes how to use the Page List Class:
http://documentation.concrete5.org/api/class-Concrete.Core.Page.Pag...