Welcome Guest [Log In] [Register]
Welcome to the home of Viral's Modifications. We hope you enjoy your visit.

This forum is used for support and feedback purposes only. All modifications can also be found on the official site.

Username:   Password:
mQuote [-] mQuote [+]
Add Reply
Automatic Announcement Box; Created: 02/09/2010
Topic Started: May 10 2015, 11:06 PM (1,374 Views)
Member Avatar
What this does: This makes an announcement box which automatically retrieves the contents of the first post in the latest topic posted in a specific forum. For example, this code could automatically retrieve the latest news you post in the announcement forum, and then members will be able to see it in an announcements box at the top of the index page. The news in the announcement box is in a marquee (it scrolls) so you can see everything without it taking too much space.


Where does it go: Admin CP >> Themes >> Board Template >>

<script type="text/javascript">
forum = 12345; // forum id to get the topic from
title = 'Announcements'; // title of the new table
speed = 2; // higher = faster
height = 100; // in pixels
$.get($("#inlinetopic table.posts tbody tr:eq(1) td.c_cat-title a",d).attr("href")+'1/',function(e){
content = $('td.c_post:first',e).html();
$("div.category:first").prepend('<div id="news" style="padding-bottom:10px;"><div class="category"><table class="cat_head"><tbody><tr><td><h2>'+title+'</h2></td></tr></tbody></table><table><tbody><tr><td valign="center"><div style="width:50%;text-align:center;margin-left:25%;height:'+height+'px;"><marquee height="'+height+'" direction="up" onmouseover="this.stop();" onmouseout="this.start();" scrollamount="'+speed+'" style="text-align:center;">' + content + '</marquee></div></td></tr></tbody></table></div></div>');

Instructions: Find the forum that you want the code to retrieve posts from. Look in the address bar and note down the forum ID. The forum ID is the string of numbers at the end of the URL. For example, if the URL is http://support.viralsmods.com/forum/1710314/, then the ID is 1710314. Edit the `forum` variable in the above code (replace the number `12345` with the one you have noted down).
ZetaBoard's Dynamo Developer
MEng Aeronautical Engineering @ Imperial College London

Offline Profile Quote Post Goto Top
1 user reading this topic (1 Guest and 0 Anonymous)
« Previous Topic · Basic Modifications · Next Topic »
Add Reply

Theme by Symbiote & Foxx of Outline