× Please submit new Bug Reports on GitHub: github.com/Jensen-Technologies/component-creator-issues/issues

Hits count

pred 9 rokmi 1 mesiacom #1057 od Juanjo vazquez real
Hits count bolo vytvorené Juanjo vazquez real
I am trying to create a counter for my items, I'm copying the system joomla articles but can not get a result, some I can lend a hand or guide me in what I'm doing mals, thanks
this in the file model.php
public function hit($pk = 0)
{
        $hitcount = JRequest::getInt('hitcount', 1);
        if ($hitcount)
        {
            // Initialise variables.
            $pk = (!empty($pk)) ? $pk : (int) $this->getState('Pelicula.id');
            $db = $this->getDbo();
            $db->setQuery(
                    'UPDATE #__todoelcine_peliculas' .
                    ' SET hits = hits + 1' .
                    ' WHERE id = '.(int) $pk
            );
            if (!$db->query()) {
                    $this->setError($db->getErrorMsg());
                    return false;
            }
        }
        return true;
}
this in the file view.html.php
$model = $this->getModel();
         $model->hit();


Prosím Prihlásiť alebo Registrácia pre zdieľanie konverzácie.

Čas vytvorenia stránky: 0.048 sekúnd
Funguje na Kunena fórum

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.