Coded something up in Couch in an interesting way? Have a snippet or shortcode to share? Post it here for the community to benefit.
28 posts Page 3 of 3
I think I missed something... It frustrated me, because it is an easy hack. ;)

I will PM you, Kamran. Thanks!
Thanks Martijn. I had a look and this is what was going wrong -
Original code:
Code: Select all
<?
$folder = dirname(dirname(__FILE__));
require $folder.'/config.php';

Your server has the shorter variation of PHP opening tag (ie. <? instead of <?php) disabled.
Modified code:
Code: Select all
<?php
$folder = dirname(dirname(__FILE__));
require $folder.'/config.php';

Works now. Please confirm.
Thank you, Kamran! It works! Pfew. ;) Also thanks to LimeBlast for the hack ofcourse!

Was it easy for you to find the problem, Kamran? I don't think I could fix it by myself, I would never thought of a shorter variation of the PHP opening tag.
KK wrote: Your server has the shorter variation of PHP opening tag (ie. <? instead of <?php) disabled.

You know what, that is totally my bad. I'm normally very strict with myself about using <?php tags, exactly because of issues like this - I guess this must have slipped by.

I've updated the code on my site, hopefully this hack will now continue to work without any further issues. :)
KK wrote: Yes, I entirely get what you mean.
I'll definitely keep this approach in mind.
Thanks again.

Hi there - if/when you do do this, is there any chance that you could include the couch.lic file in this check?

I ask because, as it stands at the moment, my solution works just fine when using the free script, as soon as you need to add your own couch.lic file to the /couch/ directory, it screws up the whole submodule thing.

Cheers :)
I know this is already a while old, but this is a followup question that has the same base as the original.

I'm currently (just as the OP) using Couch as a Git Submodule, and now I'm trying to get a DataBound Form to work.

As in the documentation, I need to enable the modul in the kfunctions.php.

However this file is located inside the couch cms directories again and thus gives me a headache.
I tried including the kfunctions.php elsewhere (namely the config.php, which I already moved without issue), but that gave me a Fatal Error with this stacktrace:

Image

I looked into the header.php where the file is originally included and I saw that there is actually an alternate location already, namely the site root. If we could just configure a subfolder there, this would be really great.
I like to have one place where all the couch-related files are stored (couch_data in my root folder), it would be really handy to have another subfolder there (I believe it shouldn't be too difficult either, adding just another string concatenation :) ).

Any thoughts on this? Or is there maybe a reason this hasn't been done?
(I cannot edit the previous Post since this Forum is moderated, so please merge them if possible)

Of course we can always use the same method as used for the config before, with adding one more dirname call, but a native method should always be preferred I think, going around 3 loops to include a file probably isn't the most effective way of doing things :)

In my case the (ultimately complex) code looks like this:

Code: Select all
<?php
$folder = dirname(dirname(dirname(__FILE__)));
require $folder.'/couch_data/kfunctions.php';
?>


This works perfectly fine for me (and just as the OP I couldn't imagine any version or scenario why it wouldn't work)

I'm currently overhauling the build system of my CouchCMS driven site and am interested in this idea of using submodules. I am reasonably new to their use and so am reluctant to move from my, currently ridiculous, method of keeping couch up to date.

This is my current folder structure
Code: Select all
repo/
    | – .git/
    | – assets/ (holds customisations to couch)
        | – custom-addon/
            | – custom-addon.php
        | – config.php
    | – img/
    | – js/
    | – css/
    | – couch/
    | ...
CouchCMS/
    | – .git/
    | – addons/
    | – auth/
    | ...


The way my build system currently works is to first draw all of the files in from a sibling clone of CouchCMS and then perform various tasks on the imported files:
– Replace repo/couch/config.php with the edited one repo/assets/config.php
– Import custom addons from repo/assets/ and update repo/couch/addons/k_functions.php appropriately
– Change the k_max_upload_size inside repo/couch/includes/fileuploader/config.php
– Change max_file_size inside repo/couch/includes/pluploader/upload.php

Obviously, what would be nice is to have CouchCMS as a submodule and then simply rebase my changes on top when a new version comes out...if that is even possible.
28 posts Page 3 of 3