Forum for discussing general topics related to Couch.
3 posts Page 1 of 1
I try to make some Config File of my site, like any php script site.. but i try to GET, SET, GET_CUSTOM_FIELD, but i dont know what i am doing wrong.

you see...

I have 2 files

index.php

Code: Select all
<?php require_once( 'couch/cms.php' ); ?>

<cms:show my_message />

<?php COUCH::invoke(); ?>


---

config.php

Code: Select all
<?php require_once( 'couch/cms.php' ); ?>

<cms:set my_message='Salut!' />

<?php COUCH::invoke(); ?>


But i dont know how to include the config file.... :|

oh, annd how to make editable that config file? :roll:


Thanx :D
oh, annd how to make editable that config file? :roll:

The usual way:)
Define editable regions for the values you want the config file to contain. For example as follows in 'config.php' -
Code: Select all
<?php require_once( 'couch/cms.php' ); ?>

    <cms:template title='Config' executable='0'>
   
       <cms:editable name='my_message' label='Message' desc='Enter your message here' type='text' />
       
    </cms:template>

<?php COUCH::invoke(); ?>

But i dont know how to include the config file.... :|

Use either the cms:get_custom_field tag or the regular cms:pages tag. For example both of the following will work in ant template (index.php in your case) -
Code: Select all
<cms:get_custom_field 'my_message' masterpage='config.php' />

Code: Select all
<cms:pages masterpage='config.php' limit='1'>
    <cms:show my_message />
</cms:pages>

The trick in both the statements above is the 'masterpage' parameter that points to the config file.

Hope it helps.
PERFECT!

Thanks so much!
3 posts Page 1 of 1