Forum for discussing general topics related to Couch.
8 posts Page 1 of 1
I've been through the docs and looked at cloned pages and repeatable regions and am still not sure what I need for a very simple requirement on a News page, so I hope someone can point me in the right direction...

I have an area on the page where I want to display news items, which consist very simply of a headline and a bit of body text, in date order - so the most recent at the top (each news item has an associated date, which is not necessarily when it is being entered into the system). I want to give a user with an access level below super admin (don't care what) the ability to create, update and delete these news items, ideally by entering values into a form with fields such as 'Headline', 'Text', 'Date'. Ideally I would like to be able to automatically use these items elsewhere on the site as well, in truncated form, with links to their full versions, although this is not so critical. The ability to filter by date is also necessary.
Hi!

Dates can be handled by setting whatever date in Advanced settings of clonable pages. If you run <cms:dump_all /> on a page, you'd notice that Couch provides multiple dates - creation, modification and a user-set date (set in backend or programmatically).

Excerpts of your news are handled by the corresponding tag excerpthtml, just like in second part of the blog tutorial. http://docs.couchcms.com/tutorials/port ... log-2.html

Next, managing of news by users can be done via 2 ways: by logging to admin panel as regular admin is the first one. The downside is ability to change anything else in backend too.

Second way is to implement an extended-users setup (details viewtopic.php?f=5&t=8581) and provide your registered users an application, with a separate backend tailored exclusively to functions you select for them, just like a member area. Downside is more programming, perks are independence of regular backend. A working example can be found here: http://www.couchcms.com/docs/advanced-t ... index.html
Join COUCH:TALK channel here https://t.me/couchcms_chat
Ryazania — a framework to boost productivity with Add-ons viewtopic.php?f=2&t=13475
Support my efforts to help the community https://boosty.to/trendo/donate
Thanks for that. So cloned pages is the way to go? I'll definitely take a look at the extended users stuff. I'm not at all put off by the prospect of more programming required, as I'm a programmer and am used to a high level of control.
Definitely. Going with separate clonable pages would allow you to use cms:archive, cms:calendar, unpublish-publish certain news articles, arrange by date, title or any other custom editable found in news template, also allow tagging, related news, votes, comments etc. Pretty powerful stuff :D
Johnny2R wrote: Thanks for that. So cloned pages is the way to go? I'll definitely take a look at the extended users stuff. I'm not at all put off by the prospect of more programming required, as I'm a programmer and am used to a high level of control.
Join COUCH:TALK channel here https://t.me/couchcms_chat
Ryazania — a framework to boost productivity with Add-ons viewtopic.php?f=2&t=13475
Support my efforts to help the community https://boosty.to/trendo/donate
So a follow-up to this...I am redoing an existing site, so can I somehow procedurally create cloned pages for a backlog of news items going back years, rather than having to manually create each one (which would be a nightmare)? I'm happy to do any requisite programming as long as the hooks are there.
It depends on the source format of your news. Had it been a CSV, you could use CSV reader/importer for Couch viewtopic.php?f=5&t=8803. If it's something else, then it's up to you to make sure the process is 'paginated' so the script processes gradually within its time-limits. If you get stucked, post you code and we'll gladly help you here.

Edit: the code, provided at link above uses tag db_persist which is crucial for editing or creating clonable pages automatically. Another good example of its use comes here viewtopic.php?f=4&t=10003&p=23356&hilit=db_persist#p23356 I think, it will be useful for you as it shows how to make data public between php and couch, and probably your script will employ some parts of it.

Johnny2R wrote: So a follow-up to this...I am redoing an existing site, so can I somehow procedurally create cloned pages for a backlog of news items going back years, rather than having to manually create each one (which would be a nightmare)? I'm happy to do any requisite programming as long as the hooks are there.
Join COUCH:TALK channel here https://t.me/couchcms_chat
Ryazania — a framework to boost productivity with Add-ons viewtopic.php?f=2&t=13475
Support my efforts to help the community https://boosty.to/trendo/donate
The source format can be anything it needs to be, fortunately, as I will write some code (with the Java scripting language Groovy, which is what I'm used to) to process the existing HTML. I could actually talk directly to the MySQL database with this method instead, but I suspect the inserts required would be quite complex, as there would be inserts into multiple tables with the requisite foreign keys, etc.
Fortunately, Couch handles all crud operations and maintains proper security checks, so we are left with the purpose of the task, leaving behind the multitude of byside operations.
Join COUCH:TALK channel here https://t.me/couchcms_chat
Ryazania — a framework to boost productivity with Add-ons viewtopic.php?f=2&t=13475
Support my efforts to help the community https://boosty.to/trendo/donate
8 posts Page 1 of 1