...

View Full Version : is it possible to link some buttons to my data?



LJackson
05-05-2009, 12:56 PM
Hi Guys n Girls,

sorry the title isn't very descriptive, but im not sure how to describe this :(

i am displaying several rss feeds on my test page
here (http://www.kernow-connect.com/tester.php)

and i have added a button to each item, my question is can i make the button pass on the individual item name to another page using php or will i have to add all this info into a database? and then pull out the data from that... if so how do i go about updating the database data would i simply overwrite the current data each time the page is loaded? or some how do it every hour?

any help would be appreciated

many thanks
Luke

cusackd
05-05-2009, 01:44 PM
Can you please post the script you are using to display the data on the page.

LJackson
05-05-2009, 01:50 PM
yeah sure mate.


<div id='header'>
<div id='logo'>
<h1>
<a href="index.php" target="_self">
<img src='images/logo/thelogo2.png'
title="Kernow Connect -
Online Shopping &amp; Price Comparision - For the smarter shopper"
alt="Kernow Connect -
Online Shopping &amp; Price Comparision - For the smarter shopper"
border='0' /></a></h1>
</div>

<div class="slogantext">
<h1>Online Shopping And Price Comparison</h1>
</div>

</div>

<div id="wrapper">

<div id="navlink">

<div class='link'>
<img src="images/links/entertainmentlink.png" />
</div>
<div class='link'>
<img src="images/links/computinglink.png" />
</div>
<div class='link'>
<img src="images/links/electronicstlink.png" />
</div>
<div class='link'>
<img src="images/links/clothinglink.png" />
</div>
<div class='link'>
<img src="images/links/misclink.png" />
</div>

</div>

<div class="category_name"><h1>DVD</h1></div>
<div class="catsections">
<div class="cattop">
<div class="cattop_header">Kernow Connect Pick Of The Week</div>
<div class="cattop_item"></div>
<div class="cattop_desc"></div>
</div>
<div class="top5">
<div class="catheader_top"><img src="images/catdesc.jpg" /></div>
<?php
$count = 2;
$xml = simplexml_load_file("http://www.amazon.co.uk/rss/bestsellers/dvd/ref=pd_nr_rss_link");
foreach ($xml->channel->item as $item) {
$title = get_string_between($item->title, ':','[');
$photosource = get_string_between($item->description, '<img src="','"');
if($count >= 0){
echo"
<div class='individual5'>
<img src='$photosource' width='100' border='0' hspace='0' vspace='0' alt='$title' title='$title'/>
</div>

<div class='individual5info'>
<div class='individualitem'>
<h2>$title</h2>
</div>
<div class='individualcompare'><img src='images/compare.gif' alt='Compare Prices For $title' title='Compare Prices For $title'/></div>
</div>";
$count--;

}
}
?>
</div></div>

that is for one of the sections the rest of the code is the same but with different urls being loaded.

cheers

cusackd
05-05-2009, 03:13 PM
To be honest if this was me and its just me, i would rather dump all that rss data in to a MySQL database. When you are setting up the database make sure you have a primary key as this will allow you to have an ID for each row in the DB, then pull the data from the Database and make the unique primary key the link to more description and so on. This probably doesnt come across to clear. If not let me know and ill re word it.

LJackson
05-05-2009, 03:43 PM
hi mate i totally agree,

i have been working on setting this up but am not getting anywhere fast
im rally confusing myself and making things much harder than they need to be.

i have 15 feeds on the page which i need to pull out the first 3 items and add them to the database,

so i am setting up and array which contains all the feeds to pull the data out of (does that sound ok?) and then at the moment im trying to display the 3 top items from each feed on the php page just to see if its working but its not

here is my code

$feeds = array("http://www.amazon.co.uk/rss/bestsellers/dvd/ref=pd_nr_rss_link","http://www.amazon.co.uk/rss/new-releases/dvd/ref=pd_nr_rss_link","http://www.amazon.co.uk/rss/most-gifted/dvd/ref=pd_mg_rss_link");

foreach($feeds){

$count = 2;
$feedreader = simplexml_load_file
("$feeds");
foreach ($feedreader->channel->item as $item) {
$photosource = get_string_between($item->description, '<img src="','"');

if($count >= 0){
echo"$item->title <br> $photosource<p> ";
$count --;
}
}

?>


cheers

LJackson
05-05-2009, 03:49 PM
ok i have managed to get the top 3 items from the feeds as so


$feeds = array("http://www.amazon.co.uk/rss/bestsellers/dvd/ref=pd_nr_rss_link","http://www.amazon.co.uk/rss/new-releases/dvd/ref=pd_nr_rss_link","http://www.amazon.co.uk/rss/most-gifted/dvd/ref=pd_mg_rss_link");

foreach ($feeds as $feed){

$count = 2;
$feedreader = simplexml_load_file
("$feed");
foreach ($feedreader->channel->item as $item) {
$photosource = get_string_between($item->description, '<img src="','"');

if($count >= 0){
echo"$item->title <br> $photosource<p> ";
$count --;
}
}
}
?>


next step would be to add the data into the database?

"thinking aloud" how do i add more data to the array because i currently dont know which feeds these are for e.g dvd, cd etc nor do i know if they are for the recommended, newreleases, or mostgifted? this would need to be entered into the database to so that i can display the correct info in the correct place. how could i do this?

thanks for your help
Luke

cusackd
05-05-2009, 04:42 PM
Ok just one thing i want to clear up, are you creating a site based on amazons results or building a site based on your own site results. As this will determine where to go from here.

LJackson
05-05-2009, 04:56 PM
it will be based on my own results, im going to compare prices from several stores including amazon.

i want the item name to be passed to another page where i can have the php to find all items in a database which are like the item clicked on.

the amazon feeds are just being used to display top items from several categorys and as they update hourly i thought it was the best solution :)

hope this helps
Luke

LJackson
05-05-2009, 05:09 PM
also i will soon have access to a database containing all the products from the most of the stores i want to compare which will save me a lot of work :) which is always a good thing...

cusackd
05-05-2009, 05:50 PM
To be honest i would have to say put your efforts in to the database version of your application because i just think that it is going to get very ver messy with all those rss feeds coming in and i have to say i dont like them, if you want to pm me and maybe i can give you a hand with the databse version of your app, more than willing to help but at the moment i dont think that the rss feeds alone will give you good results on your pages. But thatsa just my opinion.

LJackson
05-05-2009, 06:19 PM
ok thanks mate i have PM'd you :)

cheers
Luke



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum