Important announcements from CouchCMS team
32 posts Page 1 of 4
Hi Everybody :)

As you might have gathered from some of my recent posts, I've been in the process of preparing an advanced tutorial for quite some time.
It is, thankfully, finally complete now.

In many ways it is an ambitious venture as I've tried to push the envelope with Couch in this tutorial -
I've tried to implement a full-fledgded 'application' that usually otherwise requires the use of a PHP framework (like CodeIgnitor, Laravel etc.).

Couch, as you know, already had most of the components necessary to create applications - namely 'relations', 'frontend submissions (DataBound Form)', 'Extended users', an enhanced cms:pages for executing complex queries etc.

To tie these different components together into functional units that comprise an application, necessitated the addition of a new feature to Couch that is indispensable in any framework - Custom Routes.

You'll need to download the following minor version of Couch featuring custom routes to use it as a (simulated) framework, as in this tutorial.

UPDATE: 8 July 2015: This version of Couch has been promoted to become the release version 1.4.5 available from the main download page http://www.couchcms.com/products/

couchcms-1.4.5RC2.zip
(2.08 MiB) Downloaded 343 times

Before we embark on our advanced tutorial, please be sure to take a look at a concise documentation of the 'Custom Routes' feature (http://www.couchcms.com/docs/custom-routes/) as the tutorial makes heavy use of this feature.
*NOTE: A proper understanding of this tutorial will require familiarity with many of the advanced features of Couch.
If you are new to Couch, I'd suggest you please first start with our basic tutorial at http://www.couchcms.com/docs/tutorials/portfolio-site/

OK so with that caveat, here is the 'Advanced tutorial' -
http://www.couchcms.com/docs/advanced-tutorial/

Hope you find it useful.
As always, looking forward to your feedback :)
Finally KK bring the Bazookaaa!!! Wohoo!

Big Thx KK!

;)
As soon as possible!

Touch me up : abada[dot]zulma[at]gmail[dot]com
Thanks KK
As always, KK silently pushes an outstanding addon and makes us happy!)

Have just studied the tutorials and found great new for me features: page_exists, no_gui...
I think that a new 'filters' function is awesome, it makes users' rights handling more accurate than old methods like embedding snippets (<cms:embed 'authenticated' />) and becomes a very powerful feature in combination with Routes.
Routes now allow me to substitute old DataBound forms methods, and not spread between different templates, great.

To summarize Couch almost became as powerful as Yii, but much simpler and faster! I'm so disappointed that we use only Yii in my recent company, it's so trashy (if this word is existing in English) and slow...

But after reading I have also some questions...

1. Is it possible to make a delete callback? When use AJAX call to "http://mywebsite.com/blog/14/delete" could it answer smth "['status': 'deleted']"?

2. Is it possible to create with DataBound not pages, but folders? I suppose using regular Extended Folders functionality without related_pages suits this application nicely, too.

Thanks for these great features!
Thank you for appreciating the effort, friends :)

@Musman, I'm glad you are comparing Couch with Yii but, to be honest, Yii is in a different league altogether. Couch remains a humble little CMS and makes no pretensions of even trying to compete.

Replying to your query -
1. Is it possible to make a delete callback? When use AJAX call to "http://mywebsite.com/blog/14/delete" could it answer smth "['status': 'deleted']"?
That, as always, is totally at your discretion. The code in the tutorial redirects. You can make it send back the message instead.

2. Is it possible to create with DataBound not pages, but folders?
We can only work with pages using DBF. No folders for now, I'm afraid :)
How would one validate to check if the query parameter is one of the values of a checkbox editable?

I would like to create multiple list-views, essentially.

for example a url would be:

http://www.example.com/template/?checkbox=value

using the custom routes, I can set this up to output as: http://www.example.com/template/value

however, we must validate that the 'value' is actually one of the available values of the checkbox. This then allows upon page creation, any number of checkboxes from the editable to be selected, allowing the page to be listed in all of the list-views that it is checked to be in.

