Forum for discussing general topics related to Couch.
9 posts Page 1 of 1
Hey guys a question about how to put comment tags like you can in php /* */ within couch tags

Another question about why Couch adds lots of white space in html source when embeding a global file for example


Ty
Hello and welcome Ravindre,

Please see viewtopic.php?f=4&t=7223&p=9848 in regards to the whitespace.

I usually comment my code like so:
Code: Select all
<cms:hide><!-- Comment --></cms:hide>
Thanks for the response mate!
You'll be hearing more questions from me as soon i have them :P ty in advance.

Ah here is one for now,

regarding the k_template_name,

Code: Select all
<cms:if k_template_name=='en/index.php'>id="menuactive"</cms:if>


how can i format the 'en' in such a way that its a variable i tried different ways like echo or show or whatever that was coming to mind but it just doesnt work :(
Hi Ravindre,
how can i format the 'en' in such a way that its a variable i tried different ways like echo or show
The answer lies in the use of 'double-quotes' which then makes it possible to use code as parameter e.g.
suppose a variable named 'lang' contains the selected language (say 'en'), then the following statement
Code: Select all
<cms:if k_template_name=="<cms:show lang />/index.php">id="menuactive"</cms:if>
will evaluate to the following
Code: Select all
<cms:if k_template_name=="en/index.php">id="menuactive"</cms:if>

Notice how the <cms:show lang /> got evaluated to the value within the variable. This requires using double-quotes around the right-hand-side parameter.

You can find more info at http://www.couchcms.com/docs/concepts/s ... eters.html

Regarding your other question about arrays, I am sorry I couldn't get it completely.
Couch, per se, has no concept of arrays. If, however, you meant PHP array, we can use <cms:php> tag to run the PHP code.

Could you please let us know more about what you had in mind?

Thank you.
Hey KK,

First off double quotes works like a charm sorry for such a silly question but when i see you use single quotes in the tutorial i assume thats the only way i should write my code , but thanks for the lesson. Going to read the documents properly some day i just found about couch yesterday and i must say its not hard to learn once you get the hang of it no fuss no muss or as your slogan says not complicated.

Regarding the arrays i already figured it out i just had to use the global in each parent php tag I feel like such a dummy because i wasted hours on trying to make it work :lol:

Thank you so much and ill stay in touch with you guys when new questions arise.

Ravindre
Hey KK or any other topic reader out there :D,

got another question regarding editable areas if there is an condition to check weither the value inside typed by an user in the backend is > or < or <= etc i have read the documents but i could not quite follow as its talking about custom_field pages

Ty
All editable regions you define are 'custom fields' (the 'native fields' being the 'name', 'title', 'folder', 'date' etc, that you get without explicitly defining them).

So, coming to your question, what is the scenario like where you want to test an editable region's value?
Hey KK,

sorry if my question wasnt clear enough,

what i wanted to ask is, if there are conditional statements in the backend ergo the admin side to check if a value that is typed by an user or myself is for example not higher then the number 5 and if so throws in an error saying the number is higher then 5 just like the condition statement if a field is required.

Ah and another thing, is it normal for Couch to throw in exception errors on the first instance of creating an page that needs to retrieve values from the database, and when refreshed the errors are gone again as the values are now insterted properly in the database. ( sorry im not good with databases )

And another question :),

is it actually possible to add an editable field thru the admin? Let say i have a field called fruits
and it holds a value of 5 so i would get 5 editable fields and if changed to 10 fruits i would get 10 fields?

Ty


EDIT:

Hey KK,

already figured it out on my first question , wow man you guys really thought of everything you guys are awesome just to make sure i got it right i need you expert opinion on my regex

EDIT: Hey KK,

I cant seem to be able to use the OR( | ) operator in the preg_match I searched all over the place and i could not find something that works using it example for what i need the error i get using it is this : Warning: preg_match(): No ending delimiter '/' found , is this because maybe i need the preg_match_all which obviously isnt available, awaiting your anwer really wanna solve this, according to this website http://www.phpliveregex.com/ it should work so what am i doing wrong?

Ty

Code: Select all
regex=/[3-9]|[1][0]/




Code: Select all
<cms:editable name='carousel_slides' label='Slides Amount' maxlength='1' desc='Max: 5' group='carousel' order='0' validator='non_zero_integer | regex=/[2-5]$/' validator_msg='regex=Hold on buddy between 2 or 5!' type='text'>5</cms:editable>
Ravindre,

For the regex problem, please see the discussion under 'val_separator' heading of the page below
http://www.couchcms.com/docs/tags-reference/editable/

Hope this helps
9 posts Page 1 of 1
cron