Jump to content
php.lv forumi

Palidziet


suport

Recommended Posts

te var apstities ko es vellos http://cs.elcont.lv/help.jpg ..!

 

Un te ir tie divi faili kurus man teica ka japarveido lai butu parasts menu !

 

includes/navigationbar.class.php

 

<?php
if (!defined("IN_REVISION")) { header("Location: ../../../index.php"); exit; }

class RevisionNBAR {
var $mopen = false;
var $sopen = false;
var $constucted = false;
var $locked = false;
var $content = '';
var $temp = '';

function construct() {
	if ($this->constucted) 
		return;

	$this->content = "<div id='navBar'><div id='navBarOverlay'><ul id='menu'>";
	$this->constucted = true;
}

function newlink() {
	if ($this->locked) 
		return;

	$numargs = func_num_args();
	if ($numargs < 2)
		return;

	$name = func_get_arg(0);
	$title = ($numargs > 2 ? func_get_arg(1) : false);
	$url = ($numargs > 2 ? func_get_arg(2) : func_get_arg(1));

	if (preg_match('#(http://|ftp://|https://|ftps://|irc://)#si', $url))
		$url = " href='".$url."' target='_blank'";
	else
		$url = " href='".BASEDIR.$url."'";

	if (($this->mopen) && ($this->sopen)) { 
		$this->content .= $this->temp."</ul></li>";
	}
	$this->mopen = false;
	$this->sopen = false;		

	if (!$this->constucted)
		$this->construct();

	$this->content .= "<li class='link'><a onmousedown='return false;' ".$url.($title ? " title='".$title."'" : "").">".$name."</a></li>";
}

function newmenu() {
	if ($this->locked) 
		return;

	$numargs = func_num_args();
	if ($numargs < 1)
		return;

	$name = func_get_arg(0);
	$title = ($numargs > 1 ? func_get_arg(1) : false);

	if (!$this->constucted)
		$this->construct();

	if (($this->mopen) && ($this->sopen)) { 
		$this->content .= $this->temp."</ul></li>";
		$this->mopen = false;
		$this->sopen = false;		
	}

	$this->mopen = true;
	$this->temp = "<li class='menu'><p".($title ? " title='".$title."'" : "").">".$name."</p><ul class='submenu'>";
}

function submenu() {
	if (($this->locked) || (!$this->mopen))
		return;

	$numargs = func_num_args();
	if ($numargs < 3)
		return;

	$name = func_get_arg(0);
	$title = ($numargs > 3 ? func_get_arg(1) : false);
	$url = ($numargs > 3 ? func_get_arg(2) : func_get_arg(1));
	$divider = ($numargs > 3 ? func_get_arg(3) : func_get_arg(2));

	if (preg_match('#(http://|ftp://|https://|ftps://|irc://)#si', $url))
		$url = " href='".$url."' target='_blank'";
	else
		$url = " href='".BASEDIR.$url."'";

	if (($divider != 1) && ($divider != 0))
		$divider = 0;

	$this->sopen = true;
	$this->temp .= "<li><a onmousedown='return false;'".($divider == 1 ? " class='divider'" : "")."".$url."".($title ? " title='".$title."'" : "").">".$name."</a></li>";
}

function generate() {
	if (($this->locked) || (!$this->constucted)) 
		return;

	if (($this->mopen) && ($this->sopen)) { 
		$this->content .= $this->temp."</ul></li>";
	}

	echo $this->content."</ul><div id='clearmenu'></div></div></div>\n";
	$this->locked = true;
}
}

$rtNavbar = new RevisionNBAR();
?>

 

 

un otris theme_config.php < kur tipa var pievienot tos submenu un menu !

 

// Navigation Bar
$rtNavbar->newmenu('Home','Home');
$rtNavbar->submenu('Home', 'Front Page', 'index.php', 1);
$rtNavbar->submenu('Articles', 'Articles', 'articles.php', 0);
$rtNavbar->submenu('News Categories', 'News Categories', 'news_cats.php', 1);
$rtNavbar->submenu('Search', 'Search this site', 'search.php', 0);

$rtNavbar->newmenu('Community','Community');
$rtNavbar->submenu('Contact Us', 'Contact Us', 'contact.php', 0);
$rtNavbar->submenu('Forums', 'Discussions', 'forum/index.php', 0);
$rtNavbar->submenu('Web Links', 'Site Links', 'weblinks.php', 0);

$rtNavbar->newmenu('Members','Members');
$rtNavbar->submenu('Members List', 'Members List', 'members.php', 1);
if (iMEMBER) {
$rtNavbar->submenu('View Profile', 'View your profile', 'profile.php?lookup='.$userdata['user_id'], 0);
$rtNavbar->submenu('Edit Profile', 'Edit your profile', 'edit_profile.php', 1);
$rtNavbar->submenu('Private Messages', 'View your private messages', 'messages.php', 1);
$rtNavbar->submenu('Logout', 'Logout', 'setuser.php?logout=yes', 0);
} else {
$rtNavbar->submenu('Login', 'Login', 'login.php', 0);
$rtNavbar->submenu('Register', 'Register an Account', 'register.php', 0);
}

if ((iADMIN) && ($userdata['user_rights'] != "")) {
$rtNavbar->newmenu('Administration','Administration');
$rtNavbar->submenu('Write a News Item', 'Write a News Item', 'administration/news.php'.$aidlink, 0);
$rtNavbar->submenu('Write an Article', 'Write an Article', 'administration/articles.php'.$aidlink, 1);
$rtNavbar->submenu('Control Panel', 'Control Panel', 'administration/index.php'.$aidlink, 0);
}
?>

 

 

ko man tur vajag pielikt vaj nodzest . lai butu parast menu taka visos saitos nevis apaksa ka uziet atveras kkads submenu !

 

 

Luudzu paliidziet . daudz neko no sitam lietam nesaprotu !

Link to comment
Share on other sites

Pirmkārt izskatās, ka esi pārkāpis kādus 3 punktus no Foruma Lietošanas Noteikumi.

Kas attiecas uz tavu problēmu, tad ātri caurskatot postēto kodu.

1. faila var atrast 3 menu elementus: newmenu(), submenu() un newlink().

2. faila tev ir piemēri pirmajiem 2:

$rtNavbar->newmenu($name,$title);

$rtNavbar->submenu($name,$title, $url, $divider);

 

un vel nāk klāt newlink($name,$title, $url);

 

Nu tad lūdzu, tev ir 2 menu elementi (funkcijas) submenu() un newlink(), ar kuriem vari spēlēties, lai dabūtu to ko vēlies - parastu linku uz lapu.

Īpaši neiedziļinājos tava problēmā, bet pamēģini $name - parametru padot unikālu.

Link to comment
Share on other sites

×
×
  • Create New...