Speil
Member
Hi, I'm trying to write my first add on to implement some queries in my board.
So I used the cmd.php to create a new addon mediabasar/dealstats. Inside the dealstats folder there are two files, addon.json and stats.php.
stats.php looks as the following:
In the statistic widget template I inserted {$totaldealsanzahl} but nothing is shown. Also nothing when using {$totaldeals|anzahl}
As I said, it's my first try to create an addon. Am I on the right path or do I get something completly wrong?
Do I need somewhere to add that the addon is initiated by pageload or will this be done automatically every time because the add on is "installed"?
thx
So I used the cmd.php to create a new addon mediabasar/dealstats. Inside the dealstats folder there are two files, addon.json and stats.php.
stats.php looks as the following:
PHP:
<?php
namespace mediabasar\dealstats;
$db = \XF::db();
use XF\Mvc\Entity\Entity;
class extension
{
$totaldeals = $this->db()->fetchAll("
SELECT count(listing_id) as anzahl
FROM xf_z61_classifieds_listing
WHERE listing_status like 'sold'
GROUP BY listing_status");
$totaldealsanzahl = $totaldeals['anzahl'];
}
?>
In the statistic widget template I inserted {$totaldealsanzahl} but nothing is shown. Also nothing when using {$totaldeals|anzahl}
As I said, it's my first try to create an addon. Am I on the right path or do I get something completly wrong?
Do I need somewhere to add that the addon is initiated by pageload or will this be done automatically every time because the add on is "installed"?
thx