We hope you enjoy your visit.

You're currently viewing our forum as a guest. This means you are limited to certain areas of the board and there are some features you can't use. If you join our community, you'll be able to access member-only sections, and use many member-only features such as customizing your profile, sending personal messages, and voting in polls. Registration is simple, fast, and completely free.


Join our community!


If you're already a member please log in to your account to access all of our features:

Username:   Password:
Add Reply
  • Pages:
  • 1
News Box
Topic Started: Jul 24 2010, 08:03 PM (5,347 Views)
ProAyanami
Member Avatar
The Coder
[ *  * ]
News Box
Description: Gets the first post from a topic and displays it as news.

Preview: http://s1.zetaboards.com/ProTestBoard/index/



The Code:
Code:
 
<script type="text/javascript">
var news_title = "News"
if(window.location==main_url + "index/"){
document.write('<style>.editby{display:none;}</style>')
var topic_id = "3619195"
$.get(main_url + "topic/" + topic_id + "/1/",function(Q){
$("div.category:first").prepend('<div id="News" style="margin-bottom:15px;"><div class="category"><table class="cat_head"><tbody><tr><td><h2>' + news_title + '</h2></td></tr></tbody></table><table cellpadding="0" cellspacing="0"><tbody><tr><td style="width: 75%;" valign="center">' + $(".c_post:first",Q).html() + '</td></tr></tbody></table></div></div>');
});
}
</script>


Extra Notes:
Change news_title to the news box title you want. Change topic_id to the topic id that you want used. To update news box, just edit your first post there. It's that easy to use.

Goes below the board.
Edited by ProAyanami, Jul 25 2010, 05:40 PM.
Offline Profile Quote Post Goto Top
 
IF User (P)
Member
[ * ]
Nice! :D
Offline Profile Quote Post Goto Top
 
Geoffrey
Member Avatar
bury hatchets, keep maps
[ *  *  *  *  * ]
I added it to my "Top of the Page" and "Above the Board" (since that would be where I want it to appear, use a topic in the Staff Forum that I was going to use just for the purpose of that box, and it doesn't work. Nothing shows up at all.
Offline Profile Quote Post Goto Top
 
ProAyanami
Member Avatar
The Coder
[ *  * ]
It goes in below the board.
Offline Profile Quote Post Goto Top
 
Geoffrey
Member Avatar
bury hatchets, keep maps
[ *  *  *  *  * ]
Oh, okay. I'll try that then. Thanks!
Offline Profile Quote Post Goto Top
 
ProAyanami
Member Avatar
The Coder
[ *  * ]
Also, you must use a topic that all your members can view otherwise they will get null as the news.
Offline Profile Quote Post Goto Top
 
raverbabi
Member
[ * ]
i put it in and it has not shown up on the forum
Offline Profile Quote Post Goto Top
 
Geoffrey
Member Avatar
bury hatchets, keep maps
[ *  *  *  *  * ]
Oh, well, I guess I should fix that.
Offline Profile Quote Post Goto Top
 
raverbabi
Member
[ * ]
Thanks :D
Edited by raverbabi, Jul 26 2010, 01:25 PM.
Offline Profile Quote Post Goto Top
 
mawnty
Member Avatar
Member
[ * ]
thanks <3
Offline Profile Quote Post Goto Top
 
Jayd101
Member Avatar
Member
[ * ]
This dosen't work!
Offline Profile Quote Post Goto Top
 
mawnty
Member Avatar
Member
[ * ]
how can I add a link in this?
anyway, thanks
Offline Profile Quote Post Goto Top
 
ProAyanami
Member Avatar
The Coder
[ *  * ]
Jayd101
Jul 30 2010, 02:59 AM
This dosen't work!
What do you mean this doesn't work?
Offline Profile Quote Post Goto Top
 
Jayd101
Member Avatar
Member
[ * ]
I tried putting it on my board and it won't work.
Offline Profile Quote Post Goto Top
 
Swim-ZNR
Member Avatar
Gaga for Gaga
[ *  *  * ]
Says "null."
Offline Profile Quote Post Goto Top
 
1 user reading this topic (1 Guest and 0 Anonymous)
Go to Next Page
« Previous Topic · ZetaBoards Codes & Modifications · Next Topic »
Add Reply
  • Pages:
  • 1