I am trying to pass in a tag
<script src="http://news.agc.org/agccorner/rss_feed.php?src=http%3A%2F%2Fnews.agc.org%2Fagccorner%2Frss_feed.php%3Ffdurls%255B%255D%3D4%26fdurls%255B%255D%3D5&num=5&targ=y&utf=y" type="text/javascript"></script>
I am trying to pass in the RSS Feed that is parsed through the src:
$str ='<script type="text/javascript">';
$str .= "document.write('<ul>');";
//each rss feed is gone through
foreach($rss_array as $each_rss) {
foreach($each_rss as $item){
//$num=1;
// if you want to channel title shown uncomment this
/*
if(@$item['title'])
echo "Channel Title: " . $item['title'];
*/
foreach($item as $record) {
//this statement is to not display the array that contains the title
if($record['title'] == "A") {
}else {
if($num <= $num_limit) {
$num++;
$str .= "document.write('<li> <a href='".$record['link']. "' target='".$new_target."'>" . $record['title']. "</a></li>');";
}
}
}
}
}
$str .= "document.write('</ul>');";
$str .= '</script>';
header("Content-type: application/x-javascript");
echo $str;
When you put that code on the html page it will not display any information, however when you go to the page it self it will return the rss feeds.
I have tried using the document.write function and echo.
Any body have any suggestions?
<script type="text/javascript">document.write('<ul>');document.write('<li> <a href='http://news.agc.org/2013/01/28/house-ti-committee-finalizes-chair-assignments-chairman-shuster-meets-chairman-boxer-to-discuss-highway-trust-fund-concerns/?utm_source=rss&utm_medium=rss&utm_campaign=house-ti-committee-finalizes-chair-assignments-chairman-shuster-meets-chairman-boxer-to-discuss-highway-trust-fund-concerns' target='_blank'>House T&I Committee Finalizes Chair Assignments, Chairman Shuster Meets Chairman Boxer to Discuss Highway Trust Fund Concerns</a></li>');document.write('<li> <a href='http://news.agc.org/2013/01/25/states-look-to-increase-transportation-funding/?utm_source=rss&utm_medium=rss&utm_campaign=states-look-to-increase-transportation-funding' target='_blank'>States Look to Increase Transportation Funding</a></li>');document.write('<li> <a href='http://news.agc.org/2013/01/25/nebraska-approves-keystone-xl-pipeline-route/?utm_source=rss&utm_medium=rss&utm_campaign=nebraska-approves-keystone-xl-pipeline-route' target='_blank'>Nebraska Approves Keystone XL Pipeline Route</a></li>');document.write('<li> <a href='http://news.agc.org/2013/01/24/house-ti-committee-finalizes-chair-assignments/?utm_source=rss&utm_medium=rss&utm_campaign=house-ti-committee-finalizes-chair-assignments' target='_blank'>House Transportation and Infrastructure Committee Finalizes Chair Assignments</a></li>');document.write('<li> <a href='http://news.agc.org/2013/01/24/states-look-to-increase-transportation-funding-2/?utm_source=rss&utm_medium=rss&utm_campaign=states-look-to-increase-transportation-funding-2' target='_blank'>States Look to Increase Transportation Funding</a></li>');document.write('</ul>');</script>
on the php page
if you use the RSS as echo statements instead of document.write it will output:
<ul><li> <a href='http://news.agc.org/2013/01/02/worker-shortage-in-construction-industry/?utm_source=rss&utm_medium=rss&utm_campaign=worker-shortage-in-construction-industry' target='_blank'>Worker Shortage in Construction Industry</a></li><li> <a href='http://news.agc.org/2012/12/18/15125/?utm_source=rss&utm_medium=rss&utm_campaign=15125' target='_blank'>Contractors Collaborate, Develop Guide to Streamline Development of Environmental Management Program</a></li><li> <a href='http://news.agc.org/2012/12/18/billing-index-continues-to-see-improvement/?utm_source=rss&utm_medium=rss&utm_campaign=billing-index-continues-to-see-improvement' target='_blank'>Billing Index Continues to See Improvement</a></li><li> <a href='http://news.agc.org/2012/12/12/new-changes-in-epa-policy-governing-disposal-of-pcb-contaminated-building-materials/?utm_source=rss&utm_medium=rss&utm_campaign=new-changes-in-epa-policy-governing-disposal-of-pcb-contaminated-building-materials' target='_blank'>New Changes in EPA Policy Governing Disposal of PCB-Contaminated Building Materials</a></li><li> <a href='http://news.agc.org/2012/12/04/consensusdocs-releases-updated-federal-subcontract-to-help-construction-firms-perform-federal-work/?utm_source=rss&utm_medium=rss&utm_campaign=consensusdocs-releases-updated-federal-subcontract-to-help-construction-firms-perform-federal-work' target='_blank'>ConsensusDocs Releases Updated Federal Subcontract to Help Construction Firms Perform Federal Work</a></li></ul>
The link to the rss feed using document.write is:
http://news.agc.org/agccorner/rss_feed.php?src=http%3A%2F%2Fnews.agc.org%2Fagccorner%2Frss_feed.php%3Ffdurls%255B%255D%3D4%26fdurls%255B%255D%3D5&num=5&targ=y&utf=y
link to the rss feed using php echo:
http://news.agc.org/agccorner/rss_feed_2.php?src=http%3A%2F%2Fnews.agc.org%2Fagccorner%2Frss_feed.php%3Ffdurls%255B%255D%3D4%26fdurls%255B%255D%3D5&num=5&targ=y&utf=y
link to the html page:
http://news.agc.org/agccorner/rss.htm