Problems, need help? Have a tip or advice? Post it here.
5 posts Page 1 of 1
Hello, I have installed today tryout for couchCMS, and had twice the path problem, that I have solved (more or less accidentally), BUT would like to know why once the regular HTML way of writing paths was ok, and in another case not?
Would appreciate answer, below is explained what happened ( I have no knowledge in pho or anything except HTML/CSS)

i was following documentation, and first trouble was that I would get "fatal error" whenever I try to call blog.php from the browser...
it turned out, that i had to change path in <?php require_once( 'cms.php' ); ?> to <?php require_once( '../couchall/cms.php' ); ?>
, so to follow the path on my server...I wrote path as I do with HTML, going level down, and it worked...


another trouble i had when working with blog_list.html which I have moved to snippets folder inside the couch folder...I solved it as well, but only throug trial and error, and the path that is working sounds as blog_levels.html would be just one level outside Aurelius folder...
I would appreciate if anyone could explain this to me.
This is the file structure on my server

http://www.mydomain.com
->mycouch (folder containg original "couch" folder)
->->Aurelius (sample layout as in Documentation) )
->->couchall (CMS folder -here is config.php and all other files)
->->->snippets (folder)
->->->-> blog_list.html

Only when I changed pagemaster Tag path in the blog_list.html
from
<cms:pages masterpage='blog.php' >
to
<cms:pages masterpage='Aurelius/blog.php' >

did listing work.

Thanks in advance

Tanja
Hi Tanja,

First of all - welcome to our forums :)

Next coming to the problem you have - it seems the way you have installed Couch is not correct and that is causing all the problems.

Let us suppose this is your domain to begin with (no Couch here yet)
http://www.mydomain.com

If this site of yours were to host the Aurelius files, they would be present like this -
http://www.mydomain.com
-> blog.php
-> portfolio.php
-> contact.php


At this point suppose we add Couch to the mix, the proper way of doing so would be by placing the 'couch' folder (the one containing the config.php + all other Couch files) within the root of your site itself (at the same level as your existing files we mentioned above).
So now the structure becomes -
http://www.mydomain.com
-> couch (folder)(contains config.php + all couch files)
-> blog.php
-> portfolio.php
-> contact.php


The point is, we begin with an existing site and simply drop into it the 'couch' folder.
A file from your site above, say 'blog.php' can access couch by using
<?php require_once( 'couch/cms.php' ); ?>
which means "get 'cms.php' from folder 'couch' that is at the same level as me".

If suppose some files of the site lie, instead of directly within the root, in a subfolder e.g.
http://www.mydomain.com
-> couch (folder)
-> test (folder)
->->index.php
-> blog.php
-> portfolio.php
-> contact.php


We now have a template named 'index.php' that lies within a subfolder named 'test'.
To make this template Couch managed, we'll have to make a little change to the path because, obviously, couch folder is not at the same level as 'index.php' - it is a level up.
We have to add -
<?php require_once( '../couch/cms.php' ); ?>
which means "get 'cms.php' from folder 'couch' that is one level above me (i.e. at the level of my parent folder)".
Couch, in turn will recognize the name of this template as 'test/index.php' (which simply means that index,php is in a folder 'test' which is at the same level as 'couch').
The 'masterpage' attributes will also now need 'test/index.php' (the name of the template).

TIP: If in doubt about a template's name, hover your mouse above the template name in admin panel's sidebar. You'll see a tooltip showing the template's name.

I think the paths should now be clear now.

Let us now take a second look at your site's structure -
http://www.mydomain.com
->mycouch (folder containg original "couch" folder)
->->Aurelius (sample layout as in Documentation) )
->->couchall (CMS folder -here is config.php and all other files)
->->->snippets (folder)
->->->-> blog_list.html


The files that you are managing are within 'Aurelius' folder. We'll take the example of 'blog.php' within 'Aurelius folder. It can be accessed as
http://www.mydomain.com/mycouch/Aurelius/blog.php

The couch folder (you've renamed it to 'couchall') is NOT within Aurelius and hence not at the same level as 'blog.php'.
The right path will now be (as we discussed above)
<?php require_once( '../couchall/cms.php' ); ?>
(read it from 'blog.php' perspective - get 'cms.php' that is within a folder 'couchall' that in turn is at the level of my parent i.e.' Aurelius').
and the 'masterpage' attribute for 'blog.php' become 'aurelius/blog.php'
(read it from 'couchall' perspective - it says folder 'aurelius' at the same level as 'couchall' and then the file 'blog.php' within it).

Hope this helps. Do let me know.
Thank you very much for the explanation!
It helps a lot!
And you explain so fine...

If I may ask another question in this regard because I own two domains (and two different sites) that are on the same web space, and would like to manage both with Couch.

Before I go on, for clarity, here is the structure again:
/ (that is the highest level my provider allows me to access)
-> Maildir
->->www.my1domain.com
->->->myDataBase_Folder
->->www.my2domain.com


currently I tryout within http://www.my1domain.com

What do I do in order to manage the site within the other domain http://www.my2domain.com?

Should I manage it from the first domain, i.e. with Couch within http://www.my1domain.com?
Or do I install Couch separately on each Domain?

As I said, I have no idea about databases...but I see, when I create a Database on my webspace, it is always created within the 1st Domain....
If it is needed (or recommended) to install Couch for each Domain separately, guess would also need to specify the path to the database within installation?
With my current Couch installation writing there just "localhost" within

define ('K_DB_HOST', 'localhost')

did not work, I had to specify the number provided with MySQL-Host information.

(I have to talk yet to my provider, if it is possible to have that Database Folder also within the second domain - if that would be the solution)

I guess whatever the solution, it would apply also for eventual 3rd Domain?

Thanks again in advance, I really like CouchCMS...
It would be nice to have more Showcase Sites, to see what is all possible

Tanja
Hi Tanja,

I am glad I could help :)

Replying to your questions -
What do I do in order to manage the site within the other domain http://www.my2domain.com?

The answer here is simple because Couch offers no choice in this regard - you absolutely need to install Couch separately for each domain.

As for the database -
please allow me to use an analogy here for making this point clear.
Think about a database as a physical file.
Obviously one server can host several such 'files' (i.e. databases).
When you set
define ('K_DB_HOST', 'localhost')
to whatever value given by your provider, you are actually only indicating the 'server' the database 'files' are on.

To indicate the exact database 'file', you use this setting
define( 'K_DB_NAME', 'my_db_1' );

So if you have two installations of Couch, the database settings of both can have the same
define ('K_DB_HOST', 'localhost')
but usually the 'file' in which they store their stuff in will be different
e.g. domain1 could have
define( 'K_DB_NAME', 'my_db_1' );
while domain2 might have
define( 'K_DB_NAME', 'my_db_2' );

If you notice above. I said usually the files will be different. Because if you so choose to you can ask both the installations of Couch to use the same 'file' (database).
Obviously, if both are storing data in the same file, there needs to be some way to differentiate between their data.
That way is this setting in config.php -
// 7b.
// Needed only if multiple instances of this CMS are to be installed in the same database
// (please use only alphanumeric characters or underscore (NO hyphen) )

define( 'K_DB_TABLES_PREFIX', '' );

E.g. you can leave this setting blank for the first domain but for the second domain installation set it to -
define( 'K_DB_TABLES_PREFIX', 'domain2_' );
By doing this, the second Couch installation will store its data by adding this prefix 'domain2_' to the tables.
This way two Couch installations can use the same 'file' (database) but still keep track as to which data belongs to which installation.

Hope I was able to make myself understood :)
Thanks
Thanks a lot!
Yes, I can follow what you say. Your can explain things very well!!!


best regards

Tanja
5 posts Page 1 of 1