Community

Error document.parser.class.inc.php(1965) : eval()'d code:17



<?php
$idd = $modx->documentIdentifier;

$res = $modx->getDocumentChildren(
    $id = 207,
    $active = 1,
    $deleted = 0,
    'id, menutitle',
    $where = 'hidemenu = 0',
    $sort='menuindex',
    $dir='asc',
    $limit
);
$i=1;

foreach($res as $key => $value) {
    $quer="SELECT*FROM modx_site_tmplvar_contentvalues where tmplvarid=59 and contentid=".$value[id];
        $res=MYSQL_QUERY($quer);
        if (mysql_num_rows($res)==0) { $img="";}
        else
        {
        @$v=mysql_fetch_assoc($res);
        @$v[value]=substr ( $v[value], 1 );
        @$size = getimagesize ($v[value]);
        @$w=$size[0]; $h=$size[1];
        echo "<img src=\"[(base_url)]$v[value]\" width=\"$w\" height=\"$h\" alt=\"\" />";
        }
}

The getDocumentChildren arguments are not an array. Try this

$res = $modx->getDocumentChildren(
    207,
    1,
    0,
    'id, menutitle',
    'hidemenu = 0',   // maybe should be 'hidemenu:0'
    'menuindex',
    'asc',
    0
);

no error, or not slider(((

I shouldn’t have put the comment in the arguments list:

$res = $modx->getDocumentChildren( 207, 1, 0, 'id, menutitle', 'hidemenu = 0', 'menuindex', 'asc', 0 );

Also, it looks like the Forum added some ‘smart’ quotes, which should be single quote characters.

All right? Did not help(

The fatal error from the first post comes from line 18 of that snippet:

MYSQL_QUERY($quer);

mysql_query has been deprecated for a while and has been removed in PHP 7.0 (which was released in December 2015). That’s why you’re getting an undefined function error.

You’ll need to refactor that code to use either mysqli_query, PDO, or I think Evo also ships with its own DBAPI that you can use to fetch information from the database.