Ravens PHP Scripts: Forums
 

 

View next topic
View previous topic
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> Blocks
Author Message
mars
Worker
Worker



Joined: Jul 08, 2006
Posts: 123
Location: Bloomsburg,Pennsylvania

PostPosted: Tue Aug 26, 2008 3:50 pm Reply with quote

Not sure if anyone has done this but I rewrote the modules block to use a UL and LI tags in place of the text with BR's
The UL is classed as MainMenu with an ID for styling.
The non-link text parts are classed as nolink for styling as well.

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.       */
/************************************************************************/
/*         Additional security & Abstraction layer conversion           */
/*                           2003 chatserv                              */
/*      http://www.nukefixes.com -- http://www.nukeresources.com        */
/************************************************************************/

if (eregi("block-Modules-li.php", $_SERVER['PHP_SELF'])) {
    Header("Location: index.php");
    die();
}

global $prefix, $db, $admin, $user;

    $ThemeSel = get_theme();
    if (file_exists("themes/$ThemeSel/module.php")) {
   include("themes/$ThemeSel/module.php");
   if (is_active("$default_module") AND file_exists("modules/$default_module/index.php")) {
       $def_module = $default_module;
   } else {
       $def_module = "";
   }
    }

    $row = $db->sql_fetchrow($db->sql_query("SELECT main_module FROM ".$prefix."_main"));
    $main_module = $row['main_module'];

    /* If the module doesn't exist, it will be removed from the database automaticaly */
    $result2 = $db->sql_query("SELECT title FROM " . $prefix . "_modules");
    while ($row2 = $db->sql_fetchrow($result2)) {
   $title = stripslashes($row2['title']);
   $a = 0;
   $handle=opendir('modules');
   while ($file = readdir($handle)) {
           if ($file == $title) {
      $a = 1;
       }
   }
   closedir($handle);
   if ($a == 0) {
       $db->sql_query("DELETE FROM ".$prefix."_modules WHERE title='$title'");
   }
    }

    /* Now we make the Modules block with the correspondent links */

    $content .= "<ul id=\"MainMenu\"><li><a href=\"index.php\">"._HOME."</a></li>\n";
    $result3 = $db->sql_query("SELECT * FROM " . $prefix . "_modules WHERE active='1' AND title!='$def_module' AND inmenu='1' ORDER BY custom_title ASC");
    while ($row3 = $db->sql_fetchrow($result3)) {
   $groups = $row3['groups'];
   $m_title = stripslashes($row3['title']);
   $custom_title = $row3['custom_title'];
   $view = intval($row3['view']);
   $m_title2 = ereg_replace("_", " ", $m_title);
   if ($custom_title != "") {
       $m_title2 = $custom_title;
   }
   if ($m_title != $main_module) {
            if ($view == 0) {
                $content .= "<li><a href=\"modules.php?name=$m_title\">$m_title2</a></li>\n";
            } elseif (($view == 1 AND is_user($user)) OR is_admin($admin)) {  //Per Mantis 0000119
                $content .= "<li><a href=\"modules.php?name=$m_title\">$m_title2</a></li>\n";
            } elseif ($view == 2 AND is_admin($admin)) {
                $content .= "<li><a href=\"modules.php?name=$m_title\">$m_title2</a></li>\n";
            } elseif (($view == 3 AND paid()) OR is_admin($admin)) {  //Per Mantis 0000119
                $content .= "<li><a href=\"modules.php?name=$m_title\">$m_title2</a></li>\n";
            } elseif ($view > 3 AND in_groups($groups)) {
              $content .= "<li><a href=\"modules.php?name=$m_title\">$m_title2</a></li>\n";
            }
   }
    }

    /* If you're Admin you and only you can see Inactive modules and test it */
    /* If you copied a new module is the /modules/ directory, it will be added to the database */

    if (is_admin($admin)) {
   $handle=opendir('modules');
   while ($file = readdir($handle)) {
       if ( (!ereg("[.]",$file)) ) {
      $modlist .= "$file ";
       }
   }
   closedir($handle);
   $modlist = explode(" ", $modlist);
   sort($modlist);
   for ($i=0; $i < sizeof($modlist); $i++) {
       if($modlist[$i] != "") {
      $row4 = $db->sql_fetchrow($db->sql_query("SELECT mid FROM ".$prefix."_modules WHERE title='$modlist[$i]'"));
      $mid = intval($row4['mid']);
      $mod_uname = ereg_replace("_", " ", $modlist[$i]);
      if ($mid == "") {
          $db->sql_query("INSERT INTO ".$prefix."_modules VALUES (NULL, '$modlist[$i]', '$mod_uname', '0', '0', '', '1', '0')");
      }
       }
   }
   $content .= "<li class=\"nolink\">"._INVISIBLEMODULES."</li>";
   $content .= "<li class=\"nolink\">"._ACTIVEBUTNOTSEE."</li>";
   $result5 = $db->sql_query("SELECT title, custom_title FROM ".$prefix."_modules WHERE active='1' AND inmenu='0' ORDER BY title ASC");
   while ($row5 = $db->sql_fetchrow($result5)) {
       $mn_title = stripslashes($row5['title']);
       $custom_title = $row5['custom_title'];
       $mn_title2 = ereg_replace("_", " ", $mn_title);
       if ($custom_title != "") {
      $mn_title2 = $custom_title;
       }
       if ($mn_title2 != "") {
      $content .= "<li><a href=\"modules.php?name=$mn_title\">$mn_title2</a></li>\n";
      $dummy = 1;
       } else {
      $a = 1;
       }
   }
   if ($a == 1 AND $dummy != 1) {
           $content .= "<li><i>"._NONE."</i></li>\n";
   }
   $content .= "<li class=\"nolink\">"._NOACTIVEMODULES."</li>";
   $content .= "<li class=\"nolink\">"._FORADMINTESTS."</li>";
   $result6 = $db->sql_query("SELECT title, custom_title FROM ".$prefix."_modules WHERE active='0' ORDER BY title ASC");
   while ($row6 = $db->sql_fetchrow($result6)) {
       $mn_title = stripslashes($row6['title']);
       $custom_title = $row6['custom_title'];
       $mn_title2 = ereg_replace("_", " ", $mn_title);
       if ($custom_title != "") {
      $mn_title2 = $custom_title;
       }
       if ($mn_title2 != "") {
      $content .= "<li><a href=\"modules.php?name=$mn_title\">$mn_title2</a></li>\n";
      $dummy = 1;
       } else {
      $a = 1;
       }
   }
   if ($a == 1 AND $dummy != 1) {
           $content .= "<li><i>"._NONE."</i></li>\n";
   }
   $content .="</ul>";
    }

