You are missing our premiere tool bar navigation system! Register and use it for FREE!

NukeCops  
•  Home •  Downloads •  Gallery •  Your Account •  Forums • 
Readme First
- Readme First! -

Read and follow the rules, otherwise your posts will be closed
Modules
· Home
· FAQ
· Buy a Theme
· Advertising
· AvantGo
· Bookmarks
· Columbia
· Community
· Donations
· Downloads
· Feedback
· Forums
· PHP-Nuke HOWTO
· Private Messages
· Search
· Statistics
· Stories Archive
· Submit News
· Surveys
· Theme Gallery
· Top
· Topics
· Your Account
Who's Online
There are currently, 329 guest(s) and 0 member(s) that are online.

You are Anonymous user. You can register for free by clicking here
Simple module block

17.2.1. Simple module block

The links that are inside the standard PHP-Nuke module block are constructed dynamically, using information that is available about the modules in the database. For example, to present only active modules in the links, the block (located in blocks/block-Modules.php) checks the "active" field of the $prefix_modules table (which is table nuke_modules, if $prefix is left to the standard "nuke" in config.php, see Section 3.7):

$sql = "SELECT title, custom_title FROM ".$prefix."_modules 
WHERE active='1' AND inmenu='0' ORDER BY title ASC"; 

As we can easily read in the SELECT query above, only modules with the "active" bit set to 1 are selected. But we also see that the order in which they are selected is the standard ascending lexicographic order of the modules' title (ORDER BY title ASC). If we wish a different ordering, we are left with only a few possibilities:

  • Change the order from ascending (ASC) to descending (DESC):

    $sql = "SELECT title, custom_title FROM ".$prefix."_modules 
    WHERE active='1' AND inmenu='0' ORDER BY title DESC"; 
    
  • Change the field on which the ORDER BY clause is applied, e.g. use custom_title instead of title:

    $sql = "SELECT title, custom_title FROM ".$prefix."_modules 
    WHERE active='1' AND inmenu='0' ORDER BY custom_title ASC"; 
    
  • Add an extra field to the $prefix_modules table, populate it with custom values (e.g. "1" for the module we want to be the first in the list, , "2" for the second, "3" for the third etc. if we decided to use a numeric field ) for each module, and sort in ascending order of this new field:

    $sql = "SELECT title, custom_title FROM ".$prefix."_modules 
    WHERE active='1' AND inmenu='0' ORDER BY new_field ASC";
    

But if we wish a custom grouping of the modules links, we will have to write our own modules block. You can use the following code as a starting point for your own creations. This script will display certain links only when an admin or user is logged in. Just name it block-menuSample.php and put in the blocks folder, deactivate the block-Modules.php and activate this one (see Different links - some for registered users only and How would I add a clickable link in a Modules Block?):

