Forum for discussing general topics related to Couch.
10 posts Page 1 of 1
Hi,

I am looking to put all text in a seperate file so the template can be pure. I was hoping to put the text in a php file and list the text information into varibles.

can couchcms still pull this information into its backend (using its markup language), so it can be edited online, as you do with the regular way?

Thank you
Hi,

Not sure if I understood you there, apeccms.

Can you please post some concrete examples of how your system would ideally look like?
Thanks.
thank you,

Ok so a page will just have lots of includes, including other files and variables calling data from another file. That way i can keep changing layout and structure without having to modify every single page when i want to make a change.

ive used variables to automatically generate the pages data from just the filename so nothing needs to be edited in a template, and thinking of just making each page go and read from a master global template so when structure changes you dont even need to touch any of the other files, if the filename function still works.

Anyway, so couch cms will come into to play to manage the php files that contain the text for the given page: something like this.

<?php

$var1=" page tittle (or couchcms code)"
$var2=" subject";
$var3="long line of text and info";
$var4="more text";

?>

So all data/ text will be in the form of varibles, can the cms be integrated to manage the variable data?
Hi,

i managed to google a post where someone wanted to use edit arrays in php and you explained that php code gets executed before couchcms invokes, but you have made a tag that gets cms to invoke php instead.

should this same practice be used in this case to allow for what i want to do?

I have not installed cms yet, still finishing up structure and layout of site just want it to match what cms wants to do, so i dont waste time taking it somewhere, where its doesnt fit in with couchcms.

Thank you
@apeccms, From what I could gather, you are trying to retrofit Couch in an existing PHP application. I'm afraid, Couch is built primarily for static (i.e. plain HTML/JS/CSS) sites.

While it might be possible to use Couch the way you envisaged (if we give the use-case sufficient thought), the result could prove erratic.

So, I'd suggest you drop the idea of using Couch for this particular use-case as it is not suited for it.

Thanks.
Thanks for your response, cant drop couch, not now just found heaven. willing to compromise.

If i keep it simple and just get couch to invoke on the page that contains the variables will they appear in the back end of couch for online editing?
If i keep it simple and just get couch to invoke on the page that contains the variables will they appear in the back end of couch for online editing?
Sure. This is how you can use Couch's editable regions with PHP -
Suppose these are the regions defined in the template -
Code: Select all
<cms:template>
    <cms:editable name='my_title' type='text' />
    <cms:editable name='my_subject' type='text' />
    <cms:editable name='my_info' type='textarea' />
    <cms:editable name='my_more_text' type='richtext' />
</cms:template>

Please modify your PHP code from this -
Code: Select all
<?php 

$var1=" page tittle (or couchcms code)"
$var2=" subject";
$var3="long line of text and info";
$var4="more text";

?>

To this (note we are now using cms:php instead of <?php .. ?>-
Code: Select all
<cms:php>

$var1="<cms:show my_title />"
$var2="<cms:show my_subject />";
$var3="<cms:show my_info />";
$var4="<cms:show my_more_text />";

</cms:php>

The PHP variables can be referenced in PHP code anywhere else on the template like this (note you'll need to use 'global' -
Code: Select all
<cms:php>
    global $var1, $var2;
   
    echo( $var1 );
    echo( $var2 );

</cms:php>

Does this help?
very much big help will start merging my work into it see how far i go. Best thing is to start playing around now.

will it be easy to upgrade to newer versions? hoping old functions will remain the same, plus we get to add new tools code in?

rather wait for 1.5v if not.

Any idea when 1.5v will be complete sounds amazing. Sorry to ask.
will it be easy to upgrade to newer versions? hoping old functions will remain the same
Absolutely. One can still upgrade from Couch 1.0 to the latest version without breaking a thing.
amazing thank you so much, you done great things thank you again.
10 posts Page 1 of 1