?>


**Edited for typo..**

_________________
Visit Our PHPNuke Theme Site 
View user's profile Send private message Visit poster's website
mars







PostPosted: Tue Aug 26, 2008 4:18 pm Reply with quote

For an example of the styling that would be possible with this go to
[ Only registered users can see links on this board! Get registered or login! ]

And choose BrightSide as the theme, then look at the Modules block on the left.
 
jakec
Site Admin



Joined: Feb 06, 2006
Posts: 3048
Location: United Kingdom

PostPosted: Wed Aug 27, 2008 12:15 am Reply with quote

Nice one Mars, it looks good. Very Happy
 
View user's profile Send private message
montego
Site Admin



Joined: Aug 29, 2004
Posts: 9457
Location: Arizona

PostPosted: Wed Aug 27, 2008 7:05 am Reply with quote

one of these days we're going to finally get to changing RN to where we have a default overall theme CSS that is loaded first so that we can make nice changes like this without completely blowing out all themes...

Thanks for sharing. Nice job.

_________________
Where Do YOU Stand?
HTML Newsletter::ShortLinks::Mailer::Downloads and more... 
View user's profile Send private message Visit poster's website
jestrella
Moderator



Joined: Dec 01, 2005
Posts: 593
Location: Santiago, Dominican Republic

PostPosted: Wed Aug 27, 2008 7:41 am Reply with quote

great, this is the direction we should be taking

_________________
"For those whom have not reach the sky... Every mountain seems high"

Best Regards
Jonathan Estrella [ Only registered users can see links on this board! Get registered or login! ] 
View user's profile Send private message Visit poster's website
mars







PostPosted: Wed Aug 27, 2008 9:22 am Reply with quote

Thanks, I am actually looking at default blocks to see about converting to XHTML without tables so they don't screw with validation.

There is also a slight typo in the code above

Code:



}
   $content .="</ul>";
    }

?>


Should be

Code:



}
  }
   $content .="</ul>";
?>
 