<?php
if (eregi("block-menuSample.php",$PHP_SELF)) {
Header("Location: index.php");  
die(); 
}
Global $user, $admin; 
$title = "Main Menu";
$content = "
<font size=\"1\" face=\"Verdana, Arial, Helvetica, sans-serif\">
<B><u>Navigation</u>
<BR> 
<STRONG><BIG>·</BIG></STRONG> 
<a href=index.php>Start Page</a><br><br>
<u>Information</u><BR>
<STRONG><BIG>·</BIG></STRONG> 
<A href=\"modules.php?name=News&file=index\">News</A><BR>
<STRONG><BIG>·</BIG></STRONG>
<A href=\"modules.php?name=aboutus\">About us</A><BR>
<STRONG><BIG>·</BIG></STRONG>
<A href=\"modules.php?name=somefolder&file=index\">Entry with Some word</A><BR>
<BR>
<u>Other things</u>
<BR>
<STRONG><BIG>·</BIG></STRONG>
<A href=\"links.html
&amp;file=index&amp;l_op=viewlink&amp;cid=1\">Links</A><BR>
<STRONG><BIG>·</BIG></STRONG>
<A href=\"modules.php?name=My_eGallery\">All sorts of Pictures</A><br>
<STRONG><BIG>·</BIG></STRONG>
<A href=\"reviews.html\">Reviews</A><BR>
<BR>
<u>Interact</u>
<BR>
<STRONG><BIG>·</BIG></STRONG>
<A href=\"modules.php?name=GuestBook\">Guestbook</A><BR>
<STRONG><BIG>·</BIG></STRONG>
<A href=\"modules.php?name=Feedback\">Feedback</A><BR>
<STRONG><BIG>·</BIG></STRONG>
<A href=\"modules.php?name=Recommend_Us\">Recommend Us</A><BR>
<BR>
<u>Misc.</u>
<BR>
<STRONG><BIG>·</BIG></STRONG>
<A href=\"links.html\">Links</A><BR>
<STRONG><BIG>·</BIG></STRONG>
<A href=\"faq.html\">FAQ</A><BR>
<STRONG><BIG>·</BIG></STRONG>
<A href=\"links.html
&amp;file=index&amp;l_op=AddLink\">Add A Link</A><BR>
<STRONG><BIG>·</BIG></STRONG>
<A href=\"modules.php?name=Downloads\">Downloads</A><BR>
<STRONG><BIG>·</BIG></STRONG>
<A href=\"modules.php?name=Statistics\">Site Statistics</A><BR>
<STRONG><BIG>·</BIG></STRONG>
<A href=\"modules.php?name=HeadLines\">News Headlines</A><BR>
<BR>
//******************************************
//Below is for users and admins ONLY!!! 
//******************************************
<u>User Control Panel</u>
<BR>";  
if (!IsSet($user))
{;
$content .= "
<STRONG><BIG>·</BIG></STRONG>
<A href=\"modules.php?name=Your_Account\">Reg. Users Login. </A><br>";
}
if ((IsSet($user)) or (IsSet($admin)))
{;
$content .= "
<STRONG><BIG>·</BIG></STRONG>
<A href=\"modules.php?name=Your_Account\">Your Account</A><BR>
<STRONG><BIG>·</BIG></STRONG>
<A href=\"modules.php?name=Your_Account&amp;op=edituser\">Edit Profile</A><BR>
<STRONG><BIG>·</BIG></STRONG>
<A href=\"modules.php?name=Members_Photo_Upload\">Members Photo upload</A><BR>
<STRONG><BIG>·</BIG></STRONG>
<A href=\"modules.php?name=Members_List\">View Member List</A><BR>
<STRONG><BIG>·</BIG></STRONG>
<A href=\"modules.php?name=Your_Account&amp;op=logout\">logout</A><BR>
<BR>
<u>Private Messages</u>
<BR>
<STRONG><BIG>·</BIG></STRONG>
<A href=\"modules.php?name=Private_Messages\">View Messages</A><BR>
<STRONG><BIG>·</BIG></STRONG>
<A href=\"modules.php?name=Private_Messages
&amp;file=reply&amp;send=1\">Compose A Message</A><BR>
";
};
//***************************************
//ENDS HERE
//***************************************
$content .= "
<BR>
<u>Send Content</u>
<BR>
<STRONG><BIG>·</BIG></STRONG>
<A href=\"submit.html\">Submit News</A><BR>
<STRONG><BIG>·</BIG></STRONG>
<A href=\"reviews.html&amp;rop=write\">Write A Review</A><BR>
<STRONG><BIG>·</BIG></STRONG>
<A href=\"links.html
&amp;file=index&amp;l_op=AddLink\">Add A Link</A><BR>
<STRONG><BIG>·</BIG></STRONG>
<A href=\"modules.php?name=My_eGallery
&amp;file=index&amp;do=upload\">Add images to the Gallery</A><BR>
<BR>
</font>
</B>
<HR size=3>
";
?>
Powered by TOGETHER TEAM srl ITALY http://www.togetherteam.it - DONDELEO E-COMMERCE http://www.DonDeLeo.com - TUTTISU E-COMMERCE http://www.tuttisu.it
Web site engine's code is Copyright © 2002 by PHP-Nuke. All Rights Reserved. PHP-Nuke is Free Software released under the GNU/GPL license.
Page Generation: 0.033 Seconds - 397 pages served in past 5 minutes. Nuke Cops Founded by Paul Laudanski (Zhen-Xjell)
:: FI Theme :: PHP-Nuke theme by coldblooded (www.nukemods.com) ::