Jump to content
vBWarez - Rest In Peace

Recommended Posts

Owen to all the newly broken modules and products of vB5.1.x upgrades, I find myself coming up with code to fit my needs.
I present this one free for use.

While not unique, it resolves of lot of issues vBulltin has implemented.
Many of those issues are depreciated code standards.
As it still works, I used the STATIC HTML module to enter this code, though one can edit any template to add it.

The short of what it does is adds a module that shows the last 10 RSS feeds sent out.

Title: Latest NEWS Broadcasts
HideTitle: No
Code:

[code]
<vb:if condition="!is_member_of($user, 1)">
<script src="/external?lastpost=true&type=js&nodeid=13" type="text/javascript"></script>
<div id="vb_Ext">
<a href="/articles/">Read more.</a><br />
<script type="text/javascript">
<!--
var ext = document.getElementById("vb_Ext");
for (i in threads)
{
var txt = document.createTextNode(threads[i].title.slice(0,80) + " (" + threads[i].poster + ")");
ext.appendChild(txt);
var br = document.createElement("br");
ext.appendChild(br);
}
//-->
</script>
</div>
</vb:if>
[/code]

Notes:
<script src=" replaces the depreciated script write that vB still uses.
nodeid=13 replaces forumID= and the 13 is the forum feed. Most people will use 1.
The link to /articles/ can be replace with what ever forum you are using in the nodeid.
slice(0,80) truncates the article to 80 characters, which is safe for mobile devices. You may set it to what you like.
By using getElementById("vb_Ext"); we no longer run a security risk of direct read/write.
No CSS is required as it takes it directly from the page in which it has been embedded.
By using relative paths we ensure the code is not site specific and works for all. src="/external
And of course, the VB code wrapper ensures only logged in users see the news.
Link to post
Share on other sites
  • 4 months later...
vB 5.1.9 has made some RSS changes to its code. You can now specify the count. Without it, the script defaults to the external reader setting, which could be in the hundreds.
I have selected count=7 to show the past weeks postings.
Here is the new code.

[CODE]
<vb:if condition="is_member_of($user, 2)">
<script src="/external?lastpost=true&count=7&type=js&nodeid=1" type="text/javascript"></script>
<div id="vb_Ext">
<a href="/articles/">Read more.</a><br />
<script type="text/javascript">
<!--
var ext = document.getElementById("vb_Ext");
for (i in threads)
{
var txt = document.createTextNode(threads[i].title.slice(0,80) + " (" + threads[i].poster + ")");
ext.appendChild(txt);
var br = document.createElement("br");
ext.appendChild(br);
}
//-->
</script>
</div>
</vb:if>
[/CODE]

[ATTACH=CONFIG]10853[/ATTACH]
Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...