Ravens PHP Scripts: Forums
 

 

View next topic
View previous topic
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> How To's
Author Message
SpaceMonkey
Worker
Worker


Joined: Apr 30, 2005
Posts: 170

PostPosted: Mon Aug 08, 2005 1:36 am Reply with quote

I'd like to make a block that lists all the topics from the topic module. How would I go about making something like that? Is there something out there that does that already?
 
View user's profile Send private message Visit poster's website
Raven
Site Admin/Owner


Joined: Aug 27, 2002
Posts: 17086

PostPosted: Mon Aug 08, 2005 5:42 am Reply with quote

Code:
<?php

/************************************************************************/
/* PHP-NUKE: Web Portal System                                          */
/* ===========================                                          */
/*                                                                      */
/* Copyright (c) 2002 by Francisco Burzi                                */
/* http://phpnuke.org                                                   */
/*                                                                      */
/* This program is free software. You can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 2 of the License.       */
/************************************************************************/
/************************************************************************/
/* Name:    block-Topics.php                                            */
/* Author:  Gaylen Fraley aka Raven                                     */
/* Support: http://ravenphpscripts.com http://ravenwebhosting.com       */
/* Date:    2005-08-08                                                  */
/* Purpose: List all Topics in a block rather than a module.            */
/* Usage:   Place this script in your nuke blocks folder. Then activate */
/*          it via ACP.                                                 */
/* License: GNU/GPL                                                     */
/* Warranty:None.  Proceed at your own risk.                            */
/************************************************************************/

if ( !defined('BLOCK_FILE') ) {
    Header("Location: index.php");
    die();
}

global $user_prefix, $db;

$sql     = "SELECT topicid, topicname, topicimage, topictext FROM ".$user_prefix."_topics ORDER BY topictext";
$result  = $db->sql_query($sql);
$numrows = $db->sql_numrows($result);
if ($numrows == 0) {
   $content = 'No topics to list';
} else {
   $boxstuff = "<font class=\"content\">";
   while ($row = $db->sql_fetchrow($result)) {
      $topicid   = intval($row['catid']);
      $topicname = $row['topicname'];
      $topictext = $row['topictext'];
      $boxstuff .= "<strong><big>&middot;</big></strong>&nbsp;<b>$topicname</b><br>";
   }
   $boxstuff .= "</font>";
   $content = $boxstuff;
 }
?>
 
View user's profile Send private message
SpaceMonkey
PostPosted: Tue Aug 09, 2005 12:28 am Reply with quote

Thanks heaps!
 
SpaceMonkey
PostPosted: Tue Aug 09, 2005 2:33 am Reply with quote

Hey Raven,

I'm getting this error "Safari can’t open the page.
Too many redirects occurred trying to open “http://www.jamenashshs.qld.edu.au/index.php”. This might occur if you open a page that is redirected to open another page which then is redirected to open the original page."

This occurs when I activate the block..

Any ideas?
 
SpaceMonkey
PostPosted: Tue Aug 09, 2005 2:40 am Reply with quote

It looks like I was right.. It's not compatible with 7.8 I tried it in my site running 7.7, and it works. I was hoping that the topics would be clickable though. So that it would go to all the news stories under that topic.

This is all very educational all the same though. Smile
 
Raven
PostPosted: Tue Aug 09, 2005 7:25 am Reply with quote

See if this helps on the Safari error: Only registered users can see links on this board! Get registered or login!
 
SpaceMonkey
PostPosted: Wed Aug 10, 2005 6:05 am Reply with quote

So, if I need to define the block file properly in my mainfile.php. What code do I need to enter. Is it like the stuff in the language files??
 
Display posts from previous:       
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> How To's

View next topic
View previous topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Powered by phpBB © 2001-2007 phpBB Group
All times are GMT - 6 Hours
 
Forums ©