collapse

* Simple Portal Archived Forum

This is an Archive Forum.

The content in this forum may be out-of-date or have been superseded by newer information, and links in forum pages to other sites may not work.
This forum contains archives for future reference.

Visit our thread at Simple Machines Forum for current support.

SMF 2.1 users: EhPortal is a ported version of Simple Portal specifically designed for the SMF 2.1 branch.
Please visit web-develop.ca to download EhPortal and for its support.

* User Info

 
 
Welcome, Guest. Please login or register.

* Who's Online

  • Dot Guests: 438
  • Dot Hidden: 0
  • Dot Users: 0

There aren't any users online.

* Shoutbox

Refresh History
  • Shoutbox is not for support!
  • {OCS}MasterSeal: Yup, Still adore SP
    April 21, 2019, 07:08:06 PM
  • {OCS}MasterSeal: STILL love SP :)
    November 24, 2018, 05:05:50 AM
  • ♦ Ninja ZX-10RR ♦: <3 aegersz
    September 13, 2018, 03:36:09 PM
  • aegersz: I STILL <3 LOVE SimplePortal
    September 13, 2018, 07:11:39 AM
  • aegersz: o LOVE you guys - Simple Portal rocks !
    May 09, 2018, 05:18:59 AM
  • Chen Zhen: our apologies for the site being down.. please read server issues topic
    March 22, 2018, 05:32:38 AM
  • {OCS}MasterSeal: LOL PLEASE forget I just posted that. I found the answer in my own dang post back in 2015. lol sorry!
    July 04, 2017, 10:47:55 PM
  • {OCS}MasterSeal: I know this SB isnt' for support, but I just have a general question. Who would I contact to find out where SP stores its block info? Is it DB driven or files? I searched the site but came up with nothing. probably my fault any insight is appreciated.
    July 04, 2017, 10:43:36 PM
  • ♦ Ninja ZX-10RR ♦: Excuse me but what does Simpleportal have to deal with that?
    February 05, 2017, 08:21:14 PM
  • WhiteEagle: of course IMHO that site appears to be dead :(
    February 04, 2017, 01:08:05 PM
  • WhiteEagle: If I can get that, then I'll use it for that site...
    February 04, 2017, 01:07:35 PM
  • WhiteEagle: decided to not use SMF for any projects, unless I can get a copy of the premium version of the fanfiction archive plugin
    February 04, 2017, 01:06:54 PM
  • expertdecisions: cloudflare
    January 28, 2017, 08:01:47 AM
  • aegersz: SM release 2.0.13 !
    January 12, 2017, 06:00:13 AM
  • raffo: Tks Emanuele, even if I didn't understand the fix :D
    November 07, 2016, 02:01:20 AM
  • emanuele: [link]
    November 01, 2016, 12:43:50 PM
  • emanuele: raffo: the English support board is a good place. ;)
    November 01, 2016, 12:43:38 PM
  • raffo: Where can I find the fix for the shoutbox?
    November 01, 2016, 05:06:09 AM
  • {OCS}MasterSeal: To the SP team, I make a point to come here and thank you as much as possible for your work.  so again, THANK YOU!
    October 28, 2016, 10:38:05 AM
  • emanuele: That's indeed funny, the limit is present only in the patch and not the full install.
    October 22, 2016, 06:14:58 PM

* Recent Posts

Adding Forums Button to Nav bar by jirapon
[August 01, 2019, 09:07:12 AM]


Re: Board Icons by ♦ Ninja ZX-10RR ♦
[July 30, 2019, 04:03:41 PM]


MOVED: Czech translation???? by ♦ Ninja ZX-10RR ♦
[July 30, 2019, 03:04:51 PM]


Board Icons by jirapon
[July 30, 2019, 07:28:44 AM]


Re: Thankyou Simpleportal, by ♦ Ninja ZX-10RR ♦
[July 29, 2019, 09:41:29 AM]

Blocks speak! Do you have an interest in getting more blocks - or even making your own? The Blocks Board is for you!

