PDA

View Full Version : How do I change navbit code?


oooh em geee
12-02-2009, 10:16 PM
I have the following code for a custom page called staff.php:
<?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 :

<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:
$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?