MNN News
Moderator: Erik Mortis
- Ari Rahikkala
- Posts: 4326
- Joined: Sun Jan 21, 2001 12:56 pm
- Contact:
MNN News
Well, Iain gave me the idea, so I figured I might give it a try. I quickly hacked up a display of the MNN News And Comment feed. Updated hourly. I'm not particularly happy with its positioning on the page though... I keep confusing it with the forum-related links above it... but didn't really have any better ideas where to put it. But maybe someone else does?
No-one should be without a parasol, Sirocco.
Re: MNN News
It isn't bad! But maybe next to the banner (at the left to avoid confusion). ![Anal-Retentive :document](./images/smilies/document.gif)
![Anal-Retentive :document](./images/smilies/document.gif)
From a distance I'm concerned about the rampant lawyerism manifesting itself in Shireroth currently. A simple Kaiserial slap on the wrist or censure by the community should suffice. - Jacobus Loki
Can't you see? I'm crazy!
![Rampaging :smashy](./images/smilies/smashy.gif)
Can't you see? I'm crazy!
![... :tomcutterhamonfire](./images/smilies/tomcutterhamonfire.gif)
![Rampaging :smashy](./images/smilies/smashy.gif)
-
- Posts: 270
- Joined: Wed Jan 31, 2007 3:11 pm
Re: MNN News
Ooh, thank you. Yes the positioning question is a good one, as the Malarbox does give Shireroth a unique header layout. I don't know if a horizontal ticker of sorts would look better, but that's what I had envisaged would work reasonably well with most forum header layouts.
-
- Posts: 7238
- Joined: Thu Oct 02, 2003 10:37 pm
- Location: County of Monty Crisco
- Contact:
Re: MNN News
Could we add Harvey's thing?
- Harvey Steffke
- Posts: 1599
- Joined: Sat Feb 23, 2008 9:28 pm
Re: MNN News
Harvey's thing is with the rest of the links "Calendar - Wiki - Bank - Aurora - MCS - Chat"
Also, the MNN feed will display my stories when I write something current. In fact, it's displaying one of them now.
Also, the MNN feed will display my stories when I write something current. In fact, it's displaying one of them now.
-
- Posts: 7238
- Joined: Thu Oct 02, 2003 10:37 pm
- Location: County of Monty Crisco
- Contact:
Re: MNN News
Well then.. Goodo.
Re: MNN News
Ari, can you send me the code of the MNN Newsbox? Batavia wants to use it. ![Angelic :angel](./images/smilies/angel.gif)
![Angelic :angel](./images/smilies/angel.gif)
From a distance I'm concerned about the rampant lawyerism manifesting itself in Shireroth currently. A simple Kaiserial slap on the wrist or censure by the community should suffice. - Jacobus Loki
Can't you see? I'm crazy!
![Rampaging :smashy](./images/smilies/smashy.gif)
Can't you see? I'm crazy!
![... :tomcutterhamonfire](./images/smilies/tomcutterhamonfire.gif)
![Rampaging :smashy](./images/smilies/smashy.gif)
- Ari Rahikkala
- Posts: 4326
- Joined: Sun Jan 21, 2001 12:56 pm
- Contact:
Re: MNN News
To be honest it's one of those things that consist of a lot of glue and little complicated code, so there's going to be almost as much work in integrating it as there was in writing it in the first place. But if you really want to know...
First, there's a script, called snarf_mnn.php, placed in my home directory at my hosting account:
Very straightforward as you can see. Just fetches the micronations.net RSS, and outputs a list of the first five items. There's a reason it's called Really Simple Syndication, you know. Also in the straightforwardness department it'll break if there are less than five items in the stream, but I'm assuming that will never happen
.
It's called hourly from cron - how to call things from cron is completely host-dependent, for instance on Bluehost there's a "cron jobs" option in the control panel, and the program for running PHP scripts is called php5-cli. But you don't really have a choice other than to know how to run scheduled jobs if you want to make any use of this script.
Anyways, as you can see it creates a file named mnn_update.txt, conveniently right there in the forum directory. This file is then read in includes/functions.php, in the function page_header():
^ goes anywhere in that function before the big assign_vars block
^ goes inside the big assign_vars block... come to think of it you don't even need the variable there...
Anyways, now the template variable "MNN" contains the list of links to the newest news at the MNN. For instance in the Malarbor template it's added in as simply as putting in this in the appropriate place:
So, yeah, basically. In so many words, if you already are competent know your php and phpBB and how to configure stuff at your webhost, most of this code is not of much help since you already know how to write it, and if you aren't, you won't be able to integrate it. So it's not really all that useful altogether. But I figured that the best way of explaining why you don't really want to see the code would be to show the code and explain why you didn't really want to see it![razz :p](./images/smilies/tongue.gif)
First, there's a script, called snarf_mnn.php, placed in my home directory at my hosting account:
Code: Select all
<?php
$xml = simplexml_load_file ("http://www.xfruits.com/micronations/?id=67998");
if (!$xml)
die ("Couldn't fetch MNN RSS XML");
$str = "<ul>";
$n = 5;
for ($i = 0; $i < $n && $xml->channel->item[$i]; $i++) {
$str .= "<li><a href=\"" . $xml->channel->item[$i]->link . "\">" . $xml->channel->item[$i]->title . "</a></li>";
}
$str .= "</ul>";
file_put_contents ("public_html/shireroth/forum/mnn_update.txt", $str);
?>
![razz :p](./images/smilies/tongue.gif)
It's called hourly from cron - how to call things from cron is completely host-dependent, for instance on Bluehost there's a "cron jobs" option in the control panel, and the program for running PHP scripts is called php5-cli. But you don't really have a choice other than to know how to run scheduled jobs if you want to make any use of this script.
Anyways, as you can see it creates a file named mnn_update.txt, conveniently right there in the forum directory. This file is then read in includes/functions.php, in the function page_header():
Code: Select all
$mnn_text = file_get_contents ($phpbb_root_path . "mnn_update.txt");
Code: Select all
'MNN' => $mnn_text,
Anyways, now the template variable "MNN" contains the list of links to the newest news at the MNN. For instance in the Malarbor template it's added in as simply as putting in this in the appropriate place:
Code: Select all
<div style="border: 2px solid black; background-color: #000066; margin-top: 5em;">
<center>MNN news</center>
{MNN}
</div>
So, yeah, basically. In so many words, if you already are competent know your php and phpBB and how to configure stuff at your webhost, most of this code is not of much help since you already know how to write it, and if you aren't, you won't be able to integrate it. So it's not really all that useful altogether. But I figured that the best way of explaining why you don't really want to see the code would be to show the code and explain why you didn't really want to see it
![razz :p](./images/smilies/tongue.gif)
No-one should be without a parasol, Sirocco.
Who is online
Users browsing this forum: No registered users and 4 guests