Author Topic: SP Navigation Block.  (Read 78040 times)

0 Members and 3 Guests are viewing this topic.

Offline Petter

  • Jr. Member
  • **
  • Posts: 53
  • SMF Version: 2 RC2
  • SP Version: 2.3.1
Re: SP Navigation Block.
« Reply #40 on: March 05, 2014, 01:07:37 AM »
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  :-*

Offline [SiNaN]

  • Mr. SimplePortal
  • Developer
  • *
  • Posts: 6782
  • SMF Version: 2.0.15
  • SP Version: 2.3.7
Re: SP Navigation Block.
« Reply #41 on: March 06, 2014, 08:25:49 AM »
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:

Code: [Select]
<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:

Code: [Select]
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!
And slowly, you come to realize... It's all as it should be...

Offline Petter

  • Jr. Member
  • **
  • Posts: 53
  • SMF Version: 2 RC2
  • SP Version: 2.3.1
Re: SP Navigation Block.
« Reply #42 on: March 07, 2014, 09:41:33 AM »
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.

Offline [SiNaN]

  • Mr. SimplePortal
  • Developer
  • *
  • Posts: 6782
  • SMF Version: 2.0.15
  • SP Version: 2.3.7
Re: SP Navigation Block.
« Reply #43 on: March 07, 2014, 09:53:07 AM »
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.
And slowly, you come to realize... It's all as it should be...

Offline Petter

  • Jr. Member
  • **
  • Posts: 53
  • SMF Version: 2 RC2
  • SP Version: 2.3.1
Re: SP Navigation Block.
« Reply #44 on: March 10, 2014, 06:14:07 AM »
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

P.S the plugin is now updated for clickable parents, does anything need to be changed in the code?

Offline kimyaci

  • Full Member
  • ***
  • Posts: 127
  • Gender: Male
    • Forumigo8navigation
  • SMF Version: 2.0.7
  • SP Version: 2.3.5
Re: SP Navigation Block.
« Reply #45 on: March 13, 2014, 08:53:19 PM »
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
SMF 2.0.7 HabboArtv1, Default Themes.

Offline Chen Zhen

  • The Underdog
  • Operations Manager
  • *
  • Posts: 1350
  • Gender: Male
  • Kinesis
    • WebDev
  • SMF Version: 2.1
  • EhPortal Version: 1.22
Re: SP Navigation Block.
« Reply #46 on: March 13, 2014, 09:17:16 PM »

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.

Offline kimyaci

  • Full Member
  • ***
  • Posts: 127
  • Gender: Male
    • Forumigo8navigation
  • SMF Version: 2.0.7
  • SP Version: 2.3.5
Re: SP Navigation Block.
« Reply #47 on: March 13, 2014, 09:30:47 PM »
When I remove the navigation block, the error message disappears.Thank you for your answer.

Regards

Error Message;
Code: [Select]
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>
SMF 2.0.7 HabboArtv1, Default Themes.

Offline Chen Zhen

  • The Underdog
  • Operations Manager
  • *
  • Posts: 1350
  • Gender: Male
  • Kinesis
    • WebDev
  • SMF Version: 2.1
  • EhPortal Version: 1.22
Re: SP Navigation Block.
« Reply #48 on: March 13, 2014, 11:45:43 PM »
kimyaci,

You can try this block to see if it corrects the specific issue you reported:

Code: [Select]
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>';

Offline kimyaci

  • Full Member
  • ***
  • Posts: 127
  • Gender: Male
    • Forumigo8navigation
  • SMF Version: 2.0.7
  • SP Version: 2.3.5
Re: SP Navigation Block.
« Reply #49 on: March 14, 2014, 06:20:44 AM »
One got error message.Thanks.

Error Line 2791, Column 7: end tag for "ul" which is not finished

      </ul></li>
SMF 2.0.7 HabboArtv1, Default Themes.

