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: 384
  • 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 78033 times)

0 Members and 1 Guest are viewing this topic.

Offline Petter

  • Jr. Member
  • **
  • Posts: 53
  • SMF Version: 2 RC2
  • SP Version: 2.3.1
Re: SP Navigation Block.
« Reply #60 on: March 18, 2014, 08:17:20 AM »
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:
Code: [Select]
<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:
Code: [Select]
<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:
Code: [Select]
    $("#mymenu2").navgoco({accordion: true});Replace with:
Code: [Select]
    $("#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)
« Last Edit: March 22, 2014, 07:45:24 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 #61 on: March 19, 2014, 12:27:26 AM »
Petter,

New custom PHP block code:
Code: [Select]
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.




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 #62 on: March 24, 2014, 11:12:14 PM »
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.
 

Offline Petter

  • Jr. Member
  • **
  • Posts: 53
  • SMF Version: 2 RC2
  • SP Version: 2.3.1
Re: SP Navigation Block.
« Reply #63 on: March 25, 2014, 12:10:24 PM »
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...



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 #64 on: March 26, 2014, 06:08:52 PM »
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.

Code: [Select]
$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.
« Last Edit: March 28, 2014, 10:39:56 AM by Underdog »

Offline Petter

  • Jr. Member
  • **
  • Posts: 53
  • SMF Version: 2 RC2
  • SP Version: 2.3.1
Re: SP Navigation Block.
« Reply #65 on: March 28, 2014, 05:38:50 AM »
Thanks  :)
Do you have a clue on how to fix the issue I mentioned? Making parentboards href="#" and just toggling the submenu?

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 #66 on: April 01, 2014, 12:40:05 AM »
Petter,

  Please update the plugin to version 1.3 whereas it may now behave as you requested.

Regards.

Offline Petter

  • Jr. Member
  • **
  • Posts: 53
  • SMF Version: 2 RC2
  • SP Version: 2.3.1
Re: SP Navigation Block.
« Reply #67 on: April 01, 2014, 01:40:17 AM »
As I see, this update makes the categories toggle the submenu when clicking the link. I already fixed that by making href="#" in
Code: [Select]
<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
Code: [Select]
   <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.

« Last Edit: April 01, 2014, 02:01:56 AM 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 #68 on: April 01, 2014, 07:21:14 PM »
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:
Code: [Select]
$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.

Offline Petter

  • Jr. Member
  • **
  • Posts: 53
  • SMF Version: 2 RC2
  • SP Version: 2.3.1
Re: SP Navigation Block.
« Reply #69 on: April 10, 2014, 03:31:52 PM »
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?

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 #70 on: April 13, 2014, 10:53:37 PM »
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.

Offline Petter

  • Jr. Member
  • **
  • Posts: 53
  • SMF Version: 2 RC2
  • SP Version: 2.3.1
Re: SP Navigation Block.
« Reply #71 on: April 14, 2014, 01:41:28 AM »
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.

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 #72 on: April 15, 2014, 10:59:11 PM »
Petter,

Since you are using the manually adjusted block code (as shown ~here~) 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)
Code: [Select]
$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.
« Last Edit: April 15, 2014, 11:01:49 PM by Underdog »

Offline Petter

  • Jr. Member
  • **
  • Posts: 53
  • SMF Version: 2 RC2
  • SP Version: 2.3.1
Re: SP Navigation Block.
« Reply #73 on: April 16, 2014, 02:21:50 AM »
No, I tried with the prefab block with correct settings in the SP admin. Does it work OK for you?