didz666 Posted January 25, 2015 Share Posted January 25, 2015 (edited) Hi all new to php and this forum i have been looking around and im very impressed most questions get answered not like on some of the forums around. Is there any one kind enough to help me out i have an api call via php and would like to output the results to owlcarousel where do i start with this. Code i have is: <?php error_reporting(E_ALL); // Turn on all errors, warnings and notices for easier debugging // API request variables $endpoint = 'http://svcs.ebay.com/services/search/FindingService/v1'; // URL to call $version = '1.0.0'; // API version supported by your application $appid = 'YourAppID'; // Replace with your own AppID $globalid = 'EBAY-GB'; // Global ID of the eBay site you want to search (e.g., EBAY-DE) $query = 'tools'; // You may want to supply your own query $safequery = urlencode($query); // Make the query URL-friendly // Construct the findItemsByKeywords HTTP GET call $apicall = "$endpoint?"; $apicall .= "OPERATION-NAME=findItemsIneBayStores"; $apicall .= "&SERVICE-VERSION=$version"; $apicall .= "&SECURITY-APPNAME=$appid"; $apicall .= "&GLOBAL-ID=$globalid"; $apicall .= "&keywords=$safequery"; $apicall .= "&storeName=yourstorename"; $apicall .= "&paginationInput.entriesPerPage=6"; $apicall .= "&paginationInput.pageNumber=1"; // Load the call and capture the document returned by eBay API $resp = simplexml_load_file($apicall); // Check to see if the request was successful, else print an error if ($resp->ack == "Success") { $results = ''; // If the response was loaded, parse it and build links foreach ($resp->searchResult->item as $item) { $pic = $item->galleryURL; $link = $item->viewItemURL; $title = $item->title; $price = $item->currentPrice; // For each SearchResultItem node, build a link and append it to $results $results .= "<div id='item'><div class='img-wrap' align='center'><img src=\"$pic\" class='itemimg'></div> <div class='itemtxt' align='center'><a href=\"$link\">$title</a>$price</div></div>"; } } // If the response does not indicate 'Success,' print an error else { $results = "<h3>Oops! The request was not successful. Make sure you are using a valid "; $results .= "AppID for the Production environment.</h3>"; } ?> <html> <head> <body> <table> <tr> <td> <div id="result"> <?php echo $results;?> </div> </td> </tr> </table> </body> </html> Im sure is pretty basic but being new to this i have no idea where to start, any advice would be much appreciated. thanks Edited January 25, 2015 by didz666 Quote Link to comment Share on other sites More sharing options...
Solution Ch0cu3r Posted January 25, 2015 Solution Share Posted January 25, 2015 (edited) owlcarousel as in the JQuery plugin? Read these steps here to add it to your page. For step 2 you just wrap <?php echo $results;?> with the div for the style of carousel you want (this is shown in the HTML tab for each demo), example html for the custom carousel effect <!-- example html for the custom carousel --> <div id="owl-demo" class="owl-carousel owl-theme"> <?php echo $results; /* this line gets wrapped in the div for the style of carousel */ ?> </div> <div class="customNavigation"> <a class="btn prev">Previous</a> <a class="btn next">Next</a> <a class="btn play">Autoplay</a> <a class="btn stop">Stop</a> </div> All you need to do now is apply the Javascript and CSS shown for the carousel you want. Edited January 25, 2015 by Ch0cu3r Quote Link to comment Share on other sites More sharing options...
didz666 Posted January 25, 2015 Author Share Posted January 25, 2015 Hi Ch0cu3r thanks i feel stupid now for asking. appreciate your help. thanks Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.