Coded something up in Couch in an interesting way? Have a snippet or shortcode to share? Post it here for the community to benefit.
18 posts Page 2 of 2
Hi @srewebso,

The cms:db_persist tag is part of the DataBound Form addon (http://www.couchcms.com/docs/concepts/d ... forms.html).

Before using it, you need to activate the addon first. Quoting from the docs -
To enable this module, please edit the 'kfunctions.php' file found in 'couch/addons' folder and uncomment (or add if upgrading from an older version) the following line

require_once( K_COUCH_DIR.'addons/data-bound-form/data-bound-form.php' );

Hope it helps.
Hello,

I instead use <cms:show page_hits/> to output page view count. However, as this appeared as editable region in the admin panel, I can edit my page count as many as I like. So how to make it non-editable, unchangable by cursor, in the admin panel? So I can see it in admin panel but it is not editable and changable by cursor.

Regarding this,
KK wrote: Before using it, you need to activate the addon first. Quoting from the docs -
To enable this module, please edit the 'kfunctions.php' file found in 'couch/addons' folder and uncomment (or add if upgrading from an older version) the following line

require_once( K_COUCH_DIR.'addons/data-bound-form/data-bound-form.php' );



I do not modify any codes inside kfunctions.example.php of Couch v2.0, but this just works. Still, do I need to modify the aforementioned requirement?
@atorui,

Hello.

I do not modify any codes inside kfunctions.example.php of Couch v2.0, but this just works. Still, do I need to modify the aforementioned requirement?
Couch v2.0 uses the databound component as its core (the entire admin-panel is built using it). So, for v2.0, there is no need to explicitly add it.

Replying to your other query -
So how to make it non-editable, unchangable by cursor, in the admin panel? So I can see it in admin panel but it is not editable and changable by cursor.
The post documenting v2.0 features (viewtopic.php?f=5&t=10241) has a complete section named "Customizing the Form screen" that discusses ways of doing this kind of tweaking. I suggest you please take a look at it.

In case you still need help, please try the following (keep it within your template's <cms:template> block) -
Code: Select all
<cms:config_form_view>
    <cms:field 'page_hits'>
        <cms:show page_hits />
    </cms:field>
</cms:config_form_view>

Hope it helps.
What about if we want to order most articles /day only, like Today's Popular. The page hits will reset to zero till the articles visited and count it all over again in the next day.

Its like top chart song or album. Please help if there is a way to do that.

Thank you
What do you intend to show at 00:01 in Today's Popular section? Will it require some threshold to achieve to become 'popular' or a single hit would automatically pop an item to that list?
trendoman wrote: What do you intend to show at 00:01 in Today's Popular section? Will it require some threshold to achieve to become 'popular' or a single hit would automatically pop an item to that list?


Its a list of cloned pages.

Example: 20 top songs.
Filter: Today, This week, This month and All the time.

and will be listed as popular by that day only (week,month, all the time), and the next (day week,month, all the time) will be change by most visited by users on the current time.

Sorry for my bad explanations :)
on the current time

Current time is different for various time zones. What's the plan then? If on Monday @ 00:00 the weekly hits get nullified and start over, some visitor from another part of the world, which still has Sunday - will see an empty list?

Perhaps, that user is to be showed the stats for the week he lives in, for you it will be the previous week. It would imply saving data for each day/week/month of the year. Is this correct?
trendoman wrote:
on the current time

Current time is different for various time zones. What's the plan then? If on Monday @ 00:00 the weekly hits get nullified and start over, some visitor from another part of the world, which still has Sunday - will see an empty list?

Perhaps, that user is to be showed the stats for the week he lives in, for you it will be the previous week. It would imply saving data for each day/week/month of the year. Is this correct?


Sorry for the late reply.

My time zone is GMT/UTC + 07:00 - Indonesian Time Zona.
Yes, correct trendoman as simple as that i just need to saving data for the current day, week and month.

Thankyou for the respond.
18 posts Page 2 of 2

Who is online

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

Users browsing this forum: No registered users and 3 guests

cron