how to create a joomla hit counter
Juanjo vazquez real
New Member
Posts: 9
9 年 1 周 前 - 9 年 1 周 前 #1087
由 Juanjo vazquez real
how to create a joomla hit counter was created by Juanjo vazquez real
Hello
I finally managed to go well field hits, I will explain as e echo if anyone serves.
We must create a field hits, type TINYINT (11) in our table
Once we have our component in part site / models in our archive item.php add:
within the model class
then in site / item / view file view.html.php
we add this code within the function display
I hope this helps someone
I finally managed to go well field hits, I will explain as e echo if anyone serves.
We must create a field hits, type TINYINT (11) in our table
Once we have our component in part site / models in our archive item.php add:
within the model class
public function hit($id = null)
{
if (empty($id)) {
$id = $this->getState('item.id');// item is the name of our item
}
$item = $this->getTable();
return $item->hit($id);
}
then in site / item / view file view.html.php
we add this code within the function display
$model = $this->getModel();
$model->hit();
I hope this helps someone
Last edit: 9 年 1 周 前 by Juanjo vazquez real.
The following user(s) said Thank You: Виталий
Please 登录 或 注册一个帐号 to join the conversation.
Andres Maeso
Platinum Member
Posts: 338
9 年 1 周 前 #1088
由 Andres Maeso
Andrés Maeso
Customer relations manager at Joomla Component Creator.
该邮件地址已受到反垃圾邮件插件保护。要显示它需要在浏览器中启用 JavaScript。
Replied by Andres Maeso on topic Hits
Thanks Juanjo. Do you mind if I rename it like "how to create a joomla hit counter"?
Andrés Maeso
Customer relations manager at Joomla Component Creator.
该邮件地址已受到反垃圾邮件插件保护。要显示它需要在浏览器中启用 JavaScript。
Please 登录 或 注册一个帐号 to join the conversation.
创建页面时间:0.051秒