[title sub="Written by Chris Graham, ocProducts"]ocPortal Tutorial: Advanced news[/title]

This tutorial describes some of the more complex features available for news, including blogging and syndication.


[contents]decimal,lower-alpha[/contents]

[title="2"]Personal Categories / Blogs[/title]

[html]<div class="float_surrounder">[/html]
[exp_thumb="A blog being started by adding news to a category that will automatically be created" float="left"]adv_news_blog[/exp_thumb]
[exp_thumb="The blog in action" float="right"]adv_news_blog_2[/exp_thumb]
ocPortal has advanced support for blogging: members in permitted usergroups may have their own personal news categories, otherwise known as 'blogs' (short for 'web logs').
[html]</div>[/html]

[html]<div class="float_surrounder">[/html]
[exp_thumb="The blog is linked to in the member profile" float="right"]adv_news_profile[/exp_thumb]
To create a 'blog', a member only needs to choose to add news, and select their own personal category; if the category does not yet exist, it will be displayed as 'new', and created automatically upon submission. The news will display on the front page of the website (by default), and the blog for the member may be viewed from the links given in their member profile.

There is a blogs CMS interface separate to the news CMS interface. This is provided for two reasons:
1) as a niceity so that you don't need to explain 'blogs are news' to your users
2) so you can lock down access, so that members may submit to blogs but not website news
The presence of the blogs CMS interface does not stop you using the regular news CMS interface to submit blog posts.
[html]</div>[/html]

[title="2"]Advanced filtering[/title]

The news system supports some advanced filtering:
 - Whether to show just non-blog posts, blog posts, or both
 - Whether to limit results to within certain news categories
 - As above, but double filtered so that news is only returned if it matches a second category filter also (this allows you to have a two-level news categorisation system, useful for large news sites)

The news blocks take parameters representing these filters, and then the links they spawn relay those, throughout the various navigation links.
Also, when you view a news post you can see what categories it is in and choose a new filter to limit results just to ones within that category.

[title="2"]Feeds[/title]

[html]<div class="float_surrounder">[/html]
[exp_thumb="Syndication links are displayed in the news block" float="right"]adv_news_rss_1[/exp_thumb]
ocPortal supports the two main formats for syndication of news (and most other kinds of content) in clean XML format: 'Atom' and 'RSS'. These formats are simple representations of news that may be viewed using an external program such as 'FeedReader', or incorporated onto another website. ocPortal itself provides two blocks that allow display of RSS and atom feeds in a news-like fashion (including feeds from other ocPortal sites, or any other site that provides them).
[html]</div>[/html]

[html]<div class="float_surrounder">[/html]
[exp_thumb="RSS/Atom are really XML formats, and look a bit like this" float="right"]adv_news_rss_xml[/exp_thumb]
Links to view the feeds are made available from the news blocks, as well as from the web browsers auto-discovery mechanism. If the news block is filtered (for a blog, for example) the link will open up the feed with the same filter. The URLs are not intended to be viewed directly, although we have used a technology called 'XSLT' to allow them to be displayed in the browser if desired; instead, they should be copied and pasted to another program.
[html]</div>[/html]

The [page="tut_comcode"]Comcode[/page] syntax you should use to place the main block in a page is as follows:
[code][block="http://example.com/feed.xml"]main_rss[/block][/code]

You may also use the compressed version intended for the sides of pages:
[code][block="http://example.com/feed.xml"]side_rss[/block][/code]

[exp_thumb="FeedReader is a good free program for viewing feeds" float="right"]adv_news_feedreader[/exp_thumb]
Please note that you should trust a feed before you consider placing it on your site, as it is possible for them to contain Javascript that could intercept your password cookies, and perform other malicious actions.

Before RSS and Atom became popular, there was a type of feed called a 'Javascript feed', and also feeds that work via 'iframes'. ocPortal supports use of these feeds simply by putting the HTML that the feed maintainers ask you to use in your website, inside a Comcode HTML tag. The nature of these feeds are such that they embed portions of HTML into your own site, either via Javascript adding it directly on the client-side (users computers), or via a frame: they provide a simple bridge, rather than a clean feed.

To see all the feeds available in ocPortal (news is just the most typical usage for them), you may go to [tt]http://yourbaseurl/backend.php[/tt]: you will be presented with a screen that lists the feeds. The screen here is written in yet another language named OPML, and again made viewable in a web browser using XSLT.

[title="3"]Yahoo Pipes[/title]

If you want to merge or filter feeds, [url="Yahoo Pipes"]http://pipes.yahoo.com/[/url] is an absolutely fantastic tool. You basically tell it to look at a set of RSS feeds, give it some filters, and you get an RSS feed you can then plug into ocPortal.

[title="2"]Trackbacks[/title]

[html]<div class="float_surrounder">[/html]
[exp_thumb="Special invisible mark-up code in the ocPortal HTML allows systems to see how they can place trackbacks to ocPortal" float="left"]adv_news_trackbacks_method[/exp_thumb]
[exp_thumb="Trackbacks as displayed" float="right"]adv_news_show_trackbacks[/exp_thumb]
Trackbacks are an advanced standard-based blogging feature, that allow a link to be established from an article on one blog to an article on another. It basically is a citation mechanism.
[html]</div>[/html]

Trackbacks work as follows:
1) The original article has a 'trackback' link written into the HTML
2) When a blogger decides to write an article based upon the original article, they inform their software of the source article they are citing
3) The software loads up the trackback link so as to inform the original article of the new one.
4) The original article then can display a list of articles that lead on from it, along with other features such as comments.

ocPortal can send trackbacks for news and receive them for almost any kind of content.

[title="2"]Avatars in news posts[/title]

By default news posts show the news category image rather than the poster's avatar.

If you uninstall the 'authors' addon it will automatically change to showing avatars. The reason being that default ocPortal acts more like a news site than a community site -- but by removing 'authors' you tell it you're not interested in that focus.

Instead of removing the 'authors' addon you could change the [tt]NEWS_PIECE_SUMMARY[/tt] template -- this template encodes the logic described above, so by changing the template you can achieve either behaviour, or any combination.

[title="2"]Integrating third-party widgets[/title]

There are a lot of 'widgets' out there for blogging platforms and there's nothing stopping you using them with ocPortal too. For example, [url="this widget"]http://www.backtype.com/widgets/backtweets[/url] allows you to see what people are saying about your article on Twitter. You could easily put the HTML provided into your [tt]NEWS_FULL_SCREEN[/tt] template.

[title="2"]Make news archive screens show summaries[/title]

The default news archive screen shows just the news headlines. By adding [tt]:inline=1[/tt] to the page-link you can make it show like the news block does.

[concepts
 1_key="Blog"        1_value="A contraction of web-log: the popular term for an on-line journal"
 2_key="Blogger"     2_value="Someone who runs a blog"
 3_key="RSS"         3_value="Really simple syndication: a family of news feed formats"
 4_key="Atom"        4_value="A news feed format made official by a standards body"
 5_key="Trackback"   5_value="A trackback is placed at the content home-site when a blogger references a piece of content- in essence, allowing the source material to automatically link to those that reference/quote/comment-upon it"
]Concepts[/concepts]

[title="2"]See also[/title]

 - [page caption="Releasing news & running a blog"]tut_news[/page]
 - [page caption="Comcode and the attachment system"]tut_comcode[/page]
 - [url="FeedReader"]http://www.feedreader.com/[/url]


