Coded something up in Couch in an interesting way? Have a snippet or shortcode to share? Post it here for the community to benefit.
29 posts Page 3 of 3
Thanks for the speedy reply and eliminating one possibility. Will give it another go.

Sorted.
<cms:pages masterpage='mini-events.php' show_future_entries='1' orderby='page_hits' limit='100'>
Hi there, ist there any chance to make this work for folder views too. I'm trying to count gallerie views. I placed the page_hits in the globals.

Code: Select all
<cms:globals>
<cms:editable label='Seitenaufrufe' desc='zählt automatisch'  name='page_hits' type='text' search_type='integer'  order='10' group='seo'/>
<cms:config_form_view>
    <cms:field 'page_hits'>
        <cms:show page_hits />
    </cms:field>
</cms:config_form_view>
</cms:globals>


and then i tried on on page load:

Code: Select all

<cms:if k_is_folder>

        <cms:no_cache />

        <cms:php>
            // identify bots
            global $CTX;
            if( isset($_SERVER['HTTP_USER_AGENT']) && preg_match('/bot|crawl|slurp|spider/i', $_SERVER['HTTP_USER_AGENT']) ){
            $CTX->set( 'is_bot', '1', 'global' );
            }
        </cms:php>

        <cms:if "<cms:not is_bot />">
            <cms:db_persist _masterpage=k_template_name _folder_id=k_folder_id _mode='edit' page_hits="<cms:add_globals page_hits '1' />" />
        </cms:if>
    </cms:if>



But it looks like there is no option to "cms:add_globals"
is there a way to achieve this?
@cl, perhaps the following would help? -
viewtopic.php?f=5&t=11105&start=60#p33131

Do let me know.
Yes, it helped.Thank you!
I have problem with Most viewed articles (page-hits counter). It's always count two (2) hits in every page refresh.
How to solve this problem?

Here's the video of refresh page: https://jmp.sh/s/OYLI1TxEQrlbzsB0jQxb

Thanks.
Perhaps, with pretty-urls ON there is a second quick redirect happening (or some other code triggers another redirect). Try to disable pretty urls temporarily and check if the counter increments by 1.

setiawanfarlin wrote: I have problem with Most viewed articles (page-hits counter). It's always count two (2) hits in every page refresh.
How to solve this problem?

Here's the video of refresh page: https://jmp.sh/s/OYLI1TxEQrlbzsB0jQxb

Thanks.
trendoman wrote: Perhaps, with pretty-urls ON there is a second quick redirect happening (or some other code triggers another redirect). Try to disable pretty urls temporarily and check if the counter increments by 1.

setiawanfarlin wrote: I have problem with Most viewed articles (page-hits counter). It's always count two (2) hits in every page refresh.
How to solve this problem?

Here's the video of refresh page: https://jmp.sh/s/OYLI1TxEQrlbzsB0jQxb

Thanks.


Hi Trendoman, Thank you for your feedback.

Still no luck. I have disable the Pretty URLS and still counting two times.
setiawanfarlin wrote:
trendoman wrote: Perhaps, with pretty-urls ON there is a second quick redirect happening (or some other code triggers another redirect). Try to disable pretty urls temporarily and check if the counter increments by 1.

setiawanfarlin wrote: I have problem with Most viewed articles (page-hits counter). It's always count two (2) hits in every page refresh.
How to solve this problem?

Here's the video of refresh page: https://jmp.sh/s/OYLI1TxEQrlbzsB0jQxb

Thanks.


Hi Trendoman, Thank you for your feedback.

Still no luck. I have disable the Pretty URLS and still counting two times.


Ask @KK for a code review. It may be anything else, including multi-lang addon which does extra redirect (to put lc into url).
setiawanfarlin wrote: Hi Trendoman, Thank you for your feedback.

Still no luck. I have disable the Pretty URLS and still counting two times.


Ask @KK for a code review. It may be anything else, including multi-lang addon which does extra redirect (to put lc into url).[/quote]

Thanks @trendoman.

Hi, @KK.

Maybe i need your help for this. I have problem with Most viewed articles (page-hits counter). It's always count two (2) hits in every page refresh.

Thank you.
29 posts Page 3 of 3
cron