Hi Dave,
If you check your server's log files, you'll see the script spewing warnings into them about undefined variables so I've defined them (they probably could be removed but I didn't look at that).
Also lots of warnings about using the system timezone, so I've set that to "london/europe".
I've added some newline '\n' to the echo statements to make the generated html a little more human readable.
and put the html for the images into a loop so it's less work to add more images.
See attached file. James. On 15/03/15 19:50, dave miller wrote:
Here is my code - feel free to shove it onto a server and change and improve on it (it couldn't be much worse to be honest!)... <?php //Getting an RSS 2 feed into SimpleXML $articles = array(); // step 1: get the feed $blog_url = 'http://furtherfield.org/netbehaviour/feed'; $rawFeed = file_get_contents($blog_url); $xml = new SimpleXmlElement($rawFeed); // step 2: extract the channel metadata $channel = array(); $channel['title'] = $xml->channel->title; $channel['link'] = $xml->channel->link; $channel['description'] = $xml->channel->description; $channel['pubDate'] = $xml->pubDate; $channel['timestamp'] = strtotime($xml->pubDate); $channel['generator'] = $xml->generator; $channel['language'] = $xml->language; // step 3: extract the articles foreach ($xml->channel->item as $item) { $article = array(); $article['channel'] = $blog; $article['title'] = $item->title; $article['link'] = $item->link; $article['comments'] = $item->comments; $article['pubDate'] = $item->pubDate; $article['timestamp'] = strtotime($item->pubDate); $article['description'] = (string) trim($item->description); $article['isPermaLink'] = $item->guid['isPermaLink']; // get data held in namespaces $content = $item->children($ns['content']); $dc = $item->children($ns['dc']); $wfw = $item->children($ns['wfw']); $article['creator'] = (string) $dc->creator; foreach ($dc->subject as $subject) $article['subject'][] = (string)$subject; $article['content'] = (string)trim($content->encoded); $article['commentRss'] = $wfw->commentRss; // add this article to the list $articles[$article['timestamp']] = $article; //make an array of all the titles $title_array[] = $article['title']; //how many words in the array? $wordcount = count($title_array); //join all descriptions together into a long string $title_string = join(' ',$title_array); //operations on the RSS //do a character replace- replace the commas, full stops, colons by a space $badChars='@[a-z]*=""@is'; $replacement_character=" ";// replace with blank space $desc_string = preg_replace('/,/', $replacement_character, $desc_string); //echo $desc_string; //explode into an array $title_array = explode(" ", $title_string); //how many words in the array? $wordcount = count($desc_array); //echo $wordcount; $fontsize = rand(0,5)."em"; $color1 = rand (0, 255); $color2 = rand (0, 255); $color3 = rand (0, 255); $angle = rand (0,-90)."deg"; $width= rand (20, 400); $margin - rand (100, 400); $top = rand (-100, -1000); echo"<p style='-moz-transform: rotate($angle); z-index:0;font-size:$fontsize; line-height: 30%; color: $color1; background-color: rgb($color1,$color2,$color3);'>"; echo $title_string; echo "</p>"; echo "<img style = 'z-index:5; margin-left: $margin; margin-top: $top;' src = 'images/burroughs.png' width = $width'>"; echo "<img style = 'z-index:10; margin-left: $margin; margin-top: $top;' src = 'images/cage.png' width = $width'>"; echo "<img style = 'z-index:15; margin-right: $margin; margin-top: $top;' src = 'images/yokoono.png' width = $width'>"; echo "<img style = 'z-index:15; margin-right: $margin; margin-top: $top;' src = 'images/surrealists.png' width = $width'>"; } ?> On 15 March 2015 at 18:50, dave miller <[email protected]> wrote:hi edward It's just the furtherfield netbehaviour rss feed - I used php to pull out the titles and then placed/ coloured/ sized it at random using css. Have now added some pics of william burroughs, yoko ono, surrealists, and resized and positioned, again at random. Glad you like it! dave On 15 March 2015 at 18:30, Edward Picot <[email protected]> wrote:Michael - now that's what I like - a good sweary response. Dave - I really like that page you've done - I've looked at it several times and it comes up different every time - is it scripted in JavaScript or something, or is it just CSS, or even just HTML? Looking at the page source, it looks like a long and complex single line containing several paragraphs, with references to z-index and degree of rotation in each paragraph style. - Edward _______________________________________________ NetBehaviour mailing list [email protected] http://www.netbehaviour.org/mailman/listinfo/netbehaviour_______________________________________________ NetBehaviour mailing list [email protected] http://www.netbehaviour.org/mailman/listinfo/netbehaviour
<<attachment: davemiller-netbeatizens.php>>
_______________________________________________ NetBehaviour mailing list [email protected] http://www.netbehaviour.org/mailman/listinfo/netbehaviour