mars







PostPosted: Wed Aug 27, 2008 9:22 am Reply with quote

Oh and that theme is XHTML and will be released for free too. Wink
 
jestrella







PostPosted: Wed Aug 27, 2008 6:07 pm Reply with quote

keep rocking Wave
 
montego







PostPosted: Sun Aug 31, 2008 7:13 am Reply with quote

For the RavenNuke'ers out there, I have added in a few mods that we had made to this block file along the way, which included the removal of two PHP warnings. Enjoy!

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.       */
/************************************************************************/
/*         Additional security & Abstraction layer conversion           */
/*                           2003 chatserv                              */
/*      http://www.nukefixes.com -- http://www.nukeresources.com        */
/************************************************************************/
/************************************************************************/
/* Additional code clean-up, performance enhancements, and W3C and      */
/* XHTML compliance fixes by Raven and Montego.                         */
/************************************************************************/

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


global $prefix, $db, $admin, $user, $modlist, $dummy, $default_module;

$content = '';
$ThemeSel = get_theme();
$def_module = '';
if (file_exists('themes/' . $ThemeSel . '/module.php')) {
   include_once('themes/' . $ThemeSel . '/module.php');
   if (is_active($default_module) AND file_exists('modules/' . $default_module . '/index.php')) {
      $def_module = $default_module;
   } else {
      $def_module = '';
   }
}
$row = $db->sql_fetchrow($db->sql_query('SELECT main_module FROM ' . $prefix . '_main'));
$main_module = $row['main_module'];
/* If the module doesn't exist, it will be removed from the database automatically */
$result2 = $db->sql_query('SELECT title FROM ' . $prefix . '_modules');
while ($row2 = $db->sql_fetchrow($result2)) {
   $title = stripslashes($row2['title']);
   $a = 0;
   $handle = opendir('modules');
   while ($file = readdir($handle)) {
      if ($file == $title) {
         $a = 1;
      }
   }
   closedir($handle);
   if ($a == 0) {
      $db->sql_query('DELETE FROM ' . $prefix . '_modules WHERE title=\'' . $title . '\'');
   }
}
/* Now we make the Modules block with the correspondent links */
$content .= '<ul id="MainMenu"><li><a href="index.php">' . _HOME . '</a></li>';
$result3 = $db->sql_query('SELECT * FROM ' . $prefix . '_modules WHERE active=\'1\' AND title!=\'' . $def_module . '\' AND inmenu=\'1\' ORDER BY custom_title ASC');
while ($row3 = $db->sql_fetchrow($result3)) {
   $groups = $row3['groups'];
   $m_title = stripslashes($row3['title']);
   $custom_title = $row3['custom_title'];
   $view = intval($row3['view']);
   $m_title2 = ereg_replace('_', ' ', $m_title);
   if (!empty($custom_title)) {
      $m_title2 = $custom_title;
   }
   if ($m_title != $main_module) {
      if ($view == 0) {
         $content .= '<li><a href="modules.php?name=' . $m_title . '">' . $m_title2 . '</a></li>';
      } elseif ($view == 1 AND ((is_user($user) AND is_group($user, $m_title)) OR is_admin($admin))) {  //RN0000119, RN0000317
         $content .= '<li><a href="modules.php?name=' . $m_title . '">' . $m_title2 . '</a></li>';
      } elseif ($view == 2 AND is_admin($admin)) {
         $content .= '<li><a href="modules.php?name=' . $m_title . '">' . $m_title2 . '</a></li>';
      } elseif ($view == 3 AND (paid() OR is_admin($admin))) {  //RN0000119, RN0000317
         $content .= '<li><a href="modules.php?name=' . $m_title . '">' . $m_title2 . '</a></li>';
      } elseif ($view > 3 AND in_groups($groups)) {
         $content .= '<li><a href="modules.php?name=' . $m_title . '">' . $m_title2 . '</a></li>';
      }
   }
}
/* If you're Admin you and only you can see Inactive modules and test it */
/* If you copied a new module is the /modules/ directory, it will be added to the database */
if (is_admin($admin)) {
   $content .= '<li class="nolink">' . _INVISIBLEMODULES . '</li>';
   $content .= '<li class="nolink">' . _ACTIVEBUTNOTSEE . '</li>';
   $result5 = $db->sql_query('SELECT title, custom_title FROM ' . $prefix . '_modules WHERE active=\'1\' AND inmenu=\'0\' ORDER BY title ASC');
   while ($row5 = $db->sql_fetchrow($result5)) {
      $mn_title = stripslashes($row5['title']);
      $custom_title = $row5['custom_title'];
      $mn_title2 = ereg_replace('_', ' ', $mn_title);
      if (!empty($custom_title)) {
         $mn_title2 = $custom_title;
      }
      if (!empty($mn_title2)) {
         $content .= '<li><a href="modules.php?name=' . $mn_title . '">' . $mn_title2 . '</a></li>';
         $dummy = 1;
      } else {
         $a = 1;
      }
   }
   if ($a == 1 AND $dummy != 1) {
      $content .= '<li><i>' . _NONE . '</i></li>';
   }
   $content .= '<li class="nolink">' . _NOACTIVEMODULES . '</li>';
   $content .= '<li class="nolink">' . _FORADMINTESTS . '</li>';
   $result6 = $db->sql_query('SELECT title, custom_title FROM ' . $prefix . '_modules WHERE active=\'0\' ORDER BY title ASC');
   while ($row6 = $db->sql_fetchrow($result6)) {
      $mn_title = stripslashes($row6['title']);
      $custom_title = $row6['custom_title'];
      $mn_title2 = ereg_replace('_', ' ', $mn_title);
      if (!empty($custom_title)) {
         $mn_title2 = $custom_title;
      }
      if (!empty($mn_title2)) {
         $content .= '<li><a href="modules.php?name=' . $mn_title . '">' . $mn_title2 . '</a></li>';
         $dummy = 1;
      } else {
         $a = 1;
      }
   }
   if ($a == 1 AND $dummy != 1) {
      $content .= '<li><i>' . _NONE . '</i></li>';
   }
   $content .= '</ul>';
}
?>


