Forum for discussing general topics related to Couch.
5 posts Page 1 of 1
Hi CouchCMS admin & users,

Can I check something, I think I understand that it doesn't work how I'd like which is fine but wanted to check.. Once the CMS is implemented to an editable region the data of the region is stored in the database. Is there a standard way on the developer end to update the original source php files when amendments are made through the CMS, other than manually? So that they are both in sync?

Thanks for any help, I'll be licensing in the next week regardless as it's been very simple to setup and use, but just wondered if anyone could give me any direction on keeping my source code correlated to the database other than manually (which wouldn't be ideal as I wouldn't know when amends are made..)

Any help appreciated!
Hi and welcome, @nila :)

I read and re-read your post but don't think that I could follow you completely, I'm afraid.

Is there a standard way on the developer end to update the original source php files when amendments are made through the CMS
The only amendments that one can make from the backend are into the editable regions defined. And whatever amendments you make in them are automatically reflected into your source code (i.e. contents from editable regions are dynamically injected into your source file every time the source file is accessed through the browser).

Is there any other kind of amendment you have in mind?
I request you to please elaborate on that a little more.

Thanks.
Hi KK,

Thanks for the reply, sorry it's my bad explaining. When my client makes an amend through the CMS it updates the content of the editable region that will display in a browser. But it doesn't update the data that was already within the editable section in my original .php file. I was wondering if there's any way to keep the content within the editable regions of my original .php files synced with the amends made to the database? I understand if not, I'm only just beginning to learn how the backend works! And let me know if I'm still not making sense!

Many thanks again :)
Hi @nila.

No, that's not the way it works. The editable regions are never updated in the php files at all. Data for editable regions are stored in the MYSQL database and it's only there that they ever change.

Let's say you have this static web page:
Code: Select all
<html>
    <body>
        Hello World!
    </body>
</html>

You Couchify it and make the text editable.
Code: Select all
<?php require_once( 'couch/cms.php' ); ?>
<html>
    <body>
        <cms:editable name='greeting' type='text'>Hello World!</cms:editable>
    </body>
</html>       
<?php COUCH::invoke(); ?>

What happens is that Couch creates a listing in the database and pre-populates it with the text inside the editable tags. Couch never looks at that text again. When it builds the page to show in the browser, it uses the text in the database, not what's in the php file. In fact, you can change or remove that text, and it will make no difference at all.

So there's no good way to update your php files and it's not really necessary. As you get more confident at using Couch, you'll probably stop putting the editable content in the php file at all.
Code: Select all
<?php require_once( 'couch/cms.php' ); ?>
<html>
    <body>
        <cms:editable name='greeting' type='text' />
    </body>
</html>       
<?php COUCH::invoke(); ?>

Now, if you want to keep your developer version synced with your client's live version, the way to do that is to download the client's MYSQL database and upload it to your developer site. But that's a little different from the question you were asking.
Hi Tim,

Thanks for the reply, I'm starting to get how it works in that sense now, thank you for clarifying. That's what I wanted to know, that there isn't a simple way, but like you say it's not really necessary and I suppose I wasn't seeing that. Understanding that I can just as well load it up empty and enter the data through the CMS makes it make much more sense, and I prefer that rather than redundant content in my php files. And backing up the MYSQL database to my development server makes sense also, kind of solving what I wanted in a different way. Thank you both again for your help :)
5 posts Page 1 of 1
cron