Seite 1 von 1

Not possible to do debugging?

Verfasst: So 1. Feb 2004, 15:46
von alessandro
Hi all,
I have a layout with 16 container, some modules (5 of them are for vertical navigation, I have created them using the sample hauptnavigation bundeled with contenido package).

I have dound that if I have function on those modules with the same name is a problem, so I give another name like nav1, nav1, nav3, ...

I created a template where I call the modules.

And now the problem: if I put to 4 navigation modules (if I switch all them on the template pulldown) I receive asking the frontend this error:
[01-Feb-2004 14:31:36] PHP Parse error: parse error in /var/www/www.it-te.ch/httpdocs/web/it-te/front_content.php(546) : eval()'d code on line 1954

If I put only the first 3 modules no error come...

So I thought that the 4th. module has an error... but is not so, I tryed to put nav1, nav2 and nav4 and work fine... like but if I put after those 3 navigation module anouther I receive the error I wrote...

Please can somebody help me?

Here the output code of one module I use for the navigation:


<?php

/***********************************************
* CONTENIDO MODUL - OUTPUT
*
* Modulname : Navigation 1.1
* Author : Jan Lengowski
* Copyright : Contenido - four for business
* Created : 15-05-2003
* Modified : 26-05-2003
************************************************/

if ( !is_object($db2) ) {
$db2 = new DB_Contenido;
}

/**
* Check if a category is child
* of another category
*
* @return boolean true/false
* @author Jan Lengowski <Jan.Lengowski@4fb.de>
* @copyright four for business AG 2003
*/
function catIsChildOf4($id, $idparent) {

global $cfg, $client, $lang;

$db = new DB_Contenido;

$parent = $id;

while ( $parent != 0 ) {

$sql = "SELECT
a.parentid
FROM
".$cfg["tab"]["cat"]." AS a,
".$cfg["tab"]["cat_lang"]." AS b
WHERE
a.idclient = '".$client."' AND
b.idlang = '".$lang."' AND
a.idcat = b.idcat AND
a.idcat = '".$parent."'";

$db->query($sql);
$db->next_record();

$parent = $db->f("parentid");

if ($parent == $idparent) {
return true;
}

}

return false;

}

if ( catIsChildOf4($idcat, CMS_VALUE[4]) ) {
$sel_idcat = $idcat;
} else {
$sel_idcat = CMS_VALUE[4];
}

/* Include Template Class */
include_once($cfg["path"]["contenido"] . 'classes/class.template.php');

/**
* Array storing alle the
* navigation data
*/
$navitems = array();


/* Template Instance */
$tpl = new Template;

/**
* Recursive function for creating
* the navigation array
* @param Int $idcat Category id
*/
function nav4($idcat) {

global $navitems, $client, $lang, $cfg;

$db = new DB_Contenido;
$db2 = new DB_Contenido;

$sql = "SELECT parentid FROM ".$cfg["tab"]["cat"]." WHERE idcat = '$idcat'";

$db->query($sql);
$db->next_record();

$parentid = $db->f("parentid");

if ( $parentid == 0 ) {

if ( $idcat != CMS_VALUE[4] ){

$navitems = array();

$sql = "SELECT
A.idcat,
C.name
FROM
".$cfg["tab"]["cat_tree"]." AS A,
".$cfg["tab"]["cat"]." AS B,
".$cfg["tab"]["cat_lang"]." AS C
WHERE
A.idcat = B.idcat AND
B.idcat = C.idcat AND
B.idclient = '$client' AND
C.idlang = '$lang' AND
C.visible = '1' AND
B.parentid = 'CMS_VALUE[4]'
ORDER
BY A.idtree";

$db->query($sql);

while ($db->next_record()) {

/* Check for external redirects... */
$sql = "SELECT
a.external_redirect AS ext
FROM
".$cfg["tab"]["art_lang"]." AS a,
".$cfg["tab"]["cat_art"]." AS b,
".$cfg["tab"]["cat"]." AS c
WHERE
b.idcat = '".$db->f("idcat")."' AND
b.is_start = '1' AND
c.idclient = '".$client."' AND
c.idcat = b.idcat AND
a.idart = b.idart AND
a.idlang = '".$lang."'";

$db2->query($sql);
$db2->next_record();

$target = ( $db2->f("ext") == 0 ) ? '_self' : '_blank';

$navitems[$db->f("idcat")] = array("idcat" => $db->f("idcat"),
"name" => $db->f("name"),
"target" => $target);
}

}

return true;
}

$sql = "SELECT
A.idcat,
C.name
FROM
".$cfg["tab"]["cat_tree"]." AS A,
".$cfg["tab"]["cat"]." AS B,
".$cfg["tab"]["cat_lang"]." AS C
WHERE
A.idcat = B.idcat AND
B.idcat = C.idcat AND
B.idclient = '$client' AND
C.idlang = '$lang' AND
C.visible = '1' AND
B.parentid = '$parentid'
ORDER BY
A.idtree";

$db->query($sql);

while ($db->next_record()) {

/* Check for external redirects... */
$sql = "SELECT
a.external_redirect AS ext
FROM
".$cfg["tab"]["art_lang"]." AS a,
".$cfg["tab"]["cat_art"]." AS b,
".$cfg["tab"]["cat"]." AS c
WHERE
b.idcat = '".$db->f("idcat")."' AND
b.is_start = '1' AND
c.idclient = '".$client."' AND
c.idcat = b.idcat AND
a.idart = b.idart AND
a.idlang = '".$lang."'";

$db2->query($sql);
$db2->next_record();

$target = ( $db2->f("ext") == 0 ) ? '_self' : '_blank';

$tmp_nav[$db->f("idcat")] = array("idcat" => $db->f("idcat"),
"name" => $db->f("name"),
"target" => $target);
}

$tmp_nav[$idcat]["sub"] = $navitems;
$navitems = $tmp_nav;

/* Function call */
nav4($parentid);

} // end function

