vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3.0 Full Releases (https://vborg.vbsupport.ru/forumdisplay.php?f=33)
-   -   vBa CMPS: Dynamic Navigation menu - all your Custom CMPS Pages (https://vborg.vbsupport.ru/showthread.php?t=67953)

Natch 08-02-2004 10:00 PM

vBa CMPS: Dynamic Navigation menu - all your Custom CMPS Pages
 
What this does: creates a Navigation menu (best as a left or right side block) which is populates automagically by the custom pages you have inserted into your CMPS. It should only show the user the pages that they have permissions to view.

Step 1: create and upload a new module modules/navmenu.php with the contents
PHP Code:

<?
// edit this var if you wish a custom name for your homepage link
$homepage_name = $vboptions[hometitle];
// end var editing
$nav_menus = $DB_site->query("SELECT pageid,name,title,userperms FROM " . TABLE_PREFIX . "adv_pages");
while($nav_menu = $DB_site->fetch_array($nav_menus))
{
    $title = ($nav_menu['pageid']==1) ? $homepage_name : $nav_menu['title'];
    $groupperms = explode(",",$nav_menu['userperms']);
    $membrperms = fetch_membergroupids_array($bbuserinfo);
    foreach($membrperms as $usergroup)
    {
        if(in_array($usergroup,$groupperms) && ($pagename != $nav_menu['name']))
        {
            $bgclass = exec_switch_bg(1);
            $pagename = $nav_menu['name'];
            eval('$pages_menubits .= "' . fetch_template('adv_portal_pagesmenubits') . '";');
        }
    }
}
eval('$home[$mods[\'modid\']][\'content\'] = "' . fetch_template('adv_portal_pagesmenu') . '";');
?>

Step 2: Create a new template adv_portal_pagesmenu with the contents:
Code:

<table align="center" border="0" cellpadding="$stylevar[cellpadding]" cellspacing="$stylevar[cellspacing]" class="tborder" width="100%">
<thead>
 <tr>
  <td class="tcat">
    <a style="float:$stylevar[right]" href="#top" onclick="return toggle_collapse('cmps_pagesmenu')"><img id="collapseimg_cmps_pagesmenu" src="$stylevar[imgdir_button]/collapse_thead$vbcollapse[collapseimg_cmps_pagesmenu].gif" alt="" border="0" /></a>
    <span class="smallfont"><strong>$vba_options[portal_blockbullet] Navigation</strong></span>
  </td>
 </tr>
</thead>
<tbody id="collapseobj_cmps_pagesmenu" style="$vbcollapse[collapseobj_cmps_pagesmenu];text-align:$stylevar[left]">
$pages_menubits
</tbody>
</table>
<br />

Step 3: Create a new template adv_portal_pagesmenubits with the contents:
Code:

<tr>
        <td class="$bgclass" style="text-align:right">
                <span class="smallfont">
                <!-- edit this entry to alter the index.php if your cmps portal has a different filename -->
                <a href="$vboptions[homeurl]/index.php?$session[sessionurl]<if condition="$pagename!=home">$vba_options[portal_pagevar]=$pagename</if>" title="link to $title page">$title</a>
                </span>
        </td>
</tr>

Step 4: Create a new CMPS module, with the following settings (other than the defaults):
Module Title: Page Navigation
File To Include: navmenu.php
Templates used: adv_portal_pagesmenu, adv_portal_pagesmenubits

HTH y'all :) I like it ;)

Demo <= this shows only one link available due to Guest permissions
Login with test/testicular to see the menu populate with extra pages

EDIT:// Altered the module; if you have installed this prior to now, please update the contents of your module with the edited one above.

Andreas 08-03-2004 01:24 PM

Doesn't belong to the hack but: Which journal script are you using? Looks nice :)

Natch 08-03-2004 01:37 PM

Found on www.bearfacts2.com - Boofo's site - they are working on it over there :)

OblivionKnight, sabert00the, Bane and Boofo (hope I didn't leave anyone out)

Silverdawn222 08-03-2004 01:52 PM

Loving this hack! Also, regarding the Journal hack on the site you mentioned: don't see it. Can you tell me where to look?

Natch 08-03-2004 02:41 PM

Upfdated to get rid of a small bug: if you are getting multiple instances of each item for users who are in more than one usergroup, please update your module with the module code in the first post.

Polo 08-03-2004 03:07 PM

yup, nice hack and nice journal too....

weirdpixels 08-03-2004 03:56 PM

nice hack!
*clicks install

Silverdawn222 08-03-2004 04:53 PM

Fix works, thanks. Also, I still don't see the journal. :) I know that's not what this thread is for, but I'm really wondering.

Andreas 08-03-2004 04:54 PM

@Silverdawn222
http://www.bearfacts2.com/forums/showthread.php?t=804

NuclioN 08-03-2004 05:15 PM

woow this is one step further to get a function i once mentioned...links that open content in the centerblock and in that content a respond/comment field on newsitems from external cms progs. :)

Silverdawn222 08-03-2004 05:15 PM

Hi,

Can't seem to visit that thread, even when I register... But thanks. :)

House_of_Crazed 08-03-2004 06:38 PM

Yea, same here.

I suspect that Boofo will verify people as being members here since he is also a Moderator here and I'm sure he has the capability of seeing if they are verified & etc...

HoC

NuclioN 08-04-2004 01:13 AM

Natch how to get the result of links in the centerblock as in your example?

Natch 08-04-2004 09:15 AM

I'm not sure I understand the question - there's nothing in my hack that is not in standard CMPS - it's just Custom Pages - I am just parsing the adv_pages table for userperms and pages and outputting an array of links...

NuclioN 08-04-2004 11:44 AM

Then i hope you specify the use of this function a bit better because when i add urls in the template they all open in blanc pages, not in the center block. Maybe i'm missing something. :)

Natch 08-04-2004 11:56 AM

You don't add URL's in the template ... that's the whole point!

1. Do you have the CMPS installed?
2. Do you have any custom pages installed?

You can install this, leave the DEFAULT templates, and you will have a navigation menu with all your custom CMPS pages added.

If you want to add new links to this (NOT SUPPORTED - this is not the point of this hack), you will need to ensure they have target="_parent" in the <a href definition or you will open links in new pages (as per the default vB behaviour...

NuclioN 08-04-2004 12:14 PM

DMPS? You mean CMPS.... :D It looks i have to look more often on the vbadvanced homepage

Natch 08-04-2004 01:53 PM

Do you have a serious question?

NuclioN 08-04-2004 01:59 PM

Yes i have. Now this is installed i can't see how to create new links to it that open content in centerblocks as on your example site.

Natch 08-04-2004 02:58 PM

I suggest you read the manual for CMPS - in your CMPS admin cp you have the facility to "Create Page" - this will call on a new template, or simply a construction based on the modules you have already installed ...

Well if you create a template and add that intothe page definition up the top there,m then that tempalte's contents will go intothe place of the "Custom PAge Content" module in the center at the top of your custom page ...

Make sense ?

Now I had heaps of content from my old vBindex install - I just used those templates for my custom pages - I have customised this hack to not list all the custom pages - I have about 50 extra pages that are linked behind the "Tutorials" vB dropdown menu - this menu is populated automagically using a different script I dev'ed up. So my version of this has an extra bit that adds AND !strstr("tut-",$pagename) to the determination of the items for the menu so that these aren't displayed in the NAvigation menu - but that's just for me - you can see far more Custom Page content by looking at the Tutorials menu...

I hoppe that makes things a bit clearer.

NuclioN 08-04-2004 06:02 PM

Getting closer to understand this, tnx Natch ;)

opus 08-06-2004 10:07 PM

can someone give me a link to the journal?

weirdpixels 08-11-2004 12:30 PM

Great hack btw this is going to be very useful, but I have a problem with it

Its fine when adding a page that just includes standard html, but I have just tried to add a page with a java page redirect script, the page itself works fine, but it does not get added to this page nav module.
Do you know if you could fix this. I really need this as I use the redirect script to take the user to my forums

Thanks

Natch 08-12-2004 12:03 AM

If you added the page in as a part of the CMPS script (as in AdminCP -> vBa CMPS -> Add Page) then it should work - I don't understand how you have added the page isf you didn't add it this way.

weirdpixels 08-12-2004 08:47 AM

I did actually add it that way, well i just saved the page again and its working now, thanks

Natch 08-12-2004 03:46 PM

NP - glad u got it working :D

venomx 09-06-2004 11:19 AM

arghhhhh this isnt working for me... :(

venomx 09-06-2004 11:28 AM

Got it to work... Odd... I had to edit each page and click the "All Yes" in Usergroups and ssave it even though all were set to yes....

venomx 09-22-2004 08:02 PM

Ok I moved my site to a new server. Everything works except the cmps_index.php if I turn this or the Featured Article mods on. I have removed both and reinstalled and the cmps_index.php still shows up as a white page if either is turned on. Ideas?

Natch 09-22-2004 10:07 PM

White page as a general rule means missing templates - some hacks require you to re-install the templates - take a look at the Articles Hack installer and the CMPS installer - they both have "Re-install templates" options for upgrading...

venomx 09-22-2004 10:24 PM

Already redid the CMPS ones... :(

Mattius 09-24-2004 11:35 AM

Actually i found its not the templates, its the module that you have to make up that causes the blank page from my experience...not sure how you overcome that yet.

venomx 09-24-2004 01:59 PM

Well I had to remove it altogether. No use it taking up space when I cant get it to work again. :(

Blam Forumz 09-25-2004 03:00 PM

i dont get the box appearing....
I followed everything 100%

Blam Forumz 09-25-2004 03:11 PM

ok it did work, but nothings in the box

Natch 09-27-2004 05:17 AM

All this script does is create a list of the pages you have installed for your CMPS system - if you don't use the extra pages feature or you don't use CMPS then this is of no use to you.

Please check that your current style has the new template, and that you have got the module in place.

Please also post the site url's or PM them if you are still having problems.

Blam Forumz 09-27-2004 05:37 AM

<a href="http://www.blaminator.co.uk" target="_blank">www.blaminator.co.uk</a>

I had to make my own silly navigation menu, yours is a few blocks down, its jsut blank

yes i do have other pages

Natch 09-27-2004 05:54 AM

OK - can you give me temp acces to your AdminCP - cos at the moment I cannot see how you could have my script installed and the tempaltes installed correctly without them showing up: there is nothing complicated in this script.

Mattius 10-08-2004 08:02 AM

Natch the menu works fine, but have you got any examples of creating submenus with it...say i want to have

vb Tutorials Section
- CMPS hacks
- vb hacks
- my life story

Natch 10-08-2004 10:18 AM

Well, that would defintely go beyond the scope of this, as all pages in the CMPS are on one level.

One could create multi-dimensional menus, but it would require you manually dividing up your CPMPS apges into groups somehow: possibly by giving all tempaltes of items in the same group an identical prefix...

eg:
adv_portal_tut_tutorial1
adv_portal_tut_tutorial2
adv_portal_tut_tutorial3
adv_portal_faq_faq1
adv_portal_faq_faq2
adv_portal_faq_faq3

Then you can add a filter into the module to parse each group into a separate array, then walking thru each array inside a UL...


All times are GMT. The time now is 05:46 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01130 seconds
  • Memory Usage 1,820KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (2)bbcode_code_printable
  • (1)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (40)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete