jane65
Regular
Joined: Feb 24, 2009
Posts: 81
Location: UK
|
Posted:
Fri Jul 06, 2012 6:33 am |
|
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
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&pa=list_pages_categories&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&pa=showpage&pid='.$XXpid.'" title="">'.$XXtitle2.'</a></li>';
}
$nukeNAV .= '
</ul>
</li>';
}else{
$nukeNAV .= '</li>';
}
|
|
|
|
nuken
RavenNuke(tm) Development Team
Joined: Mar 11, 2007
Posts: 2024
Location: North Carolina
|
Posted:
Fri Jul 06, 2012 7:32 am |
|
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! |
|
jane65
|
Posted:
Mon Jul 09, 2012 12:34 pm |
|
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&pa=list_pages_categories&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&pa=list_pages_categories&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&pa=showpage&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&pa=showpage&pid='.$XXpid.'" title="">'.$XXtitle2.'</a></li>';
}
$nukeNAV .= '
</ul>
</li>';
}else{
$nukeNAV .= '</li>';
}
}
if (is_user($user)) $nukeNAV .= '
<li><a href="modules.php?name=Content&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');
|
|
|
|