Module creation in GARS is actually VERY simple once you get your head around the framework. If you know a tad bit of HTML and a tad bit of PHP, obs your uncle and GARS is your friend.
In this Tutorial, Ill introduce you to making your own modules that allow you to easily grab extra data and display it. Please note that this is a bare bones example with little fluff designed to show you a BARE minimal approach.
It is also to try and help a user that was asking for this functionality
What Ill do is create a module that will allow users to select a rating for the imaginary 'movie' they are rating. In essence, all we will be doing is providing a combo box at edit/new thread time, capturing the input and then displaying the results when someone reads the entry.
Make sure you clean the input!
Here is the code in its entirety:
PHP Code:
<?php
if ($stage == "edit")
{
$output .= "Rating: <SELECT name=\"custom1[my_rating]\">
<OPTION value=\"G\">G - General Audiences</OPTION>
<OPTION value=\"PG\">PG - Parental Guidance</OPTION>
<OPTION value=\"PG13\">PG13 - Children under 13 are too cute for this movie</OPTION>
<OPTION value=\"R\">R - Under 17's not admitted without parents</OPTION>
<OPTION value=\"X\">X - It marks the spot</OPTION>
</SELECT>";
}
elseif($stage == "persist")
{
$my_rating = $this->vb->GPC['custom1']['my_rating'];
$values['my_rating'] = $my_rating;
}
elseif($stage == "display")
{
$title = "Rating";
$bits = "<tr><td class=\"alt1\" align=\"center\">" . $values['my_rating'] . "</td></tr>";
eval('$output.="' . fetch_template('GARS_mod_container') . '";');
}
?>
Now lets take it apart