Forum for discussing general topics related to Couch.
7 posts Page 1 of 1
Hello, I have been through your tutorial on how to set up a site with CouchCMS (especially the blog section) and I see that you can manually create categories (in the form of 'folders') so the user can select one from the drop down menu in the admin pages, but I was wondering what I would need to do so the the user can create the own categories and then assign blog entries to them ...?

Is this possible ..?

Many thanks - Jack
The users should have access to the files in order to do that.
So just to confirm, the user has to edit the template files to add another category ..?
Hi

airboxmedia wrote: So just to confirm, the user has to edit the template files to add another category ..?


yes it is right now not possible to add categories from admin panel
you have to manually add them in the template.

regards
ARK
Thats a real shame as that is a requirement most users blogging require - Let's hope this is something that will happen in the future...
Hi airboxmedia,

The 'folders' in Couch are primarily meant to create SEO friendly urls (by mimicking real folders) although, of course, they can be used to categorize pages.
We are working on a 'tagging' module. That should give the users the ability to create categories (tags) on the fly. But this will have to wait for the next release.

For now, if creating folders on the fly is a deal-breaker, you can give the following hack a try.
Although I must warn you that this method will require your user to really know what he is doing else he can mess things up.

Suppose we have a template named 'blog.php'. The following is the portion of it where we define its folders -
Code: Select all
<cms:template title='Blog' clonable='1'>
    <cms:folder name='php' title='PHP' />
    <cms:folder name='html' title='HTML' />
    <cms:folder name='css' title='CSS' />
    <cms:folder name='javascript' title='Javascript' />/>" />
</cms:template>

As we have already admitted, the <cms:folder /> tag must be present in the template for the folders to be created. But instead of writing down the tags directly within the template itself, we can use an editable region to input the tags in and then use the contents of that editable region within 'blog.php' template.
This way, the user can edit (add, remove, modify) folders from within the admin-panel.

Create a new template (say, myfolders.php) that will define the editable region holding the folders tag -
Code: Select all
<?php require_once( 'couch/cms.php' ); ?>
<cms:template executable='0'>
    <cms:editable name='folders_code' type='textarea' no_xss_check='1' />
</cms:template>
<?php COUCH::invoke(); ?>

Notice how we are defining this template as non-executable because we do not want to access this from the browser via its URL. Its sole purpose is to create a textarea where we can input our code. Also notice how we use the no_xss_check='1'. Without this parameter, any '<' or '>' inputted will be sanitized thus rendering the inputted code invalid.

Within the editable region thus created, input the folders code -
folders_code2.gif
folders_code2.gif (4.93 KiB) Viewed 3550 times


Now modify the code within 'blog.php' to embed the contents of this editable region-
Code: Select all
<cms:template clonable='1'>
    <cms:embed code="<cms:get_custom_field 'folders_code' masterpage='myfolders.php' />" />
</cms:template>

With this setup, the user can edit the folder tags from within the admin panel to create new folders. Of course, he'll need to be logged in with the super-admin account for his changes to take effect.

I know, it is a hack but it might come in handy.
OK, that could work. I'll give it s try once my ISP installs IonCube...
7 posts Page 1 of 1

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