|
From: <ch...@us...> - 2007-02-21 10:06:45
|
Revision: 9089
http://zaf.svn.sourceforge.net/zaf/?rev=9089&view=rev
Author: charlvn
Date: 2007-02-21 02:06:41 -0800 (Wed, 21 Feb 2007)
Log Message:
-----------
Added Joomla Random Item Module
Added Paths:
-----------
trunk/web/mod_randitem/
trunk/web/mod_randitem/mod_randitem.php
trunk/web/mod_randitem/mod_randitem.xml
Added: trunk/web/mod_randitem/mod_randitem.php
===================================================================
--- trunk/web/mod_randitem/mod_randitem.php (rev 0)
+++ trunk/web/mod_randitem/mod_randitem.php 2007-02-21 10:06:41 UTC (rev 9089)
@@ -0,0 +1,32 @@
+<?php
+ /**
+ * This module displays a random item from a content section.
+ * @author Charl van Niekerk
+ * @version 2007-02-21
+ * @copyright 2006 - 2007 Translate.org.za
+ * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License
+ */
+
+ // Make sure the file is being included through Joomla and not called directly.
+ defined("_VALID_MOS") or die("Restricted access");
+
+ // Retrieve some parameters
+ $class = $params->get("moduleclass");
+ $menuid = $params->get("menuid");
+ $moretext = $params->get("moretext");
+ $sectionid = $params->get("sectionid");
+
+ // Retrieve one item in the specified section randomly from the content table
+ $sectionidSlashed = addslashes($sectionid);
+ $database->setQuery("SELECT id, title, introtext FROM #__content WHERE sectionid = '$sectionidSlashed' ORDER BY RAND() LIMIT 1");
+
+ // Somehow loadObject causes problems with Joomlfish; this is a workaround.
+ $items = $database->loadObjectList();
+ $item = $items[0];
+?>
+
+<div class="<?php echo $class ?>">
+ <p><a href="/content/view/<?php echo $item->id ?>/<?php echo $menuid ?>"><?php echo $item->title ?></a></p>
+ <?php echo $item->introtext ?>
+ <p><a href="/content/section/<?php echo $sectionid ?>/<?php echo $menuid ?>"><?php echo $moretext ?></a></p>
+</div>
\ No newline at end of file
Property changes on: trunk/web/mod_randitem/mod_randitem.php
___________________________________________________________________
Name: svn:executable
+ *
Added: trunk/web/mod_randitem/mod_randitem.xml
===================================================================
--- trunk/web/mod_randitem/mod_randitem.xml (rev 0)
+++ trunk/web/mod_randitem/mod_randitem.xml 2007-02-21 10:06:41 UTC (rev 9089)
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<mosinstall type="module" version="1.0.0">
+ <name>Random Content Item</name>
+ <author>Charl van Niekerk</author>
+ <creationDate>August 2006</creationDate>
+ <copyright>(c) 2006 - 2007 Translate.org.za</copyright>
+ <license>http://www.gnu.org/copyleft/gpl.html GNU General Public License</license>
+ <authorEmail>ch...@ch...</authorEmail>
+ <authorUrl>charlvn.za.net</authorUrl>
+ <version>1.0.0</version>
+ <description>Displays a random item from a content section.</description>
+ <files>
+ <filename module="mod_randitem">mod_randitem.php</filename>
+ </files>
+ <params>
+ <param name="moduleclass" type="text" default="randitem" label="Module Class" description="The XHTML class this module belongs to." />
+ <param name="sectionid" type="text" default="" label="Section ID" description="The ID of the relevant content section." />
+ <param name="menuid" type="text" default="" label="Menu ID" description="The ID of the relevant menu item." />
+ <param name="moretext" type="text" default="More" label="More Text" description="The text for the more items link." />
+ </params>
+</mosinstall>
\ No newline at end of file
Property changes on: trunk/web/mod_randitem/mod_randitem.xml
___________________________________________________________________
Name: svn:executable
+ *
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|