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
  • 3
News On Your Forum
Topic Started: Jul 14 2016, 11:05 PM (2,743 Views)
Skyon Archer
Member Avatar
Member
[ *  *  *  * ]
Code Name: News On Your Forum
What the code does: Integrates Top Stories or specific news headlines on your forum
How to use the code: Admin CP > Board Template > Above the Copyright. There are three edits available, continue reading....
How to install the code: See below
Extra notes:
If you do not enter any information for the variables, the script will automatically display ten Top Stories.

Code:
 
<script type="text/javascript">
// BEGIN: ENTER YOUR NEWS TOPIC, ID/CLASS WHERE YOU WANT NEWS DISPLAYED, NUMBER OF DISPLAYED STORIES

var newsTopic = 'YOUR-NEWS-TOPIC';
var newsCount = '10'; // default is 10, maximum is 15
var whereGoes = '#main'; // where does it go?

// END: THAT'S IT, SAVE "ABOVE THE COPYRIGHT"

if(whereGoes === ''){ var whereGoes = '#main'; }
$.ajax({ type: "GET", url: "http://newsheadquarter.com/remote.php?f="+newsTopic+"&c="+newsCount, success: function (mystring) {
$(whereGoes).append(mystring);
}
});
</script>


Say you are running a Harry Potter forum. Maybe you'd like to display some headlines about good ol' Harry. In that case, you would replace YOUR-NEWS-TOPIC with Harry Potter. You would then be presented with news articles about Harry Potter:

Posted Image

Or maybe you want to display Call of Duty or Photoshop news:

Posted Image
Posted Image

Now, this code will automatically append the news to the bottom of the board. If you want it to be somewhere else, you simply put the ID or CLASS of that selector in the variable of whereGoes. For instance, if you want it displayed at the top of your forum, you may put a division with an ID of "news" in the "Above the Board" section of your ACP. As such, you would put #news:

Code:
 
var whereGoes = '#news';


Remember, if you simply make the variables blank, it will show ten Top Stories below your forum.

Questions/Complaints? Let me know! For a live preview, visit http://s15.zetaboards.com/NewsOnForum/index/
Offline Profile Quote Post Goto Top
 
Replies:
Jon Galt
Member
[ * ]
I can't get this to work. I've tried inserting it within the CSS at multiple locations, as is, and with multiple keywords.

I'm totally clueless on this stuff so I'm guessing it's me.
Offline Profile Quote Post Goto Top
 
DaPizzaMan
Member Avatar
#TeamSupport

Jon Galt
Oct 15 2017, 02:30 PM
I can't get this to work. I've tried inserting it within the CSS at multiple locations, as is, and with multiple keywords.

I'm totally clueless on this stuff so I'm guessing it's me.
It goes in Admin CP > Board Template > Above the Copyright.
Offline Profile Quote Post Goto Top
 
Jon Galt
Member
[ * ]
Yup it was me.


Thank you!!!
OK, last dumb question.

How do I link it to the news feed on a site like www.autonews.com?

Thanks
Edited by Jon Galt, Oct 15 2017, 02:54 PM.
Offline Profile Quote Post Goto Top
 
DaPizzaMan
Member Avatar
#TeamSupport

Jon Galt
Oct 15 2017, 02:45 PM
How do I link it to the news feed on a site like www.autonews.com?
Code:
 
var newsTopic = 'YOUR-NEWS-TOPIC';
Set YOUR-NEWS-TOPIC to autonews.
Offline Profile Quote Post Goto Top
 
Jon Galt
Member
[ * ]
I thought I did that at first.

Thank you very much!!!
Offline Profile Quote Post Goto Top
 
polocolo
Member Avatar
Member
[ *  *  * ]
Is this still working? It has stopped working on mine.
Offline Profile Quote Post Goto Top
 
Skyon Archer
Member Avatar
Member
[ *  *  *  * ]
I looked at your site and do not see the division of where you are trying to post the news at. Nothing has changed in the script so it should be working. Verify you have the correct division id set where you want the news published to.
Offline Profile Quote Post Goto Top
 
1 user reading this topic (1 Guest and 0 Anonymous)
« Previous Topic · ZetaBoards Codes & Modifications · Next Topic »
Add Reply
  • Pages:
  • 1
  • 3