Forum for discussing general topics related to Couch.
15 posts Page 2 of 2
After providing the solution above, let me touch upon some previous things that still might be worrying you.

But although I can add the code in the property template page, it doesn't show on the portfolio_list.html

The solution to this is rather simple. It arises from the fact how Couch treats different views. http://docs.couchcms.com/concepts/varia ... views.html
Portfolio_list.html is called in home/list-view, while all the editables exist only for pages, i.e. page-view.
You absolutely correctly noted this in admin:
Also, the edit box shows in each of the property pages

So, to resolve the thing above you could go with a different approach:
Create some other new non-clonable template and fetch this editable from that template like this:
Code: Select all
<cms:get_custom_field 'my_textarea_editable' masterpage='frise.php' />

Another way is like you did but without repeatable:
Code: Select all
<cms:pages masterpage='frise.php'>
   <cms:show my_textarea_editable />
</cms:pages>

It is not very efficient, but good for variables, which are used across the whole website.

Or you chose another valid approach - with repeatables.
While you did absolutely correct with template and the editable inside repeatable, you had to use repeatable region in some other way:
add only name of the folder as pure text-editable.

So, it would look like
Code: Select all
<div class="button-group js-radio-button-group" data-filter-group="area">
      <button class="button is-checked">Any</button>
          <cms:pages masterpage='frise.php'>
              <cms:show_repeatable 'my_repeatable' >
                  <button class="button" data-filter-min="<cms:show k_count />" data-filter-max="<cms:show k_count />"><cms:show simple_text_editable_for_area_name /></button>
              </cms:show_repeatable >
          </cms:pages>
</div>


The whole thing is to show you how to properly generate html with CMS. It will be very kind of you to let your client focus on managing things instead of coding them. Clients are not that tech-savvy. They do mistakes and typos in code, that's why people invented richtext editors and CMSs in the first place. Let everyone do their job, right? :)

Please let me know if any doubts.
Good example of using repeatable:
img-2016-04-03-17-23-50.png
how it looks on backend
img-2016-04-03-17-23-50.png (110.88 KiB) Viewed 1433 times

Note that we let admin only upload images and paste texts. The 'dirty work' is done by a programmer. Here is how it looks in html code:
Code: Select all
<div class="slider_wrapper">
               <div id="head_panel_slider" class="owl-carousel">
                        <cms:show_repeatable 'slider' >
                  <!-- ============================ SLIDE ==========================-->
                  <div class="stretchy-wrapper ratio_slider">
                     <div style="background-image: url(<cms:show slide_image />);"
                                 aria-hidden="true" class="item">
                        <div class="container">
                           <div class="caption caption-left caption-fancy">
                              <div class="inner
                                                    black_section
                                                    transparent-film
                                                    animated
                                                    bounceInUp
                                                    ">
                                 <div class="t1"><cms:show slide_t1 /></div>
                                 <div class="t2 uppercase"><cms:show slide_t2 /></div>
                                 <div class="t3 uppercase"><cms:show slide_t3 /></div>
                                 <p class="desc hidden-xxs"><cms:show slide_desc /></p>
                                            <a href="#" class="btn btn-primary">Learn more</a>
                              </div>
                           </div>
                        </div>
                     </div>
                  </div>
                  <!-- END========================= SLIDE ==========================-->
                        </cms:show_repeatable>   
               </div>
            </div>


I hope @tonjaggart is not hurt with an example from his project. :)

Sorry for abundance of posts and explanations.
Hope it helps, though :)
Hi
Thanks for all your help
I have now been able to do this using your suggestion

frise.php
---------------------------------------------------------------------
<?php require_once( 'couch/cms.php' ); ?>
<cms:template title='Areas' executable='0'>

<cms:editable
name='but7'
label='add/remove areas'
desc='copy and paste last line and change values to new area'
type='textarea' no_xss_check='1' />
</cms:template>
<?php COUCH::invoke(); ?>
----------------------------------------------------------------------

