how to create a joomla hit counter

how to create a joomla hit counter

4 years 1 day ago - 3 years 11 months ago #1087 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

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

The following user(s) said Thank You: Виталий

Please Log in or Create an account to join the conversation.

3 years 11 months ago #1088 by Andres Maeso

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.

This email address is being protected from spambots. You need JavaScript enabled to view it.

Please Log in or Create an account to join the conversation.

Time to create page: 0.192 seconds
Powered by Kunena Forum

We use cookies so that you can place orders and we can provide a better service. You can control the use of cookies at the individual browser level. If you reject cookies, you may still use our website, but your ability to use some features or areas of our website may be limited.