Jump to content

Having Trouble including this


holladb

Recommended Posts

My client has a templating system... looks like it might be Isotemplate, but im not positive.

 

I have successfully created a new block and can put text there but i need it to be php.

 

Here is the code i need to include:

<?
function createFeatured()
{

print('<table width="15" align="center" cellspacing="2" bgcolor="#ffffff">');

$query = "SELECT * FROM items WHERE featured='1'"; 
$result=mysql_query($query);

$column=1;

while($value=mysql_fetch_object($result))
{

if ($column==1)
{
// Begin row in table
echo "<tr>";
}

// This loops in the while() statement to get each result from the database.

print('<td width="207" height="200" bgcolor="#ffffff"><center>
  <a href="/item.php?id='.$value->id.'"><span class="style1"><img src="/files/items/'.$value->thumb.'" alt="'.$value->name.'" title="'.$value->name.'" border="0" vspace="0" style="border: 0px solid #CCC"></span>
</center>
    <span class="style1"><br>
    '.$value->name.'<br>
    '. if(($value->is_sale)=='1') { .'
    <font color="#FF0000"><b>Sale: '.'$'.$value->price.'</b>
    '. } else {.'
    <b>'.'$'.$value->price.'</b>
    '. } .'
    </font></span></a>
  </td>');

$column++;


// When you've looped enough, end the row.
if ($column==3)
{
echo "</tr>";
$column=1;
}

}
print('</table>');
} 
?>

 

Here is part of the Function file where it needs to be included:

        if ($script == 'page' && $id != '') {
            $blocks = $db->get("id='$id'", 'blocks', $GLOBALS['t_contents']);
            $block_rows = $db->select("location='non'", 'id', array('id', 'text'), $GLOBALS['t_contents']);
            if (isset($block_rows) && is_array($block_rows)) {
                foreach ($block_rows as $brow) {
                    if (preg_match('/\<'.$brow[id].'\>/', $blocks)) {
                        $tpl->setVariable(array(
                            'CONTENT'.$brow[id] => $brow[text]
                        ));
                    }
                }
            }
            $tpl->setVariable(array(
                'CONTENTB'  => ($contentb != '')?$contentb:null//,
			//LOADED MEDIA
			//'FEATURED' => "test"
            ));
        }

I have blocked out the lines for the new block.

Link to comment
https://forums.phpfreaks.com/topic/73787-having-trouble-including-this/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.