and putting this code where the buttons are in my html page in the snippets folder

-----------------------------------------------------------
<cms:pages masterpage='frise.php'>
<cms:show but7 />
</cms:pages>
------------------------------------------------------------

This lets my client change the html and, in doing so, add/remove/amend buttons

I know this goes against what I should really be doing as I'm letting the client amend the html code himslef, but in this case, my client needs to remove areas where he doesn't have properties and add in new areas where he gets new properties - possibly on a daily basis - so I don't think incrementing the number would work
Great to hear this!

Joel, please, where did you take the source isotope code? I'd like to see how pages are connected with areas.

So, if area is removed, then pages should not be displayed either (and vice-versa). I hope it all works for you perfectly now. But I'd like to suggest improvements, if you don't mind. Kinda gut feeling that the whole thing can be made simpler.
Hi
Here's the div that the isotope is in

<div id="filters" >
<div class="ui-group">
<h4>Area</h4>
<div class="button-group js-radio-button-group" data-filter-group="area">
<button class="button is-checked">Any</button>
<cms:pages masterpage='frise.php'>
<cms:show but7 />
</cms:pages>
</div>
</div>

<div class="ui-group">
<h4>Minimum number of Bedrooms</h4>
<div class="button-group js-radio-button-group" data-filter-group="beds">
<button class="button is-checked">Any</button>
<button class="button" data-filter-min="1">1</button>
<button class="button" data-filter-min="2">2</button>
<button class="button" data-filter-min="3">3</button>
<button class="button" data-filter-min="4">4</button>
<button class="button" data-filter-min="5">5</button>
</div>
</div>

<div class="ui-group">
<h4>Monthly Rent</h4>
<div class="button-group js-radio-button-group" data-filter-group="rent">
<button class="button is-checked">Any</button>
<button class="button" data-filter-min="100" data-filter-max="399">Under &pound;400</button>
<button class="button" data-filter-min="400" data-filter-max="499">&pound;400-&pound;499</button>
<button class="button" data-filter-min="500" data-filter-max="599">&pound;500-&pound;599</button>
<button class="button" data-filter-min="600">&pound;600+</button>
</div>
</div>
</div>

<div class="space"></div>

<div class="applied-filters"></div>

<div class="isotope" >

<style>
.isotope-itemx{
display:none
}
</style>

<!-- portfolio items start -->

<div class="image-boxes isotope-container row" style="display:block">

<cms:folders masterpage='propertytemplate.php'>
<cms:pages masterpage='propertytemplate.php' folder=k_folder_name>

<div class="col-md-3 col-sm-6 isotope-item<cms:show hideit />"
data-beds="<cms:show beds />"
data-area="<cms:show area />"
data-rent="<cms:show rent />">

<div class="image-box ">
div class="overlay-container">
<img src="<cms:show thumbimage />" alt="">
<div class="overlay">
<div class="overlay-links">
<a href="<cms:show k_page_link />"><i class="fa fa-link"></i></a>
</div>
<span><cms:show k_folder_title /></span>
</div>
</div>
<div class="image-box-body">
<h3 class="title">
<a href="<cms:show k_page_link />">
<cms:show k_page_title /><br>
<cms:show k_folder_title />
</a>
</h3>
<p><cms:show shortdescription /></p>
<a href="<cms:show k_page_link />" class="link"><span>Read More</span></a>
</div>
</div>
</div>
</cms:pages>
</cms:folders>
</div>
</div class=isotope>
</div>


To hide a listing, I've created a class - isotope-itemx, which hides the content.
I've got this in the template

<cms:editable
name='hideit'
label='Hide a listing'
desc='Enter x to hide - leave blank to show'
type='text'
/>

So if a property is to be hidden, my client puts an X in the hideit box and the class then becomes isotope-itemx instead of isotope-item, and is not displayed
15 posts Page 2 of 2