Hey guys fairly new to PHP as is, I need to run a PHP function call through an onClick which through my research I have found that I need to use AJAX.
Let me explain better what I am trying to do. I am currently using Simplepie PHP to pull various RSS feeds, I have an HTML DIV tag that loads the titles of the feeds and I want to get to the point where each title is clickable (im assuming this is through onClick) to run a simplepie PHP function to pull the content into a seperate DIV (on the same page).
Im really lost here, I would really appreciate any insight...
Here's a snippet of the code I am currently running:
<?php
include('simplepie2.inc');
function printFeed($feedUrl, $imgNumber)
{
$feed = new SimplePie();
$feed->set_feed_url($feedUrl);
$feed->enable_order_by_date(true);
$feed->set_cache_location($_SERVER['DOCUMENT_ROOT'] . '/NEW/cache');
$feed->set_javascript('embed');
$feed->init();
$feed->handle_content_type();
$item = $feed->get_item(0);
$titleName = $item->get_title();
$feedDescription = $item->get_content();
$image = returnImage($feedDescription, $imgNumber);
$titleImage = scrapeImage($image);
$Description = Shorten ($item->get_description(), 450);
echo '<div class="content">';
echo '<div id="contenthead"><img src="images/contenthead.png"></div>';
echo '<div id="feedwrap">';
echo '<div class="fleft"><img src="images/l_border.png"></div>';
echo '<div class="fright"><img src="images/r_border.png"></div>';
echo '<div class="fmain">';
echo '<div class="contentimg">';
echo '<div id="titlenamewrap">';
echo $titleName;
echo '</div>';
//In this DIV is where I want the images to change when onClick event gets triggered.
//basically I want the value of $titleImage to change when an onClick in the DT DIV gets triggered
echo '<img src="' .$titleImage. '" width="316" />';
echo '</div>';
echo '<div id="desc">';
echo $Description;
echo '</div>';
echo '<div id="divider"><img src="images/contentdivider.png"></div>';
echo '<div class="scroll" overflow: auto;>';
echo '<dl>';
for($i=0; $i < $feed->get_item_quantity() && $i<10; $i++)
{
$item = $feed->get_item($i);
echo '<dt>';
//Currently I am having it echo out, I want to have this as an onClick
//to trigger a simplepie PHP function which will update the contentimg DIV
//Is this possible?
echo $item->get_title();
}
echo '</dl>';
echo '</div>';
echo '</div>';
echo '</div>';
echo '<div id="contentfoot"><img src="images/contentfoot.png"></div>';
echo '</div>';
}
?>