Jump to content


Photo

Exporting news posts to a website (MasterNews)


  • Please log in to reply
4 replies to this topic

#1 Jeeves

Jeeves

    I write the interwebz

  • Members
  • 4,156 posts
  • Gender:Male
  •  Friendly neighborhood standards Nazi

Posted 13 July 2007 - 05:03 AM

Intro
The news you see on the Revora Frontpage and the Network hubs, is all powered by a powerful system called MasterNews3 (Abreviated to MN3), writen by MasterMind.
This system is also availible for use by all hostees at Revora, and indeed, is used by many already. As such, this tutorial is for anyone who wants, or already has MN3, and should help you come to terms with what it is, how to get it, and how to use it.

Soo... What is it?
As you may have noticed, there are things on many sites here that are the same in, and often linked to, the forums. These bits are called "News," and are indeed the code in the forums rewritten onto the site. MN3 is the system that rewrites it.
MN3 can be set up to export the posts from any forum, and include the contents on any site - and in the case of most hosted sites, the network hub too. This means your site contents is always as up to date as your forum, and you can get more coverage on the networks hub site.
When it rewrites the forum post, it writes it into a template, giving you control of how and where it will display information such as the post title, contents, postdate, etc. The template is covered in more detail below.

Great! So how can I get it?
All you need to get MN3 is ask - any admin or network leader can set it up, but with anything, its best to post your request here.
To get set it up, all you need to do is provide the admin with the forum you want exported, a template for how it will be exported to your site, and the maximum number of posts you are going to want on your site.
As mentioned, any forum can be set up to use MN3, but its advised that you have a News Forum for your projects news. If you don't have one, an admin can set one up, but don't forget to give them a name and description for it.
The template you will have to write yourself, and is explained below. As for the number of posts, it depends on how long you want your site to be - the more posts the longer it will be to scroll down, and the slower it will load. The default is 5, but MN3 can work with any number.

So whats the template?
When MN3 reads your news post in the forum, it extracts it into little bits of information, such as the postdate, title, posting memember, etc. To get any or all of this information onto your site, it needs a template to tell it how to display it - what to display and where to put it.
The template is just the html that the news is written into, so you do not need to include any structual markup, such as the <html>,<head>, or <body> tags, etc. Before going into what you can include into the template, a simple example:
<h3>{title}</h3>
<p>{post}</p>
<p>Posted on {postdate}, by [profilelink]{member}[/profilelink].
As you can see, the html used can be very basic as it will be writen into your existing page, rather than linked to or viewed like a frame. If you use a html generator to write your template, you will need to edit the source to include some extra tags for the content, and when you do, be sure to remove the <body> tag, anything before, and the </body> and anything after, and any other content you have.
To get your post in your template, you need to use some special tags. These are explained below:

Replacement tags:
{avatar} - Replaced with the avatar image of the user from the forums.
{member} - Replaced by the name of the member posting.
{memtitle} - Replaced by the title of the member posting.
{title} - Replaced by the topic title.
{description} - Replaced by the topic description.
{post} - Replaced by the post data.
{postdate} Replaced by the date of the post.
{comments} - Replaced by the number of replies to the topic.
{forumname} - Replaced by the name of the forum the topic is in.
{topiclink} - Replaced by a text link to the topic.
{postdate} - Replaced by the date the topic was posted.

Supported "BBCode"
[profilelink][/profilelink] - Creates a link to the member profile with the enclosed text.
[topiclink][/topiclink] - Creates a link to the topic with the enclosed text.
[replylink][/replylink] - Creates a link to the reply page for the topic with the enclosed text.
So, going back to our example, you can see that the title of the news post will be written inside the <h3> tag. The actual post will be in a <p> tag. A second <p> will contain the text "Posted on" followed by the postdate, the text ", by " and finally a link to the profile of the poster, with their name inside the link text.

If you're unfamiliar with coding, this may seem scary, but fear not! Just write your html and use some common sense - if you want the post somewhere, just write put "{post}" there. MN3 will do the rest.

Making your template look good.
Having your template, and making it look good, can two different things. In this section I'm going to mention CSS - for those unfamiliar with CSS, its a simple language for styling html. Its often used in a seperate file, or in a <style> element in the documents <head>.

As MN3 writes your news into your template, then into the page, everything in the template will be written into the page for each news post. As such, MN3 works with CSS, but CSS should not be included in the template itself; instead stick to giving tags class attributes and having your CSS on the site.

Also, give regard to anything that you may have in your post; cheifly Quotes and Code.
Say your news post contained the following:
[quote]Foo[/quote]
MasterNews would output this as the following:
<div class='quotetop'>QUOTE</div><div class='quotemain'>
Foo
</div>

