View Full Version : Where to get answers?
sifuhall
07-19-2011, 05:36 PM
I am a new user of Vivvo and am trying to learn plugin and module creation.
I have questions about this type of developemt that are not support related so opening a support ticket is not the correct avenue to get the answers I am looking for.
It also appears this forum is not a good place for Vivvo questions either.
For example, I have made 5 or so questions here so far and have only received 1 answer.
Perhaps I am not putting enough detail in my questions or perhaps they are in the wrong forums. If so I would really appreciate someone letting me know.
Perhaps there a better site or location on this site to post my development related questions?
If not, what is the best way to go about asking non-support related questions in hopes of getting information?
I really appreciate any guidance on this.
bobster65
07-19-2011, 06:03 PM
One of the best ways to learn is to simply reverse engineer a plugin that is similar to what you want to do.
One of the best ones to learn off of is the Reviews Plugin. Geo Position is another good one to take a look at since it also uses an external data provider (google Maps).
There are some PDF docs on Module Development that are pretty helpful. They are written as tutorials with example code.
Developing Modules Primers (has 2 php files and an SQL file)
Vivvo Framework Datasheet (PDF)
Developing Modules (PDF)
sifuhall
07-19-2011, 06:07 PM
Thank you, bobster.
I have read those PDF files but I have concerns if they are still up to date.
For example,
In the developing modules PDF the class line extends module.
class box_hello extends module {
but some of the existing plugins I am trying to learn from extend plugin_module
extends plugin_module
are both correct?
bobster65
07-19-2011, 06:45 PM
they are both correct and used for different purposes. One is used for the plug in system and the other just for modules that are not "addons" .. ie, just modules that you can call within templates.. for example..
Here is a class that extends module ...
class box_bf_estimated_amount extends module {
public $_default_template_file = 'system/box_default/box_bf_estimated_amount.tpl';
private static $db;
public function __construct(&$site_manager, $params, $parent_template = NULL, $cache = true, $output = true) {
if ( !isset(self::$db) ) {
self::$db = mysql_connect('localhost', 'xxUxx', 'xxPWxx');
mysql_select_db('bf_vcms', self::$db);
}
parent::module($site_manager, $params, $parent_template, $cache, $output);
}
public function generate_output($params = array()) {
$this->set_template($params);
if ( isset($params['search_id']) ) {
$where = $params['search_id'];
}
$day = date("d");
if($day>=6){
$date2 = date("m/t/Y", strtotime("last month"));
}
else{
$date2 = date("m/t/Y", strtotime("-2 month"));
}
$date2 = split("/",$date2);
$query = 'SELECT date_earned,commission_amount FROM commission WHERE bf_member = "'.$where.'" AND status = "pending"';
if ( $result = mysql_query($query, self::$db) ) {
$due_val = 0;
while ( ( $row = mysql_fetch_assoc($result) ) !== false ) {
$date = split("/",$row['date_earned']);
if($date[2]==$date2[2]){
if($date[0]==$date2[0]){
if(settype($date[1],"integer")>=1 and $date[1]<=$date2[1])
$due_val += $row['commission_amount'];
}
}
}
$this->_template->assign('due_val', $due_val);
}
}
}
and here it is used in a template..
<vte:box module="box_bf_estimated_amount">
<vte:params>
<vte:param name="search_id" value="{CURRENT_USER.username}" />
</vte:params>
<vte:template>
<tr>
<td>Estimated Amount:</td>
<td>$<vte:value select="{due_val|money_format:'%i'}" /></td>
</tr>
</vte:template>
</vte:box>
sifuhall
07-19-2011, 06:48 PM
Thank you very much, bobster65!
vBulletin® v3.8.4, Copyright ©2000-2012, Jelsoft Enterprises Ltd.