Coded something up in Couch in an interesting way? Have a snippet or shortcode to share? Post it here for the community to benefit.
62 posts Page 5 of 7
Previous 1, 2, 3, 4, 5, 6, 7 Next
@KK, It really helped!! Thank you!! Sorry for the obvious question, I should have known)) :D
I have a question for file named 'search.htm (file in snippet folder)

I have routes views - each inserted file from the same snippet folder:
<cms:if k_matched_route='list_view'>
<cms:embed '' />
<cms:else_if k_matched_route='custom_1' />
<cms:embed '' />
... ...

Both files ( & ) contain filtering.
My question is:
Do I need a file named search.htm, or I can put the code from search.htm directly into the page &

Ask for assistance
Hi @orbital,

Code within a snippet behaves *exactly* as it would if it was placed directly within templates.
So, both the methods should work. By using snippets you'd avoid duplication of code though.
Thanks for the reply KK ;)
I thought it must have an external file, because in the code (search.htm) has frm_ variables
I know that in such cases is mandatory code to be placed in another file
Can someone help me!

I am creating a website for with sofa. he is very good.

My client asked to create a filtered search.

the busa item search records within adminstrativo panel.

and research related to each item. example:

(Type) (trademark) (model).


selection (type of) car. when you select (mark) display unique brand as the type. when you select (model). show only the models registered with the type.

I have a website of a competitor example.

somebody help me ?

It is possible with the couch?

I'm from Brazil I have difficulty :cry:
Hi guys!
I'm facing the following situation. I have:
1. documents.php which is a clonable template;
2. document-reports.php which is a template with no editables defined, used only for filtering the documents via
3. document-report-filter.html snippet.
The filtering is made by year, document type, author, etc. In this filter I would like to use year from the publish date, as publish date is already available, but I don't know how.
It is possible to use it somehow directly in the search string
Code: Select all
<cms:if frm_years!='-' >
            <cms:set my_search_str="<cms:concat my_search_str ' | docyear==' frm_years />"  scope='global'/>
, or year most be saved in documents.php template docyear editable previously to use it in the search string?
Any help is appreciated.

I would say, start_on & stop_before parameters can help here. Basically, start_on='2016-01-01' stop_before='2017-01-01'. But sometimes the years of the cloned pages vary and not known beforehand. In this case, please study <cms:archives /> tag, since it can get you a list of available years.
Thanks Trendoman for your suggestion.
However, I really would like to use the year from publish date somehow in a simpler manner if is possible. I forgot to mention the fact that when adding new documents from the front-end, I'm using KK's solution listed here , so the publish date is available, as user must input it from the front-end.
Code: Select all
So I just have to grab the year part of frm_my_datetime somehow, and save it in an editable created for this in my documents.php template.
Am I right?
@atisz, please post your code (both showing years in filter and custom listing) so I could get you some easy code for years.

The solution with saving user-inputted year to editable is somewhat cumbersome, requires extra efforts which are not always reliable. It would be a big load for the server to fetch all cloned pages and find unique year from each of the page. Such tasks are managed by database 1000x faster. We should use proper tools :)
This is what I've done so far:
1. document-reports.php
Code: Select all
<div><!-- Start search snippet -->
   <cms:embed 'document-report-filter.html' />
</div><!-- End search snippet -->

<div id="navigation-bar">

<div id="table"><!-- Start table -->
         <th>Document name</th>
         <th>Document type</th>
      <cms:pages masterpage='members/documents.php' custom_field=my_search_str order='asc' paginate='1' limit='20'>
         <cms:if k_paginated_top >
               <cms:set my_records_found='1' scope='global'/>
               <cms:if k_paginator_required >
                     Page <cms:show k_current_page /> of <cms:show k_total_pages /><br />
         <cms:if excludreg >
               ... do something ....                        
         <cms:else />
               <td><cms:date k_page_date format='d.m.Y' /></td>
               <td><cms:show docname /></td>
               <td><cms:show doctype /></td>
                    <td><cms:show author /></td>
</div><!-- End table -->

2. document-report-filter.html
Code: Select all
   <cms:form name="quicksearch" id="quicksearch" anchor='0'>
      <cms:if k_success >
         <cms:if frm_years!='-' >
            <cms:set my_search_str="<cms:concat my_search_str ' | docyear==' frm_years />"  scope='global'/>
         <cms:if frm_doctypes!='-' >
            <cms:set my_search_str="<cms:concat my_search_str ' | doctype==' frm_doctypes />"  scope='global'/>
            <cms:if frm_authors!='-' >
            <cms:set my_search_str="<cms:concat my_search_str ' | author==' frm_authors />"  scope='global'/>
         <label>Year:</label><br />
         <cms:input type="dropdown"
               opt_values="All=- | <cms:pages masterpage='members/years.php' order='asc'><cms:show year /><cms:if k_paginated_bottom='0' >|</cms:if></cms:pages>"
               name="years" id="years" />
         <label>Document type:</label><br />
         <cms:input type="dropdown"
                  opt_values="All=- | Internal | Incoming | Outgoing"
               name="doctypes" id="doctypes" />
         <label>Author:</label><br />
         <cms:input type="dropdown"
               opt_values="All=- | <cms:pages masterpage='members/index.php' order='asc'><cms:show k_page_title /><cms:if k_paginated_bottom='0' >|</cms:if></cms:pages>"
               name="authors" id="authors" />
         <br />
      <div class="buttonset">
         <cms:input type="submit" class="fbsubmitbtn" value="Generate report" name="submit"/>

Currently the year filter is working using the docyear field from documents.php, which is populated automatically with the year on form submition (add-document.php), but unfortunately the use case is a little special, from this reason the field is populated sometimes with the wrong year. That's why I was thinking to use year from publish date, because this is what matters and it is always correct, even if user edits it :)

Previous 1, 2, 3, 4, 5, 6, 7 Next
62 posts Page 5 of 7