-
AuthorPosts
-
suli3 Friend
suli3
- Join date:
- February 2007
- Posts:
- 69
- Downloads:
- 0
- Uploads:
- 1
- Thanks:
- 22
- Thanked:
- 1 times in 1 posts
January 28, 2008 at 9:48 pm #125288Hi
Can anybody help? Whey i have this?
i have this on this template and on JA Avian II why?
Error=
Warning: Invalid argument supplied for foreach() in /home/www/web547/html/nexxbuy/templates/ja_drimia/ja_menus/Base.class.php on line 34
kallan Friendkallan
- Join date:
- August 2006
- Posts:
- 349
- Downloads:
- 0
- Uploads:
- 5
- Thanks:
- 22
- Thanked:
- 35 times in 1 posts
January 29, 2008 at 12:56 am #237490I’m not sure of the problem but to help someone else troubleshoot this for you the relevant line in base.class.php is (from line 34)
foreach ($rows as $index => $v) {
if ($v->access <= $user->get('gid')) {
$pt = $v->parent;
$list = @ $children[$pt] ? $children[$pt] : array ();switch ($v->type)
{
case 'url' :
if ((strpos($v->link, 'index.php?') !== false) && (strpos($v->link, 'Itemid=') === false)) {
$v->url = $v->link.'&Itemid='.$v->id;
} else {
$v->url = $v->link;
}
break;default :
$v->url = 'index.php?Itemid='.$v->id;
break;
}
if (strcasecmp(substr($v->url, 0, 4), 'http') && (strpos($v->link, 'index.php?') !== false)) {
$iParams =& new JParameter($v->params);
$iSecure = $iParams->def('secure', 0);
$v->url = JRoute::_($v->url, true, $iSecure);
}else{
//$v->url = urlencode($v->url);
$v->url = str_replace('&', '&', $v->url);
}
array_push($list, $v);
$children[$pt] = $list;
}suli3 Friendsuli3
- Join date:
- February 2007
- Posts:
- 69
- Downloads:
- 0
- Uploads:
- 1
- Thanks:
- 22
- Thanked:
- 1 times in 1 posts
January 29, 2008 at 8:39 pm #237588i have allways the sam problem
this is the code from the file Base.class.php
[PHP]<?php
defined(‘_JEXEC’) or die(‘Restricted access’);
if (!defined (‘_JA_BASE_MENU_CLASS’)) {
define (‘_JA_BASE_MENU_CLASS’, 1);class JA_Base{
var $_params = null;
var $children = null;
var $open = null;
var $items = null;
var $Itemid = 0;function JA_Base( &$params ){
global $Itemid;
$this->_params = $params;
$this->Itemid = $Itemid;
$this->loadMenu();
}function loadMenu(){
$menu = @JMenu :: getInstance();
if(strtolower(get_class($menu)) == ‘jexception’) {
$menu = @JMenu :: getInstance(‘site’);
}
$user =& JFactory::getUser();
$children = array ();// Get Menu Items
$items = &JSite::getMenu();
$rows = $items->getItems(‘menutype’, $this->getParam(‘menutype’));
// first pass – collect children
$cacheIndex = array();
$this->items = array();
foreach ($rows as $index => $v) {
if ($v->access <= $user->get(‘gid’)) {
$pt = $v->parent;
$list = @ $children[$pt] ? $children[$pt] : array ();switch ($v->type)
{
case ‘url’ :
if ((strpos($v->link, ‘index.php?’) !== false) && (strpos($v->link, ‘Itemid=’) === false)) {
$v->url = $v->link.’&Itemid=’.$v->id;
} else {
$v->url = $v->link;
}
break;default :
$v->url = ‘index.php?Itemid=’.$v->id;
break;
}
if (strcasecmp(substr($v->url, 0, 4), ‘http’) && (strpos($v->link, ‘index.php?’) !== false)) {
$iParams =& new JParameter($v->params);
$iSecure = $iParams->def(‘secure’, 0);
$v->url = JRoute::_($v->url, true, $iSecure);
}else{
//$v->url = urlencode($v->url);
$v->url = str_replace(‘&’, ‘&’, $v->url);
}
array_push($list, $v);
$children[$pt] = $list;
}
$cacheIndex[$v->id] = $index;
$this->items[$v->id] = $v;
}$this->children = $children;
// second pass – collect ‘open’ menus
$open = array (
$this->Itemid
);
$count = 20; // maximum levels – to prevent runaway loop
$id = $this->Itemid;while (– $count)
{
if (isset($cacheIndex[$id])) {
$index = $cacheIndex[$id];
if (isset ($rows[$index]) && $rows[$index]->parent > 0) {
$id = $rows[$index]->parent;
$open[] = $id;
} else {
break;
}
}
}
$this->open = $open;
// $this->items = $rows;
}function getParam($paramName){
return $this->_params->get($paramName);
}function setParam($paramName, $paramValue){
return $this->_params->set($paramName, $paramValue);
}function beginMenu($startlevel=0, $endlevel = 10){
echo “<div>”;
}
function endMenu($startlevel=0, $endlevel = 10){
echo “</div>”;
}function beginMenuItems($pid=0, $level=0){
echo “<ul>”;
}
function endMenuItems($pid=0, $level=0){
echo “</ul>”;
}function beginMenuItem($mitem=null, $level = 0, $pos = ”){
echo “<li>”;
}
function endMenuItem($mitem=null, $level = 0, $pos = ”){
echo “</li>”;
}function genClass ($mitem, $level, $pos) {
$active = in_array($mitem->id, $this->open);
if ($active) $active = ($pos) ? “class=”active $pos-item”” : “class = “active””;
else $active = ($pos) ? “class=”$pos-item”” : “”;return $active;
}function genMenuItem($item, $level = 0, $pos = ”, $ret = 0)
{
$data = null;// Menu Link is a special type that is a link to another item
if ($item->type == ‘menulink’)
{
$menu = &JMenu::getInstance();
if (!$tmp = clone($menu->getItem($item->query[‘Itemid’]))) {
return false;
}
} else {
$tmp = $item;
}$iParams =& new JParameter($tmp->params);
if ($iParams->get(‘menu_image’) && $iParams->get(‘menu_image’) != -1) {
$image = ‘<img src=”images/stories/’.$iParams->get(‘menu_image’).'” alt=”” />’;
} else {
$image = null;
}
if ($tmp->type == ‘separator’)
{
return ‘<a href=”#” title=””><span class=”separator”>’.$image.$tmp->name.'</span></a>’;
}// Print a link if it exists
$active = $this->genClass ($tmp, $level, $pos);$id=’id=”menu’ . $tmp->id . ‘”‘;
$txt = ‘<span>’ . $tmp->name . ‘</span>’;
$title = “title=”$tmp->name””;if ($tmp->url != null)
{
switch ($tmp->browserNav)
{
default:
case 0:
// _top
$data = ‘<a href=”‘.$tmp->url.'” ‘.$active.’ ‘.$id.’ ‘.$title.’>’.$image.$txt.'</a>’;
break;
case 1:
// _blank
$data = ‘<a href=”‘.$tmp->url.'” target=”_blank” ‘.$active.’ ‘.$id.’ ‘.$title.’>’.$image.$txt.'</a>’;
break;
case 2:
// window.open
$attribs = ‘toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes,’.$this->_params->get(‘window_open’);// hrm…this is a bit dickey
$link = str_replace(‘index.php’, ‘index2.php’, $tmp->url);
$data = ‘<a href=”‘.$link.'” onclick=”window.open(this.href,’targetWindow’,”.$attribs.”);return false;” ‘.$active.’ ‘.$id.’ ‘.$title.’>’.$image.$txt.'</a>’;
break;
}
} else {
$data = ‘<a ‘.$active.’ ‘.$id.’ ‘.$title.’>’.$image.$txt.'</a>’;
}if ($ret) return $data; else echo $data;
}
function hasSubMenu($level) {
$pid = $this->getParentId ($level);
if (!$pid) return false;
return $this->hasSubItems ($pid);
}
function hasSubItems($id){
if (@$this->children[$id]) return true;
return false;
}
function genMenu($startlevel=0, $endlevel = 10){
$this->setParam(‘startlevel’, $startlevel);
$this->setParam(‘endlevel’, $endlevel);
$this->beginMenu($startlevel, $endlevel);if ($this->getParam(‘startlevel’) == 0) {
//First level
$this->genMenuItems (0, 0);
}else{
//Sub level
$pid = $this->getParentId($this->getParam(‘startlevel’));
if ($pid)
$this->genMenuItems ($pid, $this->getParam(‘startlevel’));
}
$this->endMenu($startlevel, $endlevel);
}/*
$pid: parent id
$level: menu level
$pos: position of parent
*/function genMenuItems($pid, $level) {
if (@$this->children[$pid]) {
$this->beginMenuItems($pid, $level);
$i = 0;
foreach ($this->children[$pid] as $row) {
$pos = ($i == 0 ) ? ‘first’ : (($i == count($this->children[$pid])-1) ? ‘last’ :”);$this->beginMenuItem($row, $level, $pos);
$this->genMenuItem( $row, $level, $pos);// show menu with menu expanded – submenus visible
if ($level < $this->getParam(‘endlevel’)) $this->genMenuItems( $row->id, $level+1 );
$i++;if ($level == 0 && $pos == ‘last’ && in_array($row->id, $this->open)) {
global $jaMainmenuLastItemActive;
$jaMainmenuLastItemActive = true;
}
$this->endMenuItem($row, $level, $pos);
}
$this->endMenuItems($pid, $level);
}
}function indentText($level, $text) {
echo “n”;
for ($i=0;$i<$level;++$i) echo ” “;
echo $text;
}function getParentId ($level) {
if (!$level || (count($this->open) < $level)) return 0;
return $this->open;
}function getParentText ($level) {
$pid = $this->getParentId ($level);
if ($pid) {
return $this->items[$pid]->name;
}else return “”;
}}
}
?>[/PHP]suli3 Friendsuli3
- Join date:
- February 2007
- Posts:
- 69
- Downloads:
- 0
- Uploads:
- 1
- Thanks:
- 22
- Thanked:
- 1 times in 1 posts
January 29, 2008 at 9:59 pm #237592Hi all
i have found the error. The error is not on the Base.class.php. If i install the german version from joomla 1.5 they are german contents and the mainmenu is called “hauptmenu”. All joomlart templatest are coded that the mainmenu is called “mainmenu”.>:(>:(>:( (why, thats not joomla1.5 conform)
To the team:
Pleas repair this!Thanks
Salsabil FriendSalsabil
- Join date:
- February 2006
- Posts:
- 54
- Downloads:
- 0
- Uploads:
- 0
- Thanks:
- 6
- Thanked:
- 2 times in 1 posts
February 7, 2008 at 9:53 pm #238546<em>@Suli3 38492 wrote:</em><blockquote>Hi all
i have found the error. The error is not on the Base.class.php. If i install the german version from joomla 1.5 they are german contents and the mainmenu is called “hauptmenu”. All joomlart templatest are coded that the mainmenu is called “mainmenu”.>:(>:(>:( (why, thats not joomla1.5 conform)
To the team:
Pleas repair this!Thanks</blockquote>
this is not an issue of JoomlArt rather it has to do with the german translation. JoomlArt can not release the Templates or the responsible files in any language. they must keep it in original language and this is englisch.
to solve the problem just replace in ja_vars.php of your template
[PHP]$japarams->set( ‘menutype’, ‘mainmenu’ );[/PHP]
with
[PHP]$japarams->set( ‘menutype’, ‘hauptmenü’ );[/PHP]
thats all…
-
AuthorPosts
This topic contains 6 replies, has 3 voices, and was last updated by suli3 16 years, 10 months ago.
We moved to new unified forum. Please post all new support queries in our New Forum