...

View Full Version : custom function help please.



LJackson
12-16-2008, 03:43 PM
Hi,

i have created a function

function amazonfeed (){

$xml=simplexml_load_file($rssIndividual[$i]);
// How many items to display from the RSS Feed ...
$count = 1;

foreach ($xml->product as $item) {

if ($item->shippingCost == '0'){
$shipping = "Free";
}
else {
$shipping = "{$item->shippingCost}";
}

$date = rtrim($item->fields->Release_Date," 00:00:00");

if($count > 0){
echo"

<a href='{$item->deepLink}'>{$item->productname}</a><br />
<a href='{$item->deepLink}'><img src='{$item->imageURL}' alt='{$item->productname}' height='100' border='0' vspace='10'/></a>

<div class='feedcontainer_yellow'>
<div class='feeditems_platform_review'><b>Name</b><br>{$item->productname}</div>
<div class='feeditems_platform_review'><b>Availability</b><br>{$item->availability}</div>
</div>

<div class='feedcontainer_pink'>
<div class='feeditems_prices'><b>Price</b><br />
{$item->Price}</div>
<div class='feeditems_prices'><b>Shipping Costs</b><br />
$shipping</div>
<div class='feeditems_prices'><b>Release Date</b><br />
$date</div>

</div>";
}
$count--;
}
}


which is stored in functions.php

and have used this line on the webpages where i want to use the function to include the functions.php page

<?php require('functions.php'); ?>

an example of me calling the function

elseif ($feedID[$i] == '3'){
amazonfeed()
}

but i am getting an error:

Parse error: syntax error, unexpected '}' in /customers/kernow-connect.com/kernow-connect.com/httpd.www/affiliate/clothing.php on line 337


and im not sure why. can anyone please help
thanks

Fumigator
12-16-2008, 04:01 PM
Each expression/function call/whatever needs to be terminated with a semi-colon.

LJackson
12-16-2008, 04:04 PM
cool thank you :)



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum