Forum for discussing general topics related to Couch.
3 posts Page 1 of 1
First of all I'd like to say that I love couchCMS, and I know my client will love the simplicity and elegance of the system once it's working. Bought a license before I even have it implemented. Great work.

So my site is basically programmed as a single file template system (index.php) with urls like "index.php?content=home", where the value of the content tag is used to then include a segment of content from a file such as "pages/home.html" (using a php include command). With my initial attempt at bringing couch into that system, regardless of which html file is pulled in for the content, Couch sees it as just the outer "index.php" file and creates a template for that page. If I put "<cms:template title=''" tags in multiple "pages", it works, but each time a new page is loaded it overwrites the name of the same template.

Is there an easy way to implement couch into the site as I've currently got things set up? Or am I going to have to change the setup so each page has it's own .php file? I'm thinking perhaps there some way I can pass an argument to Couch within this one PHP file (based on which page is being loaded) to coerce it into creating separate templates for each virtual page?

Not sure if it's important, but I use mod rewrite as well so the visible URL (to use the above example) would be "home.html", which then gets translated to index.php?content=home behind the scenes. I tried using couch's pretty URL system but it rewrote URL parameters in an ugly way, and the above problem still persisted.

Thanks!
Hello and welcome corelloman :)
Thank you very much for the kind words and for choosing to support Couch by getting its commercial license.

Coming to the problem you mentioned, Couch has been designed to be retrofitted into existing *static* sites (i.e. plain HTML/CSS/JS design). Your site, although it might not be a full fledged PHP application, nevertheless is structured around PHP - the index.php is acting like a front-page controller.

Therefore, to retrofit Couch into it will require restructuring the site to align with how Couch works. I'm really sorry but there is no straightforward way to preserve the way your site currently works.

.. regardless of which html file is pulled in for the content, Couch sees it as just the outer "index.php" file and creates a template for that page
Whether we access "index.php?content=home" or "index.php?content=blog", the PHP file being executed *is* 'index.php' and so that is the template Couch will create.

You mentioned that
the visible URL (to use the above example) would be "home.html"
That would be our starting point. Make a list of all such URLs your site has e.g. those could be
http://www.yoursite.com/
http://www.yoursite.com/home.html
http://www.yoursite.com/blog/
http://www.yoursite.com/blog/first-post.html
http://www.yoursite.com/blog/second-post.html
http://www.yoursite.com/contact.html
etc.

Markout which of the URLs will require their own discrete set of editable regions - for example in the URLs above, 'home', 'blog' and 'contact' seem to be the candidates. The 'blog/first-post.html' and 'blog/second-post.html' will require identical editable regions so we count them as one under the 'blog'.

For each of them create a separate PHP file in the root e.g. home.php, blog.php and contact.php (and one for 'http://www.yoursite.com/' - index.php).

Define the required editable regions in each. Make blog.php clonable.
Basically we are 'devolving' back your site to make it like ordinary HTML site where each section has its own HTML file.

Rest would be the standard way as described in our tutorial - http://www.couchcms.com/docs/tutorials/portfolio-site/

That said, I have a feeling that this kind of massive restructuring of your site would be not what you had in mind while choosing Couch but, I'm sure you'll understand, we cannot make two separate PHP applications co-exist with each other. Couch expects itself to be the only PHP code getting executed and so we need to make all those changes.

If you happen to feel Couch is not suited for your current project, feel free to let me know. PM me the details of your purchase and I'll refund the paid amount,

Thanks.
The more I thought about it I realized that you are correct, I'll just need to restructure my site into a template system where each page just imports the header and footer. I've used Perch before and I was thinking it would be a similar implementation. Not a big deal, should take me about an hour. :)

Thanks for all of the instructions here, incredible support! Can't wait to get it up and running. If I can't get it to work I do very much appreciate the willingness to refund the license purchase, that is awesome. Best of luck to you going forward KK, you've built an awesome tool here.
3 posts Page 1 of 1