The problem is I'm unaware if there's any possible way to check that the /value param is one of the checkbox values, which means users could be typing /boobies which would break the template (there would be no list) as well as creating unwanted urls (they would be 404's if the validator works).

This new addition to couch makes it extremely more powerful than before, many web applications require more than the usual views in order to create layered templates.

Thanks

EDIT: On top of the above, can you think of an easy way to output the 'valid' URLs of a view? (specifically for sitemap purposes)
Image
Thanks!
About ajax call, let me specify the question... If user clicks <a href="http://mywebsite.com/blog/14/delete">del</a>, the route will redirect him back to "http://mywebsite.com/blog/" as in Tutorial. But if AJAX call is made, the route detects that it was AJAX post and instead of redirecting gives another logic, like answer "deleted". Is it possible to detect in Couch was the page accessed directly or via Post?
Also this behavior may be useful when you don't want to allow somebody access some URLs directly. Just use filters="ajaxpost" to detect if the page was accessed via AJAX, and if not, 404 is thrown. This approach is used in complex applications, where user should not be allowed to break a logic of your site and manually type URLs.

About creating folders - I just didn't test that, but aren't Extended addons make both-side interactions? When we create a new Dynamic folder, a similar page is created is assotiated template (folder_masterpage='portfolio-folders.php'), but when we create a page in "portfolio-folders.php", is a new Dynamic folder created?
If so, we could use all the potential of DBF for folders, too)

And about Yii, it is made for developers only, not for designers and frontenders. It loads a lot of dependencies and html templates that make the result code monstrous, so personally I when starting a project on Yii, first of all remove all the dependencies, scripts and templates to make it behave like Couch, in not-touching-frontend manner. So, in these cases, it definitely can be compared to Couch and in some points completely looses!
@Bartonsweb, while we can certainly loop through the valid values of checkboxes and compare it with the vaue supplied through the URL, I have a suggestion.

I think you should use 'relations' for your application.
Use a clonable template for the 'categories' and relate it with the pages of your other template.

This way you get the same functionality (still get checkboxes to choose from) and the code becomes more manageable and scalable (e.g. you can now use 'page_exists' to check for the category).

Think of it, by using the method I suggested you'd be using just a variation of the scenario in tutorial - the categories would be the 'pads' and the pages would be 'notes'. You can tweak the views to suit yourself.

can you think of an easy way to output the 'valid' URLs of a view? (specifically for sitemap purposes)
It is demonstrated in the tutorial. You can find details of the process here -
http://www.couchcms.com/docs/custom-routes/#gen-urls

Hope it helps.
@Musman

if AJAX call is made, the route detects that it was AJAX post and instead of redirecting gives another logic, like answer "deleted". Is it possible to detect in Couch was the page accessed directly or via Post?
Also this behavior may be useful when you don't want to allow somebody access some URLs directly. Just use filters="ajaxpost" to detect if the page was accessed via AJAX, and if not, 404 is thrown. This approach is used in complex applications, where user should not be allowed to break a logic of your site and manually type URLs.

I agree with you - we should have an easy way of detecting if the page was accessed using AJAX.

For now, please add the following to addons/kfunctions.php file -
Code: Select all
// define <cms:is_ajax /> tag (if a native version not available) 
if( !method_exists($TAGS, 'is_ajax') ){
    $FUNCS->register_tag( 'is_ajax', 'is_ajax_handler' );
   
    function is_ajax_handler( $params, $node ){
        if( !empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH'])=='xmlhttprequest' ){
            return '1';
        }
        return '0';
    }
}
That will make available a tag named cms:ajax that could be used as follows -
Code: Select all
<cms:if "<cms:is_ajax />">
    ..
</cms:if>

The release version of Couch will have this tag built-in so the code above first checks for a native version and registers the tag only when it doesn't find one.

Replying to your other query -
but aren't Extended addons make both-side interactions?
For now only extended-users addon works this way i.e. creating a user creates a cloned-page and, vice-versa, creating a cloned-page creates a user.

For extended-folders and extended-comments, it is still one-way i.e. creating a folder will create a page but this won't happen in reverse.

Hope this helps.
Yes, thank you!
That's exactly what I need.
32 posts Page 1 of 4

Who is online

In total there are 2 users online :: 0 registered, 0 hidden and 2 guests
(based on users active over the past 5 minutes)

Users browsing this forum: No registered users and 2 guests