$sql = "SELECT
A.idcat,
C.name
FROM
".$cfg["tab"]["cat_tree"]." AS A,
".$cfg["tab"]["cat"]." AS B,
".$cfg["tab"]["cat_lang"]." AS C
WHERE
A.idcat = B.idcat AND
B.idcat = C.idcat AND
B.idclient = '$client' AND
C.idlang = '$lang' AND
C.visible = '1' AND
B.parentid = '$sel_idcat'
ORDER BY
A.idtree";

$db->query($sql);

while ( $db->next_record() ) {

/* Check for external redirects... */
$sql = "SELECT
a.external_redirect AS ext
FROM
".$cfg["tab"]["art_lang"]." AS a,
".$cfg["tab"]["cat_art"]." AS b,
".$cfg["tab"]["cat"]." AS c
WHERE
b.idcat = '".$db->f("idcat")."' AND
b.is_start = '1' AND
c.idclient = '".$client."' AND
c.idcat = b.idcat AND
a.idart = b.idart AND
a.idlang = '".$lang."'";

$db2->query($sql);
$db2->next_record();

$target = ( $db2->f("ext") == 0 ) ? '_self' : '_blank';

$navitems[$db->f("idcat")] = array("idcat" => $db->f("idcat"),
"name" => $db->f("name"),
"target" => $target);
}

/* Create Navigation Array */
nav4($sel_idcat);

/* Start Output buffer */
ob_start();

echo '<table border="0" cellpadding="0" cellspacing="0" width="151" align="center">';
echo ' <tr>';
echo ' <td>';
echo ' <img name="boxsx_r1_c1" src="../wcm_elements/skins/electric/images/boxsx_r1_c1.gif" border="0" width="13" height="35"></td>';
echo ' <td><table border="0" cellpadding="0" cellspacing="0" width="138">';
echo ' <tr>';
echo ' <td>';
echo ' <img name="boxsx_r1_c2" src="../wcm_elements/skins/electric/images/boxsx_r1_c2.gif" border="0" width="17" height="35"></td>';
echo ' <td><table border="0" cellpadding="0" cellspacing="0" width="121">';
echo ' <tr>';
echo ' <td>';
echo ' <img name="boxsx_r1_c3" src="../wcm_elements/skins/electric/images/boxsx_r1_c3.gif" border="0" width="121" height="10"></td>';
echo ' </tr>';
echo ' <tr>';
echo ' <td background="../wcm_elements/skins/electric/images/boxsx_r2_c3.gif" width="121" height="20"><b>';
echo ' &nbsp;&nbsp;CMS_VALUE[54]';
echo '</b></td>';
echo ' </tr>';
echo ' <tr>';
echo ' <td>';
echo ' <img name="boxsx_r3_c3" src="../wcm_elements/skins/electric/images/boxsx_r3_c3.gif" border="0" width="121" height="5"></td>';
echo ' </tr>';
echo ' </table></td>';
echo ' </tr>';
echo ' </table></td>';
echo ' </tr>';
echo ' <tr>';
echo ' <td background="../wcm_elements/skins/electric/images/boxsx_r4_c1.gif" width="13"></td>';
echo ' <td background="../wcm_elements/skins/electric/images/boxsx_r4_c2.gif" width="138">';
echo '<table cellspacing="0" cellpadding="0" border="0">';

