Forum for discussing general topics related to Couch.
3 posts Page 1 of 1
hi,

i'm wondering if couch cms has a way to handle string manipulation in a variable.

for example i would like to turn the value of k_template_name: my-cool-page.php into: my-cool-page
notice the file extension is dropped.
Hi,

We can always fall back upon PHP for functionality that is not available in Couch.
For example, any of the following two methods can be used to strip off the '.php' from the template names:
Code: Select all
<cms:php>echo substr( '<cms:show k_template_name />', 0, strrpos('<cms:show k_template_name />', '.') );</cms:php>

Code: Select all
<cms:php>echo preg_replace( '/\.[^.]*$/', '', '<cms:show k_template_name />' );</cms:php>

Hope this helps.
thanx for the tip! works great!
3 posts Page 1 of 1
cron