简体   繁体   中英

HitCounter results on another page

Page Hit Counter for EVO implemented... plugin

And this PHP snippet:

 <?php $prefix = $modx->dbConfig['table_prefix']; $page = ''; $page_id = isset($id) ? $id : $modx->documentObject['id']; $sql = "SELECT page_count FROM " .$prefix. "page_hit_counter WHERE page_id ='" .$page_id."'"; $rs = $modx->db->query($sql); $row = $modx->db->getRow($rs); $count = $modx->recordCount($rs); if ($count < 1) { $page .= "Page views: 0"; } else { $page .= "Page views: " . $row['page_count']; } return $page; ?> 

The counter works well for all pages.

Now I want to include the counts on a summary page as well.

For example... page 1 - counts 4 page 3 - counts 9 page 4 - counts 18

The summary page lists the title and introtext of all those three articles. Together with that I also want to show the page view counts.

So: Summary page: synopsis of page 1 (counts 4), synopsis of page 3 (counts 9), synopsis of page 4 (counts 18)

For this I have...

 <p><i class="fa fa-eye"></i>[~[+id+]~][!pageCount!]</p> 

But the output of that is only the title text + [!pageCount!] but no value.

I cannot understand why no value shows?

请使用pageCount代码段的id参数

class="fa fa-eye"></i>[~[+id+]~][!pageCount? &id=`[+id+]`!]</p>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM