modification module sites .. adding viewed x times

I was missing a view count in the sites module on the index page. So after a whole evening of looking in the code, i finally figured it out.

open unit.html

found at modules/boonex/sites/templates/base/unit.html

add

<span>__view_count__  views</span>

just below

<div class="bx_sites_unit_row bx_sites_unit_description">
<a href="__url__" class="link_site" target="_blank">__url_title__</a>&nbsp;&mdash;&nbsp;__description__
</div>

so it will look like this


<div class="bx_sites_unit_row bx_sites_unit_description">
<a href="__url__" class="link_site" target="_blank">__url_title__</a>&nbsp;&mdash;&nbsp;__description__
</div>
<span>__view_count__ views</span>

</div>

 

#############################################################

step #2

Open BxSitesSearchResult.php

found at modules/boonex/sites/classes/

find in the code :

'ownFields' => array('id', 'url', 'title', 'entryUri', 'description', 'photo', 'commentsCount',
'date', 'ownerid', 'categories', 'tags', 'rate'),

 

add 'views'

 

'ownFields' => array('id', 'url', 'title', 'entryUri', 'description', 'photo', 'commentsCount',
'date', 'ownerid', 'categories', 'views', 'tags', 'rate'),

 

#############################################################

step #3

open BxSitesTemplate.php

found at modules/boonex/sites/classes/

find:

$aResult = array(
'id' => $aData['id'],
'url' => $sUrl,
'url_title' => $this->_getDomain($sUrl),
'title' => $aData['title'],
'site_url' => BX_DOL_URL_ROOT . $this->_oConfig->getBaseUri() . 'view/' . $aData['entryUri'],
'description' => strip_tags($aData['description']),
'image' => $sImage ? $sImage : $this->getIconUrl('no-photo.png'),
'comments' => $aData['commentsCount'] . ' ' . _t('_bx_sites_unit_comments'),
'date' => strtolower(defineTimeInterval($aData['date'])),
'owner_str' => _t('_bx_sites_unit_from') . ' ',
'spacer' => getTemplateIcon('spacer.gif'),
'cats_str' => _t('_Categories') . ':',
'cats' => $this->parseCategories($aData['categories']),
'tags_str' => _t('_Tags') . ':',
'tags' => $this->parseTags($aData['tags']),
);

 

add             'view_count' => $aData['views']

 

$aResult = array(
'id' => $aData['id'],
'url' => $sUrl,
'url_title' => $this->_getDomain($sUrl),
'title' => $aData['title'],
'site_url' => BX_DOL_URL_ROOT . $this->_oConfig->getBaseUri() . 'view/' . $aData['entryUri'],
'description' => strip_tags($aData['description']),
'image' => $sImage ? $sImage : $this->getIconUrl('no-photo.png'),
'comments' => $aData['commentsCount'] . ' ' . _t('_bx_sites_unit_comments'),
'date' => strtolower(defineTimeInterval($aData['date'])),
'owner_str' => _t('_bx_sites_unit_from') . ' ',
'spacer' => getTemplateIcon('spacer.gif'),
'cats_str' => _t('_Categories') . ':',
'cats' => $this->parseCategories($aData['categories']),
'tags_str' => _t('_Tags') . ':',
'tags' => $this->parseTags($aData['tags']),
'view_count' => $aData['views']
);

 

code is as is. have fun!

Quote · 2 Apr 2011
 
 
Below is the legacy version of the Boonex site, maintained for Dolphin.Pro 7.x support.
The new Dolphin solution is powered by UNA Community Management System.