BTW, this is a far superior way of doing this and I'd like to add this to RN in the 2.4.0 release (not the one currently under QA testing as no new code is allowed).

One suggestion though, from an accessibility standpoint, I would not have the Invisible and Inactive titles within the same UL tags or as LI's. With a screen reader, they would be read as part of the list rather than looking like titles (which they need to). If I were to incorporate into RN, I would change that, which would also probably mean using an "ID" to style this wouldn't be my choice unless the whole thing is wrapped in a DIV?
 
mars







PostPosted: Sun Aug 31, 2008 7:36 am Reply with quote

I would not wrap it in a div unless it is really needed, with the side blocks, you should leave the div's to the actual blocks and not the content.

As far as the LI or not LI for the list titles, it is ok to do it this way as you are not A:LINK them so they are different from the rest.

If you want to do multiple lists you will have to do some seperate CSS so that they don't mess with each other layout wise.

Looking good though! Smile
 
montego







PostPosted: Sun Aug 31, 2008 7:55 am Reply with quote

Just remember that my statement was "for accessibility" reasons. What you have done, is perfectly fine for those who are not visually impaired and using screen readers. Just something to keep in mind... however, *nuke really sucks for those with accessibility issues! Its just not designed with these things in mind. Just trying to help raise the awareness...
 
mars







PostPosted: Sun Aug 31, 2008 10:02 am Reply with quote

Understood. Smile
We just need to keep these things in mind when we do blocks and modules, it is a ton easier to do it XHTML compliant at the start than to go back later and try to fix things.
 
jestrella







PostPosted: Sun Aug 31, 2008 11:06 pm Reply with quote

mars wrote:
it is a ton easier to do it XHTML compliant at the start than to go back later and try to fix things.


wise words
 
warren-the-ape
Worker
Worker



Joined: Nov 19, 2007
Posts: 196
Location: Netherlands

PostPosted: Mon Sep 01, 2008 4:03 am Reply with quote

I think the word you're looking for is 'semantic' not compliant. Breaks are as compliant as lists Wink
 
View user's profile Send private message
montego







PostPosted: Mon Sep 01, 2008 1:02 pm Reply with quote

Yeah, not even sure that "semantic" is the right word? It is definitely better structured HTML in the end, which helps with accessibility, as well as it is stylable.
 
montego







PostPosted: Mon Sep 01, 2008 1:03 pm Reply with quote

Actually, on second thought, "semantic" is definitely a good description for the accessibility and "well structured" part....
 
Display posts from previous:       
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> Blocks

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 ©