importingheadlines

Importing Headlines

This is HowTo import headlines to your website. Sometimes you want to insert some extra information on one of your weblogs pages. This could be the headlines of one of your other blog or the headlines from an external source like http://www.Slashdot.org/. This can be done by different means.

  • First this can be done with an iframe or an parseinclude in your skin. Method 1. (On the forum I always search for only8.php because i always use that filename for importing 8 headlines ...) This method also works on non-blog homepages.
  • Second this can be done by importing the headlines with a plugin which came up later after i wrote the Newsfeed plugin. This method only works from within Nucleus.

IFrame or parsedinclude()

This method relies on what you get and is mainly intended to use for importing the headlines of your own blogs cause there is no way you can manipulate what is beeing shown. I will explain this method by setting up an iframe on the place where we want to show the headlines. Secondly you have a second blog by the name of secondblog. Create an php file by the name of only8.php. Open this file for editing and insert the following code.

<?
	header("Pragma: no-cache");
	$CONF['Self'] = "only8.php";
	include('config.php');
	selectSkin('headlines');
	selectBlog('secondblog');
	selector();
?>

Store this file on the webserver in the same directory as config.php and index.php. Now we open Nucleus and go to adminarea. There you select to clone the xmlrss template and call it headlines. Now we will edit this template further, by changing the item bit:

<item>
<title><%syndicate_title%></title>
<link><%blogurl%>index.php?itemid=<%itemid%></link>
<description><%syndicate_description%></description>
</item>
<%comments%>

into something like this:

<a href="<%itemlink%>"><%title%></a><br />

Now go to the skins department and clone your xml-rss skin. Call it headlines. (or any other name, as long as it is the same as what you choose in: selectSkin(’headlines’);).
Edit this skin; change: <%blog(xmlrss,10)%> into <%blog(headline,10)%>.

Now you can test this page just by opening this new file in the browser: http://www.yourdomain.com/only8.php. If you like what you see, we continue to the last bit, calling this page as the source for your iframe and your all set. If you don’t want an IFrame, just put a

<%phpinclude(only8.php)%>

anywhere in your skin.

Importing Headlines with a plugin

When you want a more controlable and more flexible solution you can use the plugin method. This method relies on RSS Syndication of the headlines you want to use. All your Nucleus blog export the headlines by default. And other sites like Slashdot publish their headlines as well by means of RSS. This gives you the opportunity to import these headlines to your homesite or another weblog.
First of all you’ll need the Newsfeed plugin and install this in de adminarea. I’m asuming that your secondblog has BlogId number 2. After installing the plugin, go to the skin of your blog where you want to import the headlines and simply put <%Newsfeed(http://www.yourdomain.com/xml-rss2.php?blogid=2)%> This will post 10 headlines of your second blog on your site. You can as many feeds on your page as you want. Just add another if you want like: <%Newsfeed(http://www.yourdomain.com/xml-rss2.php?blogid=2)%> Or if you want to see the latest headlines from Slashdot just type <%Newsfeed(http://slashdot.org/slashdot.rdf)%> The newsfeeds are all surround by div tags so you can edit your stylesheet accordingly. See NewsFeed for more documentation on how to use this plugin in detail.
:: HowTo ::

 
importingheadlines.txt · Last modified: 2007/02/07 03:04 by xiffy