Ravens PHP Scripts: Forums
 

 

View next topic
View previous topic
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> Themes
Author Message
jane65
Regular
Regular


Joined: Feb 24, 2009
Posts: 81
Location: UK

PostPosted: Fri Jul 06, 2012 6:33 am Reply with quote

I have added a mod to the /includes/jquery/nukeNAV.php file, that I found in the forum here, which works fine. It adds a drop down menu of the Content module contents to the Navigation bar, but I want to make a slight alteration to it and need help to rewrite the code.

I need the drop down menu to display ONE specific category only from the Content module rather than all of the categories that are there and I also want it to show the content pages that are associated with that ONE specific category. I hope this makes sense and would appreciate if someone could help me with this. Thank you Smile

Code:
 if (is_active('Content')) {

   $nukeNAV .= '
<li><a href="modules.php?name=Content" title="">Content</a>';
   $NAVresult = $db->sql_query('SELECT * FROM '.$prefix.'_pages_categories');
   $NAVnumrows = $db->sql_numrows($NAVresult);
      if ($NAVnumrows > 0) {
      $nukeNAV .= '
     <ul>';
      while ($XXrow = $db->sql_fetchrow($NAVresult)) {
      $XXcid = $XXrow['cid'];
      $XXtitle = $XXrow['title'];
      // display cat
      $nukeNAV .= '
   <li><a href="/modules.php?name=Content&amp;pa=list_pages_categories&amp;cid='.$XXcid.'" title="">'.$XXtitle.'</a>';
   // content for cat
   $NAVresult2 = $db->sql_query('SELECT * FROM '.$prefix.'_pages WHERE active=\'1\' AND cid=\''.$XXcid.'\'');
         $NAVnumrows2 = $db->sql_numrows($NAVresult2);
      if ($NAVnumrows2 > 0) {
      $nukeNAV .= '
     <ul>';
      while ($XXrow2 = $db->sql_fetchrow($NAVresult2)) {
      $XXpid = $XXrow2['pid'];
      $XXtitle2 = $XXrow2['title'];
      $nukeNAV .= '
   <li><a href="modules.php?name=Content&amp;pa=showpage&amp;pid='.$XXpid.'" title="">'.$XXtitle2.'</a></li>';
      }
      $nukeNAV .= '
     </ul>
   </li>';
      }else{
      $nukeNAV .= '</li>';
      }
 
View user's profile Send private message
nuken
RavenNuke(tm) Development Team


Joined: Mar 11, 2007
Posts: 2024
Location: North Carolina

PostPosted: Fri Jul 06, 2012 7:32 am Reply with quote

You should be able to change the $XXcid = $XXrow['cid']; to $XXcid = YourCatID; and only display the one category. Of course, YourCatID should be the actual id of the category you are wanting to display.

_________________
Only registered users can see links on this board! Get registered or login! 
View user's profile Send private message Send e-mail Visit poster's website
jane65
PostPosted: Fri Jul 06, 2012 8:48 am Reply with quote

Thank you for your help, I will try this Smile
 
jane65
PostPosted: Mon Jul 09, 2012 12:34 pm Reply with quote

Hi,
Unfortunately that didn't work, but I did manage to do it by changing this part of the code

Code:
<li><a href="modules.php?name=Content" title="">Content</a>'; 

   $NAVresult = $db->sql_query('SELECT * FROM '.$prefix.'_pages_categories');
$NAVnumrows = $db->sql_numrows($NAVresult);
      if ($NAVnumrows > 0) {
      $nukeNAV .= '
     <ul>';
      while ($XXrow = $db->sql_fetchrow($NAVresult)) {
      $XXcid = $XXrow['cid'];




TO THIS
Code:
<li><a href="/modules.php?name=Content&amp;pa=list_pages_categories&amp;cid=1" title="">Content</a>';

   $NAVresult = $db->sql_query('SELECT * FROM '.$prefix.'_pages WHERE active=\'1\' AND cid=1');
$NAVnumrows = $db->sql_numrows($NAVresult);
      if ($NAVnumrows > 0) {
      $nukeNAV .= '
     <ul>';
      while ($XXrow = $db->sql_fetchrow($NAVresult)) {
      $XXpid = $XXrow['pid'];



Also just in case someone else wants to do this, I've pasted the full mod code below. The code can be repeated in the jquery/nukeNAV.php to have separate links across the navbar to each category with its own specific drop down menu by simply altering the part of the code as shown above to include the url of a specific category in your Content Module and the correct cid number that matches your specific category URL. I hope that makes sense.

Here's the full mod code

Code:
if (is_active('Content')) {

   $nukeNAV .= '
<li><a href="/modules.php?name=Content&amp;pa=list_pages_categories&amp;cid=1" title="">Healing</a>';
   $NAVresult = $db->sql_query('SELECT * FROM '.$prefix.'_pages WHERE active=\'1\' AND cid=1');
   $NAVnumrows = $db->sql_numrows($NAVresult);
      if ($NAVnumrows > 0) {
      $nukeNAV .= '
     <ul>';
      while ($XXrow = $db->sql_fetchrow($NAVresult)) {
      $XXpid = $XXrow['pid'];
      $XXtitle = $XXrow['title'];
      // display cat
      $nukeNAV .= '
   <li><a href="/modules.php?name=Content&amp;pa=showpage&amp;pid='.$XXpid.'" title="">'.$XXtitle.'</a>';
   // content for cat
   $NAVresult2 = $db->sql_query('SELECT * FROM '.$prefix.'_pages WHERE active=\'1\' AND pid=\''.$XXpid.'\'');
       if ($NAVnumrows2 > 0) {
      $nukeNAV .= '
     <ul>';
      while ($XXrow2 = $db->sql_fetchrow($NAVresult2)) {
      $XXpid = $XXrow2['pid'];
      $XXtitle2 = $XXrow2['title'];
      $nukeNAV .= '
   <li><a href="modules.php?name=Content&amp;pa=showpage&amp;pid='.$XXpid.'" title="">'.$XXtitle2.'</a></li>';
      }
      $nukeNAV .= '
     </ul>
   </li>';
      }else{
      $nukeNAV .= '</li>';
      }
}
   if (is_user($user)) $nukeNAV .= '
  <li><a href="modules.php?name=Content&amp;pa=add_page" title="">Add Page</a></li>';
   $nukeNAV .= '
  </ul>
</li>';
   }else{
   $nukeNAV .= '</li>';
   }
}


Also, to make this mod work.
You need to find this part of the code in jquery/nukeNAV.php
Code:


$menuModules = array('Credits', 'Feedback', 'Forums', 'Legal', 'Member_List', 'News', 'nukeNAV', 'Private_Messages', 'Recommend_Us', 'rwsMetAuthors', 'Search', 'Sitemap', 'Statistics', 'Stories_Archive', 'Submit_News', 'Topics', 'Your_Account');


And include 'Content' to the list, so the code looks like this

Code:
$menuModules = array('Content', 'Credits', 'Feedback', 'Forums', 'Legal', 'Member_List', 'News', 'nukeNAV', 'Private_Messages', 'Recommend_Us', 'rwsMetAuthors', 'Search', 'Sitemap', 'Statistics', 'Stories_Archive', 'Submit_News', 'Topics', 'Your_Account');

 
Display posts from previous:       
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> Themes

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 ©