Coded something up in Couch in an interesting way? Have a snippet or shortcode to share? Post it here for the community to benefit.
61 posts Page 3 of 7
Previous 1, 2, 3, 4, 5, 6, 7 Next
May I request you to please create a new thread and paste your full code (i.e. tags + Search) there for us to see?

Thanks.
Yes I'll do that.
For now, I did a workaround for it by creating another page for showing all my listings sorted by dropdown values and now using the blog_list page for displaying my tags filtered results and folder specific results.
Thank You for all the help. Looking forward to buying a license very soon! :D
Is it possible to cascade the values of dropdown?
Hi, guys!

I'm trying desperately and without any luck to use publish date in order to display member submitted content. My code is this:
Code: Select all
<div>
   <cms:embed 'search.htm' />
</div>
            
Searching for:<cms:show my_search_str /><br /><!-- for debugging -->

<cms:php>
   global $CTX;
   
    // 1st day of the current month
    $CTX->set( 'my_start_on', @date( '01-m-Y', @strtotime("now") ), 'global' );
   
    // 4th day of the current month
    $CTX->set( 'my_stop_before', @date( '04-m-Y', @strtotime("now") ), 'global' );
</cms:php>
    
<cms:pages paginate='1' limit='10' custom_field="<cms:show my_search_str /> | PAGE_PUBLISH_DATE >= <cms:show my_start_on /> | PAGE_PUBLISH_DATE <= <cms:show my_stop_before />" >
   <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>
        <cms:show k_total_records /> Properties Found. (Displaying: <cms:show k_record_from />-<cms:show k_record_to />)
   </cms:if>
      
   ..... Displaying found data here .......      
      
</cms:pages>

Can anyone help me please, to replace PAGE_PUBLISH_DATE with the correct code. Any help is welcomed and appreciated.
@atisz,

First of all, Couch requires all dates to be in 'Y-m-d' format. So please amend your date setting code to the following -
Code: Select all
$CTX->set( 'my_start_on', @date( 'Y-m-01', @strtotime("now") ), 'global' );
$CTX->set( 'my_stop_before', @date( 'Y-m-04', @strtotime("now") ), 'global' );

Next, cms:pages tag natively supports 'start_on' and 'stop_before' parameters so we do not need to set those as custom_field.

Try using the following -
Code: Select all
<cms:pages 
    start_on=my_start_on
    stop_before=my_stop_before
    custom_field=my_search_str
    paginate='1'
    limit='10'
>
..
</cms:pages>

Hope this helps.
Thanks a lot KK! It was so simple, but as I tend to complicate things I was trying the hard/wrong way :)
Hello!
I try to make something like waterfall form of dropdowns, but came across a problem that <cms:input> is processed before <cms:if k_success > statement. So, my code is:
Code: Select all
   <cms:form action='' method='post'>
   
      <cms:if k_success >
         <cms:set choosed_option=frm_select 'global' />
      </cms:if>

      <cms:input type="dropdown" name="select" opt_values="1 | 2 | 3" />
      
      <cms:show choosed_option />
      
      <cms:input type="dropdown" name="select-new" opt_values="<cms:show choosed_option />" />
      
      <cms:input type="submit" name="submit" value="Submit" />

   </cms:form>


So, <cms:show choosed_option /> works well but <cms:input opt_values="<cms:show choosed_option />" /> doesn't work.. So I can't make smth like ajax 'disabled option' feature when filtering due to already selected options.
Please help!
@musman,
The form tag internally works in two phases.
The first phase creates the input fields and does the validation of submitted data (if form submitted).
The second phase calls the inputs (created in phase 1 above) with the result of the form submission (i.e. k_success or k_error).

Now, I think you can see that when your second dropdown gets created (phase 1), k_success was not set and so it remains blank.

So, I am afraid, things won't work the way you envisaged.

Anyways, could you please post a bit more about what you are trying to accomplish? Please post in some real-world code. Perhaps we can find some other way of accomplishing what you want.

Thanks.
Thanks KK,
Yes, I knew such a behavior of forms.. Finally I've found not so difficult solution: I've made some inputs with dynamic values after the main form and hided them with CSS. Along with array_unique, asort and a bunch of ajax for synchonizing main form with additional dropdowns and also to display the result.

The only cons is that JS is the must for this approach, the form will not work with disabled JS in browser... It's bad, so I'll try to overcome it in real applications.

UPD: after testing I've seen that this version works great without JS, just with regular <cms:input type='submit' />, but of course the dropdowns become inadaptive and just show sorted unique values.

UPD2: but the standart pagination doesn't work. Think I should recreate the module using Session set (for non-JS version) and pure JS paginator for ajax version.. No so easy quest, but interesting)

UPD3: finally I've overcome with all the troubles and made fully working solution both for fully ajax or with disabled JS. One thing is that dropdowns with disabled JS are not responsive (so the user can choose incompatible values and get 'no results' message), but if JS is enabled it's not possible to choose incompatible values.

Once again thanks to this great CMS for such great possibilities!
Hello!
I tried to use this and it works great! :D
Questions: Is it possible to initiate the search from one page and display the results in another page? Could you please help me?
Previous 1, 2, 3, 4, 5, 6, 7 Next
61 posts Page 3 of 7
cron