by
cl » Thu Mar 18, 2021 3:20 pm
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?