vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB4 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=252)
-   -   How do I change navbit code? (https://vborg.vbsupport.ru/showthread.php?t=229377)

oooh em geee 12-02-2009 10:16 PM

How do I change navbit code?
 
1 Attachment(s)
I have the following code for a custom page called staff.php:
PHP Code:

<?php

// ####################### SET PHP ENVIRONMENT ###########################
error_reporting(E_ALL & ~E_NOTICE);

// #################### DEFINE IMPORTANT CONSTANTS #######################

define('THIS_SCRIPT''staff');
define('CSRF_PROTECTION'true);  
// change this depending on your filename

// ################### PRE-CACHE TEMPLATES AND DATA ######################
// get special phrase groups
$phrasegroups = array();

// get special data templates from the datastore
$specialtemplates = array();

// pre-cache templates used by all actions
$globaltemplates = array('staff',
);

// pre-cache templates used by specific actions
$actiontemplates = array();

// ######################### REQUIRE BACK-END ############################
require_once('./global.php');

// #######################################################################
// ######################## START MAIN SCRIPT ############################
// #######################################################################

$navbits construct_navbits(array('' => 'Staff'));
$navbits[$parent] = 'Test Page';
$navbar render_navbar_template($navbits);

// ###### YOUR CUSTOM CODE GOES HERE #####
$pagetitle 'My Page Title';

// ###### NOW YOUR TEMPLATE IS BEING RENDERED ######

$templater vB_Template::create('staff');
$templater->register_page_templates();
$templater->register('navbar'$navbar);
$templater->register('pagetitle'$pagetitle);
print_output($templater->render());

?>

How can I make 'About HUD' appear in front of 'Staff' in the navbit area? I want 'About HUD' to show in front of 'Staff' in the navbit area, because 'Staff' is a Sublink of 'About HUD'.
See images as reference.

Lynne 12-03-2009 03:47 AM

Weird thing is it used to be there in an early beta and users complained about it being there and so it was taken out. Since the code was changed so it won't show up there any longer, I think you will have to manually add it into your navbar template. Basically write a condition that says "if not on content page (that is the cms page), then show this....." and put the link there. I think that would be :

HTML Code:

<vb:if condition="THIS_SCRIPT != 'vbcms'">
link here
</vb:if>

(Or use whatever condition you use to make the About HUD link active in the navbar.)

Mythotical 12-11-2009 11:12 PM

Here is what your looking for:
PHP Code:

$navbits construct_navbits(array('filename.php' => 'About HUD''filename.php?' $vbulletin->session->vars['sessionurl'] . 'do=staff' => 'Staff'));
$navbar render_navbar_template($navbits); 

That will get the results you want without using an if condition.

Jaxel 03-29-2010 03:46 AM

This solution doesn't work for me... I need a way to add navbits in DIFFERENT lines, not a single line. You could do this in VB3, how do you do this in VB4?


All times are GMT. The time now is 01:10 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.03727 seconds
  • Memory Usage 1,730KB
  • 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
  • (1)bbcode_html_printable
  • (2)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (4)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
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete