Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    Senior Coder
    Join Date
    Jun 2008
    Location
    Cornwall
    Posts
    2,097
    Thanks
    297
    Thanked 12 Times in 12 Posts

    Exclamation custom function help please.

    Hi,

    i have created a function
    PHP Code:
    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 Code:
    <?php require('functions.php'); ?>
    an example of me calling the function
    PHP Code:
        elseif ($feedID[$i] == '3'){
        
    amazonfeed()
        } 
    but i am getting an error:
    Code:
    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

  • #2
    UE Antagonizer Fumigator's Avatar
    Join Date
    Dec 2005
    Location
    Utah, USA, Northwestern hemisphere, Earth, Solar System, Milky Way Galaxy, Alpha Quadrant
    Posts
    7,691
    Thanks
    42
    Thanked 637 Times in 625 Posts
    Each expression/function call/whatever needs to be terminated with a semi-colon.

  • Users who have thanked Fumigator for this post:

    LJackson (12-16-2008)

  • #3
    Senior Coder
    Join Date
    Jun 2008
    Location
    Cornwall
    Posts
    2,097
    Thanks
    297
    Thanked 12 Times in 12 Posts
    cool thank you


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •