Forum for discussing general topics related to Couch.
4 posts Page 1 of 1
Hi everybody and a Happy New Year for all of you, Couch lovers :D !

I was missing from the forum in the last few years, as I was working on stuff which implyed only known things from Couch CMS.
I'm in the same situation now, but just found out that one of my data filtering setups that works in snippets it's not working in a non-clonable template which is used to display data from a clonable template.
As I remember, few years back, KK was the one who helped me out with the code, but somehow I just didn't found the post :(
This is my code which basically filters data by year (from publish date):
Code: Select all
<cms:if "<cms:gpc 'year' method='get'/>">
   <cms:set year = "<cms:gpc 'year' method='get'/>"/>
   <cms:set year_next = "<cms:add year '1'/>"/>
<cms:else/>
   <cms:set year = ''/>
   <cms:set year_next = ''/>
</cms:if>

<form method="get" action="">
   <select name="year" onChange="this.form.submit();">
           <option value="">------- Select year -------</option>
                <cms:archives type='yearly'>
                      <cms:set archive_year = "<cms:date k_archive_date format='Y'/>"/>
                      <option value="<cms:show archive_year/>"<cms:if archive_year == year> selected="true"</cms:if>><cms:show archive_year/></option>
                </cms:archives>
          </select>
          <noscript>
           <input type="submit" value="Filter">
   </noscript>
</form>

<cms:pages masterpage='public/docs.php' start_on=year stop_before=year_next order='asc' >
       ........
       ........
</cms:pages>


As I'm not inside a clonable template, I changed this line
Code: Select all
<cms:archives type='yearly'>

to this one:
Code: Select all
<cms:archives masterpage='public/docs.php' type='yearly'>

but have no idea how to change the first 7 rows of the code, in order to make it to work.
Any help is appreciated.
Hi and a happy New Year to you too, @atisz :)

I tested your code and, if the 'masterpage' params of <cms:pages> and <cms:archives> are the same, it is working just fine.
There is no need to make any other change to the code at all.
KK wrote: Hi and a happy New Year to you too, @atisz :)

I tested your code and, if the 'masterpage' params of <cms:pages> and <cms:archives> are the same, it is working just fine.
There is no need to make any other change to the code at all.


Thank you @KK! You are right! And I was struggling half a day to find a solution for this, and now looking to my original code (slightly different from what I've posted :D ) I realised what I've posted was correct, but in my template archive section the masterpage was missing the "public" part. Damn!

Thanks a lot again, KK!
You are welcome :)
4 posts Page 1 of 1
cron