NoPic eZine
  
Home
Impressum/Imprint
Datenschutz/Policies
 
1.Issue 2006.06/1
 1.1.phpWebSite 1.0.0RC1 released
 1.2.Installing pWS 1.0.0rc1
 1.3.Running thru install
 1.4.First anonymous touch
 1.5.Exploring fallout surface inside
 1.6.Module substitution
 1.7.Directory Tree
 1.8.Database Tables
 1.9.ReadMe summary
   Access.txt
   bbcode.txt
   Cache_Lite.txt
   Categories.txt
   Clipboard.txt
   ControlPanel.txt
   Converting_Modules.txt
   Cookie.txt
   CREDITS.txt
   Database_Class.txt
   DB_Pager.txt
   Demographics.txt
   devdoc.modlayout.txt
   Developer_Rules.txt
   Editor.txt
   Forms.txt
   INSTALL.doc.txt
   Key.txt
   Known_Errors.txt
   Language.txt
   LICENSE.txt
   MiniAdmin.txt
   Mod_Rewrite.txt
   Module_Development.txt
   My_Page.txt
   README.doc.txt
   README.txt
   Related.txt
   Search.txt
   Settings_Class.txt
   SmartTags.txt
   Style_Format.txt
   template.txt
   Theme_Creation.txt
   Using_Javascript.txt
   Version.txt
   WYSIWYG.txt
 1.10.Using module WebPages
 1.11.Using module MenuManager
 1.12.Using webPages Editor
 1.13.Styling and Themes

    en

Related.txt

Use the Related Module
by Matthew McNaney

The Related module allows administrators to link information. Once one
or more items are linked, they will reference one another when either
is viewed.

Making your module work with the Related module is simple and
straightforward.

You should access the Related module when an individual item (an
article, an image, an event, etc.) is being viewed.

For example, we will access Related in a function named 'View';


if ($_REQUEST['action'] == 'view' && isset($_REQUEST['id']))
   view($_REQUEST['id']);

function view($id){

  $content = MyModule::viewItem($id);
  Layout::add($content);

}

First we create our related object:

$related = & new Related;

Next we need to plug-in imformation about our module:

/*-------------------------------------------------------------*/

$id = 5;
$title = "My module rules all!";
$url = "index.php?module=MyModule&action=view&id=$id";

$related->setMainId($id); // This is the id of our module's item
$related->setModule("MyModule"); // The name of your module

/**
 * You may have more than one item type in your module. If so, you can
 * name them separately. If you only have one item type, you don't need
 * to call this function.
 */
$related->setItemName("MyModule");

$related->setTitle($title); // This is the title to your item
$related->setUrl($url); // The relative address to the view function

/*-------------------------------------------------------------*/

After setting everything up, you can then call:

$related->show();

The Related module will take care of the rest.

There is one parameter you can add to the show function.
This paramter lets you restrict edit access. For example:

$allow = Current_User::allow("MyModule");
$related->show($allow);

If the user had permission to administrate your module, a TRUE value
would get passed to the show function and they would be able to create
related links. If it was FALSE, then they would be stuck with the
default view.

    en

Copyright © 2006, VbID Verlagsbüro GmbH
pWS modules dcP, dcT, dc4db, Copyright © 2006, VbID Verlagsbüro GmbH
This Site is powered by phpWebSite © The Web Technology Group, Appalachian State University