SimplePortal
Customization => Blocks and Modifications => Topic started by: Nathaniel on February 21, 2009, 07:20:40 AM
-
Information:
The attached mod will install the SP Forum Navigation Block.
SimplePortal MUST be installed, you can download it here (http://simpleportal.net/index.php?action=download).
Make sure that you uninstall this mod before uninstalling SimplePortal. If you don't then errors may occur.
SimplePortal block created by LHVWB.
Versions:
1.00: Created/Tested for SMF 1.1.8/2 RC1 and SP 2.1.1.
1.01: Created/Tested for SMF 1.1.8/2 RC1 and SP 2.2.
You can easily customize the appearance of this block in two ways.
1) You can add some css to the end of your themes 'style.css' file that uses the 'sp_navigation_block_cat' and 'sp_navigation_block_board' classes.
/* This css code changes the SP Forum Navigation Block styles. */
.sp_navigation_block_cat a
{
font-size: 15px;
color: #00DDDD;
}
.sp_navigation_block_board a
{
font-size: 12px;
color: blue;
}
Attached are examples of how this block looks before and after that css is applied.
2) Do a search for the code below in your 'SPortalX.php' file (it should be very close to the end of the file; replace the 'X' with '2' or '1-1' depending on your forum version).
$prefix .= '-';
You can change the '-' value to customize the symbol/image/html that is used to separate categories from boards and boards from their child boards.
For SP 2.2 versions and above, this code will add a random colored 'dot':
$prefix .= sp_embed_image('dot');
-
a very nice mod, thank you!
-
It might be nice to have an extra break between the last board of a category and the next category title. Where might I go to add that, if possible?
In your example...
New Category
- New Board
General Category
- General Discussion
Would be...
New Category
- New Board
General Category
- General Discussion
I guess I could adjust it with margin in the CSS?
-
You should be able to do it with css, but if you want to edit the function itself then ydo a search for the 'sp_forum_navigation' funcion at the very bottom of you 'SPortalX.php' file (replace X with forum version, ie '1-1' or '2').
Replace this code:
echo '
', $prefix, '<span class="sp_navigation_block_board"><a href="', $scripturl, '?board=', $boards[$boardid]['id'], '">', $boards[$boardid]['name'], '</a></span><br />';
}
With this code:
echo '
', $prefix, '<span class="sp_navigation_block_board"><a href="', $scripturl, '?board=', $boards[$boardid]['id'], '">', $boards[$boardid]['name'], '</a></span><br />';
}
echo '<br />';
}
-
Again, thank you very much!!
-
Any chance you would upgrade this for 2.2? I was surprised that 2.2 used the top navi bar for their menu box instad of this style navi box.
-
Noted, I will do an update for 2.2 sometime.
-
Updated this mod.
Version 1.01 is compatible with SP 2.2.
-
I was missing this block very much, thanks!! :D
-
I was missing this block very much, thanks!! :D
The same here. :)
Thanks LHVWB
-
a very nice mod, thank you!
-
Any chance for a 2.2.2 update?
-
@KahneFan,
I haven't tried it with 2.2.2, but it should still work...
-
I used the 2.2.2 upgrade feature and when I looked at my portal it was throwing an error... and no... I didn't copy it, sorry :(
-
The SP 2.2.2 overwrites some of the files that this block/mod edits. If you uninstall and then reinstall the mod then the issue should go away.
-
Gotcha. Thanks!
So, next time I upgrade SP:
1) Uninstall this mod
2) Install/upgrade SP
3) Reinstall this mod
-
installed this mod but nothing seems to happen. should I see it? what's going on?
-
Look at the Add Block there is a new block =).
-
Hi there, I'd like to download a copy of this mod but the download link is not working. Is it still available please?
Thanks
Pete
-
Hey guys just upgraded to 2.3 and went to install this mod again and it show a heap of errors.
can some please help.
-
?? anyone want to help?
-
Still nothing? please can someone take a look i love this block it makes it so easy to get around.
-
I get this when i try to apply mod...
Installing this package will perform the following actions:
Type Action Description
1. Execute Modification ./Sources/SPortal1-1.php File not found
2. Execute Modification ./Themes/default/languages/SPortal.english.php Test failed
3. Execute Modification ./Themes/default/languages/SPortal.english-utf8.php Test failed
4. Execute Modification ./Themes/default/languages/SPortalHelp.english.php Test successful
5. Execute Modification ./Themes/default/languages/SPortalHelp.english-utf8.php Test successful
6. Execute Code install1.php
-
The mod is outdated. It will need to be updated.
-
how i do this on 1.1.11?
and please explain me where because im kinda new in this.
-
i dont get it where do i place it?
-
i dont get it where do i place it?
dude, just search google for css vertical menu coding. find a script, add the links you want, an make a html portal [block] and copy and paste the code in there...
this way you can direct them anywhere, and have your own colors to match ur site..
(http://i256.photobucket.com/albums/hh187/implicit_album/lillinkscssmenu.png)
-
Is this gonna work with 2.0 RC2 ?
-
I get this when i try to apply mod...
Installing this package will perform the following actions:
Type Action Description
1. Execute Modification ./Sources/SPortal1-1.php File not found
2. Execute Modification ./Themes/default/languages/SPortal.english.php Test failed
3. Execute Modification ./Themes/default/languages/SPortal.english-utf8.php Test failed
4. Execute Modification ./Themes/default/languages/SPortalHelp.english.php Test successful
5. Execute Modification ./Themes/default/languages/SPortalHelp.english-utf8.php Test successful
6. Execute Code install1.php
Me too. Can we get some help with this please?
-
The mod is outdated. It will need to be updated.
-
Interested in this to. Is it left for dead or is it a matter of lack of time?
-
Working on the SimplePortal core has a much higher precedence than this mod atm. ;)
-
pfft ... lame excuse. 8)
-
Does this work on the latest version?
-
SP Navigation Block for SimplePortal 2.3.3 (Updated by me)
1. Go to Blocks > Add block > Custom Php Code >
2. Paste the next code:
global $cat_tree, $boards, $boardList, $scripturl, $sourcedir, $user_info, $db_prefix;
$block_parameters = array(
'num_children' => 'int',
);
if ($return_parameters)
return $block_parameters;
$child_depth = !empty($parameters['num_children']) ? (int) $parameters['num_children'] - 1 : -1;
require_once($sourcedir . '/Subs-Boards.php');
getBoardTree();
// Remobe any boards this user can't actually see.
$temp_boards = $boards;
$request = db_query("
SELECT b.ID_BOARD
FROM {$db_prefix}boards AS b
WHERE !($user_info[query_see_board])", __FILE__, __LINE__);
while ($row = mysql_fetch_assoc($request))
unset($temp_boards[$row['ID_BOARD']]);
mysql_free_result($request);
echo '
<div style="padding-left:2px;">';
foreach ($cat_tree as $catid => $tree)
{
echo '
<span class="sp_navigation_block_cat" style="font-weight:bold;"><a href="', $scripturl, '?action=forum#', $tree['node']['id'], '">', $tree['node']['name'], '</a></span><br />';
foreach ($boardList[$catid] as $boardid)
{
$prefix = '';
for ($i=0; $i<=$boards[$boardid]['level']; $i++)
$prefix .= '-';
echo '
', $prefix, '<span class="sp_navigation_block_board"><a href="', $scripturl, '?board=', $boards[$boardid]['id'], '">', $boards[$boardid]['name'], '</a></span><br />';
}
}
echo '
</div>';
This work pefectly. Check my portal: http://www.darksitel.com/index.php
Regards.
-
SP Navigation Block for SimplePortal 2.3.3 (Updated by me)
Doesn't work on my site which runs on SMF 2.0 though. I get this error:
Fatal error: Call to undefined function db_query() in /home/xxxxx/public_html/Sources/PortalBlocks.php(3351) : eval()'d code on line 17
I'm guessing it isn't written for SMF 2.0.
-
same error here
-
Any update for SP 2.3.5?
Thanks
-
Does anyone use this with SP 2.3.5?
-
Here's a basic one that would work with SMF 2.x versions and any version of SimplePortal that supports it:
global $cat_tree, $boards, $boardList, $scripturl, $sourcedir, $smcFunc;
require_once($sourcedir . '/Subs-Boards.php');
getBoardTree();
$temp_boards = $boards;
$request = $smcFunc['db_query']('', '
SELECT b.id_board
FROM {db_prefix}boards AS b
WHERE !({query_see_board})');
while ($row = $smcFunc['db_fetch_assoc']($request))
unset($temp_boards[$row['id_board']]);
$smcFunc['db_free_result']($request);
echo '
<ul>';
foreach ($cat_tree as $catid => $tree)
{
echo '
<li><a href="', $scripturl, '?action=forum#c', $tree['node']['id'], '">', $tree['node']['name'], '</a>';
if (!empty($boardList[$catid]))
{
echo '<ul>';
foreach ($boardList[$catid] as $key => $boardid)
{
if (empty($temp_boards[$boardid]))
continue;
$current_level = $boards[$boardid]['level'];
$next_level = isset($boardList[$catid][$key + 1]) ? $boards[$boardList[$catid][$key + 1]]['level'] : -1;
echo '
<li><a href="', $scripturl, '?board=', $boards[$boardid]['id'], '">', $boards[$boardid]['name'], '</a>', $next_level > $current_level ? ' <span onclick="document.getElementById(\'spcatexpand' . $boardid . '\').style.display = \'\';">+</span>' : '';
if ($next_level > $current_level)
echo '<ul style="display: none;" id="spcatexpand', $boardid, '">';
else
echo '</li>';
if ($next_level < $current_level && $current_level != 0)
echo '</ul></li>';
elseif ($next_level < $current_level)
echo '</li>';
}
echo '</ul>';
}
echo '</li>';
}
echo '</ul>';
It may not look the best as far as the styling goes but you have unordered lists there, so feel free to style it as you wish using CSS.
-
Wow, thanks :D
It works perfectly, but I didn´t realize I had that many boards, it became a very lock block... ;P
I have been thinking of making this nav block with hardcoded links to the boards & cats, and last night I found a very nice JQuery plugin for making a collapsable menu.
See demo: http://apps.komposta.net/jquery/navgoco/demo/
Tutorial: http://www.komposta.net/article/navgoco
Would that be possible to use in a SP block and if so, how?
Either with hardcoded links or better: in combination with the code you´ve made above?
Thank you very much for helping us all out with our problems and wishes :-*
-
As I said, it's very easy to customize because it just uses unordered lists. Here's the code (only modified a little) to make it work with that JQuery plugin:
Add the necessary includes between the <head></head> tags in index.template.php file of your theme. It should look something like the following:
<script type="text/javascript" src="http://code.jquery.com/jquery-latest.min.js"></script>
<script type="text/javascript" src="http://apps.komposta.net/jquery/navgoco/src/jquery.cookie.js"></script>
<script type="text/javascript" src="http://apps.komposta.net/jquery/navgoco/src/jquery.navgoco.js"></script>
<link rel="stylesheet" href="http://apps.komposta.net/jquery/navgoco/src/jquery.navgoco.css" type="text/css" media="screen" />
Use the following in a Custom PHP block:
global $cat_tree, $boards, $boardList, $scripturl, $sourcedir, $smcFunc;
require_once($sourcedir . '/Subs-Boards.php');
getBoardTree();
$temp_boards = $boards;
$request = $smcFunc['db_query']('', '
SELECT b.id_board
FROM {db_prefix}boards AS b
WHERE !({query_see_board})');
while ($row = $smcFunc['db_fetch_assoc']($request))
unset($temp_boards[$row['id_board']]);
$smcFunc['db_free_result']($request);
echo '
<ul class="nav">';
foreach ($cat_tree as $catid => $tree)
{
echo '
<li><a href="', $scripturl, '?action=forum#c', $tree['node']['id'], '">', $tree['node']['name'], '</a>';
if (!empty($boardList[$catid]))
{
echo '<ul>';
foreach ($boardList[$catid] as $key => $boardid)
{
if (empty($temp_boards[$boardid]))
continue;
$current_level = $boards[$boardid]['level'];
$next_level = isset($boardList[$catid][$key + 1]) ? $boards[$boardList[$catid][$key + 1]]['level'] : -1;
echo '
<li><a href="', $scripturl, '?board=', $boards[$boardid]['id'], '">', $boards[$boardid]['name'], '</a>';
if ($next_level > $current_level)
echo '<ul>';
else
echo '</li>';
if ($next_level < $current_level && $current_level != 0)
echo '</ul></li>';
elseif ($next_level < $current_level)
echo '</li>';
}
echo '</ul>';
}
echo '</li>';
}
echo '</ul>
<script type="text/javascript">
$(document).ready(function() {
$(".nav").navgoco();
});
</script>';
Have fun!
-
Thanks, I must have done something wrong. The boards show in the block, a bit different, but no collapsable tree.
I tried upload the plugin files to root-folder and changing the urls in index.template.php but no difference.
-
Yeah, you probably did something wrong, as I tested it before posting and it was working fine. Are you sure the code you put in the header is correct? (the URLs for the scripts) You can test this by using the code above, which relies on the demo site you gave the link to.
-
Yes, I think I made it right, but maybe you can have a look att the attached file?
The demo works fine on my server: http://dev.alternativ.nu/demo/index.html (http://dev.alternativ.nu/demo/index.html)
P.S the plugin is now updated for clickable parents, does anything need to be changed in the code?
-
Thanks for the navigation block.One gives xhtml errors.I would be glad if you correct this error.Hidden categories and boards, it would be better not to view in the navigation menu.Thanks.
You can look at my site for the error.
http://www.igo8navigation.com/index.php
-
kimyaci,
Most of your errors shown on that page are from improper attributes added to img tags. No one has supplied any block in this thread containing images. This appears to be something customized on your site that was done improperly but not related to any post here.
Regards.
-
When I remove the navigation block, the error message disappears.Thank you for your answer.
Regards
Error Message;
Line 2821, Column 83: end tag for "ul" which is not finished
…ref="http://www.igo8navigation.com/forum#c14">Private Section</a><ul></ul></li>
-
kimyaci,
You can try this block to see if it corrects the specific issue you reported:
global $cat_tree, $boards, $boardList, $scripturl, $sourcedir, $smcFunc;
require_once($sourcedir . '/Subs-Boards.php');
getBoardTree();
$temp_boards = $boards;
$request = $smcFunc['db_query']('', '
SELECT b.id_board
FROM {db_prefix}boards AS b
WHERE !({query_see_board})');
while ($row = $smcFunc['db_fetch_assoc']($request))
unset($temp_boards[$row['id_board']]);
$smcFunc['db_free_result']($request);
if (!empty($cat_tree))
echo '
<ul class="nav">';
foreach ($cat_tree as $catid => $tree)
{
echo '
<li>
<a href="', $scripturl, '?action=forum#c', $tree['node']['id'], '">', $tree['node']['name'], '</a>';
if (!empty($boardList[$catid]))
{
echo '
<ul>';
foreach ($boardList[$catid] as $key => $boardid)
{
if (empty($temp_boards[$boardid]))
continue;
$current_level = $boards[$boardid]['level'];
$next_level = isset($boardList[$catid][$key + 1]) ? $boards[$boardList[$catid][$key + 1]]['level'] : -1;
echo '
<li>
<a href="', $scripturl, '?board=', $boards[$boardid]['id'], '">', $boards[$boardid]['name'], '</a>';
if ($next_level > $current_level)
echo '
<ul>';
else
echo '
</li>';
if ($next_level < $current_level && $current_level != 0)
echo '
</ul>
</li>';
elseif ($next_level < $current_level)
echo '
</li>';
}
echo '
</ul>';
}
echo '</li>';
}
if (!empty($cat_tree))
echo '
</ul>';
echo '
<script type="text/javascript">
$(document).ready(function() {
$(".nav").navgoco();
});
</script>';
-
One got error message.Thanks.
Error Line 2791, Column 7: end tag for "ul" which is not finished
</ul></li>
-
kimyaci,
Try this out:
global $cat_tree, $boards, $boardList, $scripturl, $sourcedir, $smcFunc;
require_once($sourcedir . '/Subs-Boards.php');
getBoardTree();
$temp_boards = $boards;
$request = $smcFunc['db_query']('', '
SELECT b.id_board
FROM {db_prefix}boards AS b
WHERE !({query_see_board})');
while ($row = $smcFunc['db_fetch_assoc']($request))
unset($temp_boards[$row['id_board']]);
$smcFunc['db_free_result']($request);
if (!empty($cat_tree))
echo '
<ul class="nav">';
foreach ($cat_tree as $catid => $tree)
{
echo '
<li>
<a href="', $scripturl, '?action=forum#c', $tree['node']['id'], '">', $tree['node']['name'], '</a>';
if (!empty($boardList[$catid]))
{
echo '
<ul>';
foreach ($boardList[$catid] as $key => $boardid)
{
if (empty($temp_boards[$boardid]))
continue;
$current_level = $boards[$boardid]['level'];
$next_level = isset($boardList[$catid][$key + 1]) ? $boards[$boardList[$catid][$key + 1]]['level'] : -1;
echo '
<li>
<a href="', $scripturl, '?board=', $boards[$boardid]['id'], '">', $boards[$boardid]['name'], '</a>';
if ($next_level > $current_level)
echo '
<ul>';
else
echo '
</li>';
if ($next_level < $current_level && $current_level != 0)
echo '
</ul>
</li>';
elseif ($next_level > $current_level)
echo '
</li>';
}
echo '
</ul>';
}
echo '</li>';
}
if (!empty($cat_tree))
echo '
</ul>';
echo '
<script type="text/javascript">
$(document).ready(function() {
$(".nav").navgoco();
});
</script>';
-
Sorry, but gave 202 error message.Thanks.
-
kimyaci,
My validator does not show any errors for the last code provided.
-
kimyaci,
My validator does not show any errors for the last code provided.
Ok.Thank you very much.
-
Yes, I think I made it right, but maybe you can have a look att the attached file?
The demo works fine on my server: http://dev.alternativ.nu/demo/index.html (http://dev.alternativ.nu/demo/index.html)
P.S the plugin is now updated for clickable parents, does anything need to be changed in the code?
Any chance that you add the block and make it visible for guests, so I can test it myself?
-
Any chance that you add the block and make it visible for guests, so I can test it myself?
That would be very kind. It´s the top block in the right column at http://dev.alternativ.nu (http://dev.alternativ.nu) called "Träd".
-
Petter,
Try moving the javascript codes directly prior to </head> ...
ie.
<script type="text/javascript" src="http://code.jquery.com/jquery-latest.min.js"></script>
<script type="text/javascript" src="http://apps.komposta.net/jquery/navgoco/src/jquery.cookie.js"></script>
<script type="text/javascript" src="http://apps.komposta.net/jquery/navgoco/src/jquery.navgoco.js"></script>
<link rel="stylesheet" href="http://apps.komposta.net/jquery/navgoco/src/jquery.navgoco.css" type="text/css" media="screen" />
</head>
Failing that, try it in the SMF default theme (add script codes to its template) to see if the javascript that your custom theme is using is conflicting somehow.
-
Sorry, it did not work... I tried both.
-
Remove the edits to any theme template files. When you apply the following code within a PHP block, adjust the colors in the array at the top to your preference for aesthetics.
I found the provided colors did not look proper for some dark themes else the dynamic css may not be working. If the dynamic css is not working, I can manually add the attributes via style tags and omit the dynamic css file.
If this does not work for you (although it should), another option is to create 3 js files with the necessary content, put them into the default theme css folder and load them locally. Those files can then be edited if necessary (concerning css).
// Set the custom text colors within the array (this may be necessary for custom themes)
$customTextColors = array(
'board' => 'blue',
'child' => 'gray',
'bullet' => 'red'
);
echo '
<script type="text/javascript">
var link = document.createElement("link");
link.href = "http://apps.komposta.net/jquery/navgoco/src/jquery.navgoco.css";
link.rel = "stylesheet";
link.type = "text/css";
link.media = "screen";
document.getElementsByTagName("head")[0].appendChild(link);
document.write(\'<script type="text/javascript" src="http://code.jquery.com/jquery-latest.min.js"><\/script>\');
document.write(\'<script type="text/javascript" src="http://apps.komposta.net/jquery/navgoco/src/jquery.cookie.js"><\/script>\');
document.write(\'<script type="text/javascript" src="http://apps.komposta.net/jquery/navgoco/src/jquery.navgoco.js"><\/script>\');
</script>';
global $cat_tree, $boards, $boardList, $scripturl, $sourcedir, $smcFunc;
require_once($sourcedir . '/Subs-Boards.php');
getBoardTree();
$temp_boards = $boards;
$request = $smcFunc['db_query']('', '
SELECT b.id_board
FROM {db_prefix}boards AS b
WHERE !({query_see_board})');
while ($row = $smcFunc['db_fetch_assoc']($request))
unset($temp_boards[$row['id_board']]);
$smcFunc['db_free_result']($request);
if (!empty($cat_tree))
echo '
<ul id="mymenu2" class="nav">';
foreach ($cat_tree as $catid => $tree)
{
echo '
<li>
<a style="color:', $customTextColors['bullet'], ';" href="', $scripturl, '?action=forum#c', $tree['node']['id'], '"><strong style="display:inline-block;color:', $customTextColors['board'], ';">', $tree['node']['name'], '</strong></a>';
if (!empty($boardList[$catid]))
{
echo '
<ul>';
foreach ($boardList[$catid] as $key => $boardid)
{
if (empty($temp_boards[$boardid]))
continue;
$current_level = $boards[$boardid]['level'];
$next_level = isset($boardList[$catid][$key + 1]) ? $boards[$boardList[$catid][$key + 1]]['level'] : -1;
echo '
<li>
<a style="color:', $customTextColors['child'], ';" href="', $scripturl, '?board=', $boards[$boardid]['id'], '">', $boards[$boardid]['name'], '</a>';
if ($next_level > $current_level)
echo '
<ul>';
else
echo '
</li>';
if ($next_level < $current_level && $current_level != 0)
echo '
</ul>
</li>';
elseif ($next_level > $current_level)
echo '
</li>';
}
echo '
</ul>';
}
echo '</li>';
}
if (!empty($cat_tree))
echo '
</ul>';
echo '
<script type="text/javascript">
$(document).ready(function() {
$("#mymenu2").navgoco({accordion: true});
});
</script>';
Regards.
-
Yes!(http://www.alternativ.nu/petter/yess.gif)
Works perfect, now I only need to adjust the colors.
Many many thanks!
-
This is now a great block that I can recommend. :)
If someone find it useful, I found out that:
-If you don´t want the parents (categories) to be clickable, just opening, find:
<a style="color:', $customTextColors['bullet'], ';" href="', $scripturl, '?action=forum#c', $tree['node']['id'], '"><strong style="display:inline-block;color:', $customTextColors['board'], ';">', $tree['node']['name'], '</strong></a>';
Replace with:
<a style="color:', $customTextColors['bullet'], ';" href="#"><strong style="display:inline-block;color:', $customTextColors['board'], ';">', $tree['node']['name'], '</strong></a>';
-If you don´t want opened parent to close automatically when opening another, find:
$("#mymenu2").navgoco({accordion: true});
Replace with:
$("#mymenu2").navgoco({accordion: false});
--------------
Two things I have not found out is:
- where the small arrows are and how to edit the look of them.
- how to place them on the left side. "Float: left;" makes them push the link to the right. (attaching css file)
-
Petter,
New custom PHP block code:
global $cat_tree, $boards, $boardList, $scripturl, $sourcedir, $smcFunc, $settings;
// Set the custom text colors within the array (this may be necessary for custom themes)
$customTextColors = array(
'board' => 'white',
'child' => 'gray',
'bullet' => 'red'
);
echo '
<script type="text/javascript">
var link = document.createElement("link");
link.href = "', $settings['default_theme_url'], '/css/jquery.navgoco.css";
link.rel = "stylesheet";
link.type = "text/css";
link.media = "screen";
document.getElementsByTagName("head")[0].appendChild(link);
</script>
<script type="text/javascript" src="http://code.jquery.com/jquery-latest.min.js"></script>
<script type="text/javascript" src="http://apps.komposta.net/jquery/navgoco/src/jquery.cookie.js"></script>
<script type="text/javascript" src="', $settings['default_theme_url'], '/scripts/jquery.navgoco.js"></script>';
require_once($sourcedir . '/Subs-Boards.php');
getBoardTree();
$temp_boards = $boards;
$request = $smcFunc['db_query']('', '
SELECT b.id_board
FROM {db_prefix}boards AS b
WHERE !({query_see_board})');
while ($row = $smcFunc['db_fetch_assoc']($request))
unset($temp_boards[$row['id_board']]);
$smcFunc['db_free_result']($request);
if (!empty($cat_tree))
echo '
<ul id="mynavgoco_menu" class="nav">';
foreach ($cat_tree as $catid => $tree)
{
echo '
<li>
<a class="navgoco_xlinks" id="', $catid, '" style="color:', $customTextColors['bullet'], ';" href="', $scripturl, '?action=forum#c', $tree['node']['id'], '"><strong style="display:inline-block;color:', $customTextColors['board'], ';">', $tree['node']['name'], '</strong></a>';
if (!empty($boardList[$catid]))
{
echo '
<ul>';
foreach ($boardList[$catid] as $key => $boardid)
{
if (empty($temp_boards[$boardid]))
continue;
$current_level = $boards[$boardid]['level'];
$next_level = isset($boardList[$catid][$key + 1]) ? $boards[$boardList[$catid][$key + 1]]['level'] : -1;
echo '
<li>
<a style="color:', $customTextColors['child'], ';" href="', $scripturl, '?board=', $boards[$boardid]['id'], '">', $boards[$boardid]['name'], '</a>';
if ($next_level > $current_level)
echo '
<ul>';
else
echo '
</li>';
if ($next_level < $current_level && $current_level != 0)
echo '
</ul>
</li>';
elseif ($next_level > $current_level)
echo '
</li>';
}
echo '
</ul>';
}
echo '</li>';
}
if (!empty($cat_tree))
echo '
</ul>';
echo '
<script type="text/javascript">
$(document).ready(function() {
$("#mymenu2").navgoco({accordion: true});
});
</script>';
I attached 4 files that you can place in the following directories:
- jquery.nacgoco.css goes into folder: ../Themes/default/css
- jquery.navgoco.js goes into folder: ../Themes/default/scripts
- navgoco_expand.gif goes into folder: ../Themes/default/images
- navgoco_collapse.gif goes into folder: ../Themes/default/images
The files named navgoco_expand.gif & navgoco_collapse.gif are just copies of their equivalents from the default theme. You can change them to your own images whereas you just use the same file names & type (unless you want to edit the jquery.navgoco.js file to change the names).
I used some javascript to toggle the images although it can be done via the css file if preferred.
Try it out and let me know if it works for you.
Regards.
-
Petter,
Omit any edits, files and/or blocks concerning the Navgoco Menu and install the custom portal plugin from:
http://simpleportal.net/index.php?topic=13278.0
Regards.
-
Wow, that´s truly a great plugin you made!
Works like a charm. Unfortunatly I might not use it since I may put the nav-tree in a jquery mobile Panel instead of SP and in that case I´ll use the code you helped me with before.
One thing I haven´t figured out: how do I make parentboards not clickable, just opening submenu? See, my parentboards are empty.
I made this successfully with the categories by making href="#", doing the same to the parentboards opens the submenu correct without going to the board, but then the childboards are not clickable...
-
Petter,
You can still use updated versions of this plugin by installing the plugin provided in the other thread and using the code shown below. You will have to now include category id's for it because I neglected to have it view all of them when that part of the array is empty.
$parameters = array(
'boards' => '1|2|3',
'board_color' => 'cadetblue',
'child_color' => 'gray',
'current_color' => 'turquoise',
'board_hover' => '#BC58C9',
'child_hover' => '#F9D26D',
'toggle_color' => '#4169e1',
'expand' => 'expand.gif',
'collapse' => 'collapse.gif',
'direction' => 'right',
'display' => 'full',
'accordian' => true,
'default' => false,
);
global $sourcedir;
require_once($sourcedir . '/PortalNavgoco.php');
sp_navgoco($parameters, 0, false);
Edit-> Added options for default toggle icons native to version 1.2.
-
Thanks :)
Do you have a clue on how to fix the issue I mentioned? Making parentboards href="#" and just toggling the submenu?
-
Petter,
Please update the plugin to version 1.3 whereas it may now behave as you requested.
Regards.
-
As I see, this update makes the categories toggle the submenu when clicking the link. I already fixed that by making href="#" in
<a style="color:', $customTextColors['bullet'], ';" href="', $scripturl, '?action=forum#c', $tree['node']['id'], '"><strong style="display:inline-block;color:', $customTextColors['board'], ';">', $tree['node']['name'], '</strong></a>';
The thing is that I want to do the same with the parent boards (not categories) since they are empty = containing only child boards, no subjects.
Making href="#" in <a style="color:', $customTextColors['child'], ';" href="', $scripturl, '?board=', $boards[$boardid]['id'], '">', $boards[$boardid]['name'], '</a>';
works but then the childboard links don´t work either...
I want it to work like this:
>Category (clickling link just opens submenu)
>Board 1 (Has children = clicking link just opens submenu)
Childboard (clicking link goes to board)
Board 2 (Has no children = clicking link goes to board)
But I understand not everyone would like it like this, if they have subjects also in parentboards, as this board.
-
Petter,
The mod has been updated yet again although I did not increase the version number this time because their were few downloads since yesterday.
Here is the new code to use it manually:
$parameters = array(
'boards' => '1|2|3',
'board_color' => 'cadetblue',
'child_color' => 'gray',
'current_color' => 'turquoise',
'board_hover' => '#BC58C9',
'child_hover' => '#F9D26D',
'toggle_color' => '#4169e1',
'expand' => 'expand.gif',
'collapse' => 'collapse.gif',
'direction' => 'right',
'display' => 'full',
'accordian' => true,
'c_anchor' => false,
'b_anchor' => false,
'default' => false,
);
global $sourcedir;
require_once($sourcedir . '/PortalNavgoco.php');
sp_navgoco($parameters, 0, false);
c_anchor and b_anchor now give the options to anchor the categories and/or boards. I agree with your request to anchor boards void of topics to the board index so I made that feature default within the file's code.
Regards.
-
Sorry, that did not work.
I have found another issue (have only tried in code above, not your mod): when logging out/in and some new boards become available or not, things get screwed up. Categories becomes childboards to boards.
I think it´s the cookie that needs to be reset, when logging in/out?
I saw there´s a destroy-command, is that for reseting the navgoco-cookie?
-
Petter,
I had updated the plugin with your requested changes but not the block codes located in this thread. Therefore if you want it to behave as you requested you will need to download and install the plugin but instead of using the prefab block provided, you should use the php code contained in my last post to use its function.
-
Yes, I did use the mod, of course. I found that regardless of if I tick "Anchor Selected Board", the parent board shows no arrow and links to /index.php?action=forum;#board_XX
instead of just toggling submenu.
-
Petter,
Since you are using the manually adjusted block code (as shown ~here~ (http://simpleportal.net/index.php?topic=1532.msg65723#msg65723)) as opposed to the prefab block, you will need to adjust the array for your specific settings. For example to have the boards and categories anchored you set those values to true as shown below:
(whole block code provided below)
$parameters = array(
'boards' => '1|2|3',
'board_color' => 'cadetblue',
'child_color' => 'gray',
'current_color' => 'turquoise',
'board_hover' => '#BC58C9',
'child_hover' => '#F9D26D',
'toggle_color' => '#4169e1',
'expand' => 'expand.gif',
'collapse' => 'collapse.gif',
'direction' => 'right',
'display' => 'full',
'accordian' => true,
'c_anchor' => true,
'b_anchor' => true,
'default' => false,
);
global $sourcedir;
require_once($sourcedir . '/PortalNavgoco.php');
sp_navgoco($parameters, 0, false);
.. do not forget to adjust other settings such as board id's, colors, etc.
-
No, I tried with the prefab block with correct settings in the SP admin. Does it work OK for you?