The vB Geek

Go Back   The vB Geek > vB Geek Modifications > Tutorials

Tutorials Tutorials and articles on using vB Geek stuff.

  Learn how to remove ads

Tutorial Tools Display Modes
GARS: Module making 102
GARS: Module making 102
Published by The Geek
Default Settings stage

The Settings stage is the stage that gets run when an admin views a module through the module set editor in their admincp. It allows you to capture settings specific to the module in the exact place of the module. This enables you to have the same module several times on the same page, but each one with its own unique settings.

Before I get started, its important to identify some KEY words that you DO NOT want to use in your modules as variables:

$settings - Holds your modules settings
$values - holds your modules values that the user entered
$itemid - The unique position for the module
$output - the output for the module
$vbphrase - vb's phrases

OK. That out of the way, lets look at what the hell im doing here. The goal is to allow the admin the ability to define their own selection of 'movie ratings' for the poster.

NOTE: All of vbulletins admin functions are usable here (which is what Im using)

First I start by defining a description row. This is good practice when making a module:

PHP Code:
print_description_row("This module will allow users to select a rating for the movie"); 
Though maybe not IDEAL, Im using two input boxes to allow them to enter in a comma seperated list of ratings, then of the descriptions.

I want to first see if any settings already exist. If not, I want to skip the processing of them. In the next section, you will see that I save the settings as an associative array called 'my_rating_settings'. Therefore if they have settings, it will be in the array as such:
PHP Code:
        if ($settings['my_rating_settings'])
If there are values, I 'break' them appart so its easier for the user to edit them:
PHP Code:
         foreach($settings['my_rating_settings'] as $key => $value)
             if (!
$keys ="$key";
$texts "$value";
$keys .=",$key";
$texts .= ",$value";
This leaves me with 2 variable: $keys and $texts that I can display to the admin:
PHP Code:
        print_input_row("Ratings:<dfn>Enter each rating letter seperated by a comma (i.e. G,PG,R)</dfn>""my_rating_keys[$itemid]"$keys);
print_input_row("Text:<dfn>Enter each rating description seperated by a comma (i.e. G - General,PG - Parental Guidance</dfn>""my_rating_text[$itemid]"$texts); 
Note that the element name is my_rating_keys[$itemid] and my_rating_text[$itemid].
PHP Code:
This guarantees that the settings here will be unique to ONLY this module.
Tutorial for


Tutorial Tools
Show Printable Version  Email this Page 

<<  <    Next Page: Persist Settings (Page 2 of 7)    >  >>

Tutorial Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Tutorial Tutorial Starter Category Comments Last Post
GARS: Module making 101 The Geek Tutorials 1 08-27-2008 10:01 AM
making a gab block for gars benj Geek Advertising Banner System 12 08-21-2006 08:42 AM
Does anyone have a GARS module that allows an image to be loaded in the module... FRAiD Geek Article and Review System 6 02-11-2006 09:57 AM
If I am using GARS for game reviews, and start making reviews and add new modules... FRAiD Geek Article and Review System 1 02-10-2006 04:57 PM
yes I know....another one making suggestions ;) effectica GeekMart 1 02-08-2006 06:05 PM

All times are GMT. The time now is 10:12 PM.

Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.

Tutorial powered by GARS 2.1.9 ©2005-2006