Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- rankset плагин
- /*
- <?php
- $res = $modx->getObject('modResource', $modx->resourceIdentifier);
- $rank = $res->getTVValue('rank');
- $res->setTVValue('rank',$rank+1);
- */
- Event: OnLoadWebDocument:
- <?php
- $rank =$modx->resource->getTVValue('rank');
- $modx->resource->setTVValue('rank',$rank+1);
- snippet:
- <?php
- /*$tvs = $modx->getCollection('modTemplateVar', array('name' => 'rank'));
- $tvid=array_keys($tvs);
- $tvid=$tvid[0];
- $tvs = $modx->getCollection('modTemplateVarResource', array('tmplvarid' => $tvid));
- $sumrank=0;
- foreach ($tvs as $k => $tv) {
- $t= $tv->toArray();
- $sumrank+=$t['value'];
- }
- print "<pre>";
- print_r($sumrank);*/
- $user = $modx->user;
- $resources = $user->getMany('CreatedResources');
- foreach ($resources as $res) {
- $views = $views + $res->getTVValue('rank');
- }
- echo $views;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement