Forum for discussing general topics related to Couch.
8 posts Page 1 of 1
Hey guys,

is there a limiter you can put on how many rows can be created within repeatable regions?

EDIT:

And how to seperate editable fields within the repeatable area from languages as i want f.e. an editable field only to appear for the english version and not the dutch.

And how to pluck those values from the main language and pass them onto the other languages.

Ty
Hey guys already figured out on how to place an limit, thru the k_count however this is not what i wanted but it gets the job done, but it would be nicer to have the limit also in the admin side.

For the other questions im still puzzled.

Ty for the input
Hi Ravindre,

There is no admin-side check on the maximum number of rows permissible (for now, I am afraid).

And how to seperate editable fields within the repeatable area from languages as i want f.e. an editable field only to appear for the english version and not the dutch.

And how to pluck those values from the main language and pass them onto the other languages.

That really depends on how you have structured your site (i.e. how have you defined regions to be used with a particular language only).

Can you please post in your method of structuring the multi-lingual site?
That'll help us decide the answer to your query.

Thanks
Hey KK,

How my site is structured is by the normal SEO standard,

one root file for each language so :

index.php -> for redirection to my main language that being english
-en/index.php
-nl/index.php

I already achieved the results i wanted thru php arrays and seperating them with if statement like so :


Code: Select all
<cms:if lang=='en'>
<cms:editable name='carousel_img1' label='Slide 1 Image' group='carousel' order='4' required='1' show_preview='1' preview_width='250' type='image'/>
<cms:editable name='carousel_img2' label='Slide 2 Image' group='carousel' order='9' required='1' show_preview='1' preview_width='250' type='image' />
<cms:editable name='carousel_img3' label='Slide 3 Image' group='carousel' order='14' required='1' show_preview='1' preview_width='250' type='image' />
<cms:editable name='carousel_img4' label='Slide 4 Image' group='carousel' order='19' required='1' show_preview='1' preview_width='250' type='image' />
<cms:editable name='carousel_img5' label='Slide 5 Image' group='carousel' order='24' required='1' show_preview='1' preview_width='250' type='image' />

</cms:if>


So here were checking if the language is english if so i am able to edit the images as i dont want the images to be editable on all the languages and retrieve them like so :

Code: Select all
global $carousel_imgs;
$carousel_imgs = array(
1 => '<img src="<cms:get_custom_field 'carousel_img1' masterpage='en/index.php' />" alt="carouselimage1" />',
'<img src="<cms:get_custom_field 'carousel_img2' masterpage='en/index.php' />" alt="carouselimage2" />',
'<img src="<cms:get_custom_field 'carousel_img3' masterpage='en/index.php' />" alt="carouselimage3" />',
'<img src="<cms:get_custom_field 'carousel_img4' masterpage='en/index.php' />" alt="carouselimage4" />',
'<img src="<cms:get_custom_field 'carousel_img5' masterpage='en/index.php' />" alt="carouselimage5" />'
);


As this works perfectly for me, but i just found out about the repeatable tag and when i can do what i want with limits and language structuring what is able to edit and what not this allows me to get rid of pesky arrays :D. Not to mention a much less cluttered admin and cleaner code :)!

EDIT:

In this case i need it to be arrays btw since im injecting them into an javascript array but i use them all over the place where the repeatable region is a far better approach or even THE only approach to handle such a thing as the arrays arent dynamic and flexible etc.

Ty
Hey KK,

i think i may have found a solution!

Code: Select all
<cms:php>
global $test;
$test = array();
<cms:show_repeatable 'testemonial_list'>
   $test[<cms:show k_count />] = '<cms:show customer_quote />';
</cms:show_repeatable>

echo $test[1];
</cms:php>


Testing it properly right now :D feeling excited !

EDIT:

The above method works like a charm and allows for dynamic array creation yahoo! :D
Can't wait to see further improvements to the repeatable region tag as it has alot of potential and less human error prone, as its created dynamicly also removes the use of handcoding editable regions not to mention the ease of use.

Ty
Hi Ravindre,
I see that you are generating PHP dynamically using Couch :)

I suggest you make one little amendment to the code to make it bulletproof.
Please change the following -
Code: Select all
$test[<cms:show k_count />] = '<cms:show customer_quote />';

- to make it -
Code: Select all
$test[<cms:show k_count />] = '<cms:addslashes quote='single'><cms:show customer_quote /></cms:addslashes>';

This way even if the 'customer_code' text happens to contain a single-quote in it, the generated PHP will not result in invalid code.
Hey KK,

dynamic is the way to go to get rid of pesky handcoding :D , atleast when its not needed do so!

To the quote thing you mentioned i actually dont use the quote in the string itself, i make use of font icons to make it look nicer but none the less ty for the input i will remember it!

EDIT:

And when inserting data in the admin Couch does it job converting the quotes or whatever to proper HTML codes :
Code: Select all
&quot;
etc :)

Just wonderfull!

EDIT:

Even with no_xss_check on true it still works!

Even more wonderfull!

Ty
8 posts Page 1 of 1
cron