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

Finally using couch cms, amazing cms system been dreaming for it for years. Thank you KK.

Have a site that has a multiple folders holding content pages e.g

/template/
*header.php
*footer.php

/products
/parts
*parts.php
/special
*special.php

/services
*services.php
/inhouse
*inhouse

All pages require header.php and footer.php. header includes css and js files which normally there links break when you go down the directory as they look in root folder and not global root.

When i use normal code i would have to create a front controller (which i never got to work) in order to get css, js and image files to reffer to the root directory.

What is the case for couchcms, is this taken iinto account? what is the best method for implementing a template website using this folder structure and including "header.php, footer.php" and other files without losing the path for css images js etc.

Also does couchcms keep the folder structure? which i would like. eg. http://www.website.com/products/parts/parts.php

can one also leave the pages as .php? or must they be changed to html? is there any circumstance where you would need to change it to html?

many thanks
Hello and welcome to our forums, apeccms :)
Thank you very much for those kind words. I'm glad you found our little CMS useful.

Replying to your queries (I'll reverse the order) -
1.
does couchcms keep the folder structure? which i would like. eg. http://www.website.com/products/parts/parts.php
You can have any folder structure you like. You'll have to modify the <?php require_once 'couch/cms.php'; ?> statement a little if a template does not reside in the root. Please see the following post where I've illustrated this point giving several examples -
viewtopic.php?p=17519#p17519

2.
All pages require header.php and footer.php. header includes css and js files which normally there links break when you go down the directory as they look in root folder and not global root
There are two parts to this question -

a. require header.php and footer.php
I suggest you use Couch's <cms:embed /> tag instead.
This tag always looks for the embedded files starting from the 'couch/snippets' folder (though you can change this location from the config file).

So, for example, if you place the header.php file within 'couch/snippets', the following statement will always find it no matter what the location of the template bearing the statement -
Code: Select all
<cms:embed 'header.php' />

b. css and js files which normally there links break
Now this is a HTML issue that one faces if the CSS/JS links are relative.
Simply make the links absolute by either prefixing them with a leading '/' or actually specifying the full URL to the files and you won't ever face this problem.

So, for example, if you have a statement like the following where the link is relative
<link href="css/lightbox.css" rel="stylesheet" />

make it as follows (notice the added leading slash)
<link href="/css/lightbox.css" rel="stylesheet" />

or better still, change it to this -
<link href="<cms:show k_site_link />css/lightbox.css" rel="stylesheet" />

Hope this answers all your queries.
yes you have sir.. once agin thank you so much. Will buy the licesnse version, in respect for what you have created here, finally not controlled by other full cms systems and can get on with life. looking forwarding watching the developments over the years. Thank you!

Is it hard to change over the files from free to licensed one?
You are welcome :)

Is it hard to change over the files from free to licensed one?
The only change needed would be to set the following in config file from '0' to '1'
define( 'K_PAID_LICENSE', 0 );
Sorry last question :? i will include the header and footer as you suggested. i have noticed that there is a clone page function. For the body/ main content of the page between the header and footer i have a standard template for each page. this is the file that will include the header and footer (with embed function). should i be using the clone fucntion to do this? Bearing in mind i require the url structure to stay, so the pages will be in diferent directorys as above in my example directory structure.

what is the best method of handling this using clone page?

Also should:
<?php require_once( 'couch/cms.php' ); ?>
and
<?php COUCH::invoke(); ?>

be placed on every page ei, header.php, footer.php and content.php?

In regards to this link viewtopic.php?p=17519#p17519 can we not do something like this; i have tried before but couldnt get it working, but was on the idea of setting up a config file with:
<?php
define("ROOT", __DIR__ ."/");
?>
then in the index:
include_once("config.php");
include_once (ROOT . "/template/header.php");

you should in theroy just be able to do:
include_once (ROOT . "/template/header.php");
in each template...

code worked on the same level of direcory, but could never get it to work down the nested folders. is something like this possible?

Whats the best way of testing locally? (im on linux)

thanks again.
or can we just use:

<?php require_once ($_SERVER['DOCUMENT_ROOT'].'/couch/cms.php'; ?>

instead of the above (using config file) or instead of having to keep adding ../../ eg.
<?php require_once '../../couch/cms.php'; ?>
Hi,

or can we just use:

<?php require_once ($_SERVER['DOCUMENT_ROOT'].'/couch/cms.php'; ?>
Feel free to use whatever suits you (so long as it works :) )

Replying to your other questions -
i have noticed that there is a clone page function. For the body/ main content of the page between the header and footer i have a standard template for each page. this is the file that will include the header and footer (with embed function). should i be using the clone fucntion to do this? Bearing in mind i require the url structure to stay, so the pages will be in diferent directorys as above in my example directory structure.

what is the best method of handling this using clone page?
To be honest, I am not sure if I understood you fully there.

Cloned pages apply to only discrete sections of your site e.g. blog, news, reviews, products etc. where all the sub-pages are identical in HTML structure and only differ in their own data (e.g. think about each blog post or news item or product page).

Stand-alone pages (e.g. contact, about-us etc.) don't need to be cloned as there woud only be one instance of them on the site.

Please use the info above to make your own decisions.

Also should:
<?php require_once( 'couch/cms.php' ); ?>
and
<?php COUCH::invoke(); ?>

be placed on every page ei, header.php, footer.php and content.php?

Those two lines need to be placed only in the templates that'll be accessed through browser by their names - for example, if 'content.php' is meant to be accessed as
http://www.yoursite.com/content.php
them this is your template and will need the two lines of PHP.

The 'header' and 'footer' files are only helper snippets and will never be accessed directly so won't need these lines (to reiterate - only the top level template will need those lines).

Whats the best way of testing locally? (im on linux)
You can use XAMPP or similar local stacks.

In closing, may I make a little recommendation?
Please try out our tutorial (http://www.couchcms.com/docs/tutorials/) first. It'll hand-hold you through the entire process of creating a full-fledged site. I'm sure you'll find it much easier to apply Couch to your own designs once you've completed that.

Thanks.
7 posts Page 1 of 1