Likewise, as code it would be output as:
<div class='codetop'>CODE</div><div class='codemain'>
Foo
</div>
.

The main thing to watch out for here is the quotetop and codetopdiv's; without styling this will display the word "QUOTE" or "CODE" on a line above your quote, and does not look that great. Make use of the class selectors for "quotetop", "codetop", "quotemain" and "codemain" and you can easily style them however you want.

To easily make the "QUOTE" and/or "CODE" disapear from before your quote/code blocks, you can use the following CSS:
.quotetop, .codetop { display: none; }
For more advanced styling, you can make quotes and code look as they do in the forums by mimicking the style in the source for the aforementioned classes.

MN3 also supports the following BBCode in your posts:
[mn3]post-img:image.path/without-http[/mn3] - displays an image.
[left][/left] - Aligns the enclosed text to the left.
[center][/center] - Centers the enclosed text.
[right][/right] - Aligns the enclosed text to the right.
.

Using MN3
Once you've made your request, you'll be provided with a line of code looking something like:
<?php readfile('http://revora.net/masternews3/news/#.php'); ?>
Simply explained, <?php ?> denotes this as a php script. The include("url") tells it to include a file, and gives the url. In this case, the "#" would be changed to your news forums forum number. So, with one little line your news will be incorperated into your site.
Note: PHP requires the php extension to work, so make sure your site uses the ".php" file extension instead of ".html", etc. As its just a scripting language, PHP uses html for markup, so the rest of your site will be unaffected by the change of file extension.
Simply place the <?php readfile(); ?> where you want the news to appear on your page, and once uploaded you should see your news appearing on your site.

You can change and experiment with your template by logging in to the MN3 ControlPanel (http://revora.net/masternews3/). This uses the same login credentials as you have in the forums, and once logged in you should be able to edit and preview your template.

If your news does not display immediately, it may have to wait for the forum cache to update, which can take up to 30mins. If you ask nicely, an admin may do it manually. Any changes to your template should be visable as soon as you refresh your page.

Outro
The main thing to worry about with MN3 is the template.
CSS can be easily changed on your site, and once its set up, your template can be editted - take advantage of this to play about a bit.
And if you have any problems, just ask Posted Image

Edited by Phil, 15 October 2012 - 09:35 PM.
Updated information

World Domination Status: 2.7%


#2 {IP}Sauron

{IP}Sauron

    title available

  • Hosted
  • 391 posts
  • Gender:Male
  • Location:Denmark
  •  Istari Productions Leader

Posted 15 August 2007 - 01:53 PM

wow nice!
"A still more glourious dawn awaits. Not a sunrise, but a galaxy-rise. A morning filled with 400 billion suns." - Carl Sagan
Posted Image

#3 Jeeves

Jeeves

    I write the interwebz

  • Members
  • 4,156 posts
  • Gender:Male
  •  Friendly neighborhood standards Nazi

Posted 16 August 2007 - 01:59 AM

thanks, I'm glad someone besides me read it :rolleyes:

World Domination Status: 2.7%


#4 Fingulfin

Fingulfin

    I Like Pi3. Do you?

  • Hosted
  • 1,752 posts
  • Gender:Male
  • Location:California, USA
  • Projects:Staying Alive.
  •  This place looks familiar. I can't remember why.

Posted 23 December 2007 - 05:10 PM

Ack, I bumpy topic.

I have been playing around with my masternews script for my new website and... Well... I would like to know how I can format links (more specifically, the topic link) I tried everything I could think of, and none of it works. Any Ideas?

EDIT: Another thing... Is there any chance that you will update the script to properly validate with the W3C Validator as XHTML? Right now it outputs HTML 4.0, but I much prefer XHTML. Whenever I run my page through the validator it brings up like 60 errors, all due to the news script :p

Edited by Fingulfin, 23 December 2007 - 05:12 PM.

Posted Image
--------------------------------------
"You look like a ghost of your former self..."

#5 Jeeves

Jeeves

    I write the interwebz

  • Members
  • 4,156 posts
  • Gender:Male
  •  Friendly neighborhood standards Nazi

Posted 24 December 2007 - 12:47 PM

It outputs whats in the template... Besides that, it can't tell what pictures or links are for so not sure how possible it would be to get alt and titles, etc.
The tag for a link, or anchor is <a>, so you'd be using "a" as your selector if you are using CSS for your formatting. If you're after a specific link in the template you could give it a class (<a class="yourclassname"> would be "a.yourclassname"). You may also want to give the news post/template a class, so you can style your links just for the news and not the whole site.
If this is what you tried and didn't work, and you've styled links elsewhere on the site it could be a matter of specificity, which you'd fix by making your selectors more specific. Using a class on the news should be enough.

If you want more help or explanation let me know, or give me a link so I can check :p

World Domination Status: 2.7%





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users