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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.