HI, I apologize for my question as i know that even category Beginners is too high for me.
I am trying to integrate feed from wordpress on html. Code works fine with url, but when i try to ad url variable the code always shows error. I tried two versions, but none works. ( the variables work)
So i suspect either load does not work the way i think or what is in bold is not correct.
I would be extremely grateful if someone opens my eyes.
$rss->load('<?php echo 'http://blog.wordpress.com/tag/'.$event['Event']['name'].'/'.feed/'. '?>');
version 2 in the code below
<?php
$rss = new DOMDocument();
$rss->load('http://blog.wordpress.com/tag/<?= $event['Event']['name'] ?>./feed/');
$feed = array();
foreach ($rss->getElementsByTagName('item') as $node) {
$item = array (
'title' => $node->getElementsByTagName('title')->item(0)->nodeValue,
'desc' => $node->getElementsByTagName('description')->item(0)->nodeValue,
'link' => $node->getElementsByTagName('link')->item(0)->nodeValue,
);
array_push($feed, $item);
}
$limit = 1;
for($x=0;$x<$limit;$x++) {
$title = str_replace(' & ', ' & ', $feed[$x]['title']);
$link = $feed[$x]['link'];
$description = $feed[$x]['desc'];
$date = date('l F d, Y', strtotime($feed[$x]['date']));
echo '<p><strong><a href="'.$link.'" title="'.$title.'">'.$title.'</a></strong><br />';
echo '<p>'.$description.'</p>';
}
?>