Offline Chen Zhen

  • The Underdog
  • Operations Manager
  • *
  • Posts: 1350
  • Gender: Male
  • Kinesis
    • WebDev
  • SMF Version: 2.1
  • EhPortal Version: 1.22
Re: SP Navigation Block.
« Reply #50 on: March 14, 2014, 09:33:05 AM »

kimyaci,

Try this out:
Code: [Select]
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>';

Offline kimyaci

  • Full Member
  • ***
  • Posts: 127
  • Gender: Male
    • Forumigo8navigation
  • SMF Version: 2.0.7
  • SP Version: 2.3.5
Re: SP Navigation Block.
« Reply #51 on: March 14, 2014, 09:59:29 AM »
Sorry, but gave 202 error message.Thanks.
SMF 2.0.7 HabboArtv1, Default Themes.

Offline Chen Zhen

  • The Underdog
  • Operations Manager
  • *
  • Posts: 1350
  • Gender: Male
  • Kinesis
    • WebDev
  • SMF Version: 2.1
  • EhPortal Version: 1.22
Re: SP Navigation Block.
« Reply #52 on: March 14, 2014, 02:32:17 PM »
kimyaci,

  My validator does not show any errors for the last code provided.

Offline kimyaci

  • Full Member
  • ***
  • Posts: 127
  • Gender: Male
    • Forumigo8navigation
  • SMF Version: 2.0.7
  • SP Version: 2.3.5
Re: SP Navigation Block.
« Reply #53 on: March 15, 2014, 05:36:11 AM »
kimyaci,

  My validator does not show any errors for the last code provided.

Ok.Thank you very much.
SMF 2.0.7 HabboArtv1, Default Themes.

Offline [SiNaN]

  • Mr. SimplePortal
  • Developer
  • *
  • Posts: 6782
  • SMF Version: 2.0.15
  • SP Version: 2.3.7
Re: SP Navigation Block.
« Reply #54 on: March 15, 2014, 10:10:01 AM »
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

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?
And slowly, you come to realize... It's all as it should be...

Offline Petter

  • Jr. Member
  • **
  • Posts: 53
  • SMF Version: 2 RC2
  • SP Version: 2.3.1
Re: SP Navigation Block.
« Reply #55 on: March 16, 2014, 02:51:22 PM »
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 called "Träd".
« Last Edit: March 16, 2014, 04:58:21 PM by Petter »

Offline Chen Zhen

  • The Underdog
  • Operations Manager
  • *
  • Posts: 1350
  • Gender: Male
  • Kinesis
    • WebDev
  • SMF Version: 2.1
  • EhPortal Version: 1.22
Re: SP Navigation Block.
« Reply #56 on: March 16, 2014, 04:55:58 PM »
Petter,

  Try moving the javascript codes directly prior to </head> ...

ie.
Code: [Select]
<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.

« Last Edit: March 16, 2014, 09:20:24 PM by Underdog »

Offline Petter

  • Jr. Member
  • **
  • Posts: 53
  • SMF Version: 2 RC2
  • SP Version: 2.3.1
Re: SP Navigation Block.
« Reply #57 on: March 17, 2014, 05:16:26 AM »
Sorry, it did not work... I tried both.

Offline Chen Zhen

  • The Underdog
  • Operations Manager
  • *
  • Posts: 1350
  • Gender: Male
  • Kinesis
    • WebDev
  • SMF Version: 2.1
  • EhPortal Version: 1.22
Re: SP Navigation Block.
« Reply #58 on: March 17, 2014, 06:31:28 PM »
  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).

Code: [Select]
// 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.
« Last Edit: March 17, 2014, 10:24:17 PM by Underdog »

Offline Petter

  • Jr. Member
  • **
  • Posts: 53
  • SMF Version: 2 RC2
  • SP Version: 2.3.1
Re: SP Navigation Block.
« Reply #59 on: March 18, 2014, 02:29:39 AM »
Yes!
Works perfect, now I only need to adjust the colors.
Many many thanks!