PageList and "select Attribute" - how to get selected value?
Permalink
I added "select" attribute to group of pages and create pagelist custom template.
Now I want to print inside the view.php of [page list] block - the name of the "selected" option (one or more)
Example: Page list like this (each page list item - echo the subject)
http://noeeko.com/category/projects/illustration/...
*** I remember i saw in the past Tut about this in C5 docs. If someone know this please add link
Now I want to print inside the view.php of [page list] block - the name of the "selected" option (one or more)
Example: Page list like this (each page list item - echo the subject)
http://noeeko.com/category/projects/illustration/...
*** I remember i saw in the past Tut about this in C5 docs. If someone know this please add link
Thanks. Weird i first do this and get empty vars. I think it was cache problem
I saw her for example more complicated code. And dont understand the problem
https://gist.github.com/hissy/6255509...
I saw her for example more complicated code. And dont understand the problem
https://gist.github.com/hissy/6255509...
i create isotope galley - so i need for "1.seo" - "2.mobile" (page with two values - " select multiple") - how to create two buttons?
(the echo - give me "1. seo mobile")
(the echo - give me "1. seo mobile")
Sorry, you didn't say it was a multi select attribute, you'll need to do this instead
$attributeOptions = $page->getCollectionAttributeValue('attribute_handle'); foreach($attributeOptions as $option){ echo $option->value; }
Thanks :) Works perfect
Hi Siton - dropped you a PM.
Just wondering if you would be willing to share how you managed this. I would love to be able to create a filterable page list but I have had a look and simply dont have the skills to do it?
I have one on 5.6 and am upgrading a site and am stuck as how to get that functionality
Thanks
Just wondering if you would be willing to share how you managed this. I would love to be able to create a filterable page list but I have had a look and simply dont have the skills to do it?
I have one on 5.6 and am upgrading a site and am stuck as how to get that functionality
Thanks
You need to create custom template + page attributes to "filter by". Than adapt the right syntax of the specific JS library you choose and added to you project - some filter js:
http://isotope.metafizzy.co/
http://mixitup.kunkalabs.com/
http://getuikit.com/docs/grid-js.html...
Sorry, Its impossible to explain how to do this in forum post (long topic). Try use google/youtube to find "how to" or tut about "custom template" & js + download some addons that use js (galleries, dropdowns navs ect.) and try to learn this issue.
I send you by email Example.
http://isotope.metafizzy.co/
http://mixitup.kunkalabs.com/
http://getuikit.com/docs/grid-js.html...
Sorry, Its impossible to explain how to do this in forum post (long topic). Try use google/youtube to find "how to" or tut about "custom template" & js + download some addons that use js (galleries, dropdowns navs ect.) and try to learn this issue.
I send you by email Example.
This didn't work for me in version 8.1.0. Here is what I came up with that will get the selected values as an array in case it can be of any use to anyone else.
if ( !is_null($page->getCollectionAttributeValue('attr_nm')) && !is_null($page->getCollectionAttributeValue('attr_nm')->getSelectedOptions()) && !is_null($page->getCollectionAttributeValue('attr_nm')->getSelectedOptions()->getValues()) ) { $values = ( array_map( function ($row) { return $row->getSelectAttributeOptionValue(); }, $page->getCollectionAttributeValue('attr_nm')->getSelectedOptions()->getValues() ) ); }
Thanks so much for posting this - I couldn't find it documented anywhere (like much of C5) how to do this!
To get the value of a select attribute within the PageList Custom Template you would do something like this