foreach ($navitems as $key => $data) {

/* 1. Navigations Ebene */
$tpl->reset();
$tpl->set('d', 'NAME', $data['name']);
$tpl->set('d', 'TARGET', $data['target']);
$tpl->set('d', 'HREF', $sess->url('front_content.php?idcat='.$data['idcat']));
$tpl->next();

if ($idcat == $data['idcat'] || is_array($data['sub'])) {
$tpl->generate('../wcm_elements/skins/electric/navElem/navfirst_on.html');
} else {
$tpl->generate('../wcm_elements/skins/electric/navElem/navfirst_off.html');
}

if (is_array($data['sub'])) {

foreach ($data['sub'] as $key => $data) {

/* 2. Navigations Ebene */
$tpl->reset();
$tpl->set('d', 'NAME', $data['name']);
$tpl->set('d', 'TARGET', $data['target']);
$tpl->set('d', 'HREF', $sess->url('front_content.php?idcat='.$data['idcat']));
$tpl->next();

if ($idcat == $data['idcat'] || is_array($data['sub'])) {
$tpl->generate('../wcm_elements/skins/electric/navElem/navsecond_on.html');
} else {
$tpl->generate('../wcm_elements/skins/electric/navElem/navsecond_off.html');
}

if (is_array($data['sub'])) {

foreach ($data['sub'] as $key => $data) {

/* 3. Navigations Ebene */
$tpl->reset();
$tpl->set('d', 'NAME', $data['name']);
$tpl->set('d', 'TARGET', $data['target']);
$tpl->set('d', 'HREF', $sess->url('front_content.php?idcat='.$data['idcat']));
$tpl->next();

if ($idcat == $data['idcat']) {
$tpl->generate('../wcm_elements/skins/electric/navElem/navthird_on.html');
} else {
$tpl->generate('../wcm_elements/skins/electric/navElem/navthird_off.html');
}

} // end foreach

} // end if

} // end foreach

} // end if

} // end foreach

echo '</table>';
echo ' </td>';
echo ' </tr>';
echo ' <tr>';
echo ' <td>';
echo ' <img name="boxsx_r5_c1" src="../wcm_elements/skins/electric/images/boxsx_r5_c1.gif" border="0" width="13" height="15"></td>';
echo ' <td><table border="0" cellpadding="0" cellspacing="0" width="138">';
echo ' <tr>';
echo ' <td>';
echo ' <img name="boxsx_r5_c2" src="../wcm_elements/skins/electric/images/boxsx_r5_c2.gif" border="0" width="122" height="15"></td>';
echo ' <td>';
echo ' <img name="boxsx_r5_c4" src="../wcm_elements/skins/electric/images/boxsx_r5_c4.gif" border="0" width="16" height="15"></td>';
echo ' </tr>';
echo ' </table></td>';
echo ' </tr>';
echo '</table>';


/* Read out buffer */
$html = ob_get_contents();

/* Clean buffer */
ob_end_clean();

/* Output buffer-contents */
echo $html;

?>

Thank's

Alessandro

Verfasst: So 1. Feb 2004, 22:57
von timo
probably check out the con_code entry to verify the error line.

Verfasst: Mo 2. Feb 2004, 10:07
von alessandro
Hi timo,
do you have an idea to rapidly find the rigt table line containing this code?

Verfasst: Mo 2. Feb 2004, 11:18
von timo
use the idcatart, idlang and idclient entries to restrict the search.

Verfasst: Mo 2. Feb 2004, 11:39
von alessandro
Hi timo,
I probably found the problem...
Is it possible to include in the layout two containters (ex. 1 and 15) and to point in the template section at the same module?

In my case is the "service navigation" sample module

Thanks
Ale

Verfasst: Mo 2. Feb 2004, 13:41
von timo
yes, that's possible. just make sure that both modules work after each other (e.g. declaring a function in a module which is included twice is not a good idea).

and: make sure that each module contains a blank line at the end (known bug).