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
HotNews box; welcomebox kinda of thing; By kazgor
Topic Started: Jan 23 2010, 01:04 AM (107 Views)
Reid
Member Avatar
È una trappola!

This topic has been moved from our official support board.

Originally posted by: kazgor
HotNews box; welcomebox kinda of thing
 
This as been updated further down.. Jump to it

I seen a few News/welcome boxes in here but all didnt really meet my needs apart from one which i can't remember.. I've kinda tweaked this one a little to be more what i wanted.

It will fit perfect with the current theme, although maybe little colour tweak depending on your site colours.

Basically it creates a table with 3 columns, first one is the News date, then a brief News description and finally a link to the Post.

Preview: Here

goes in after the

Admin center --> Skinning & Styles --> Board Wrappers --> Header & Body --> <% NAVIGATION %>

Quote:
 

<script language="JavaScript">
<!-- Begin Hotnews

var hotnews = ""
var v_date=new Array()
var v_desc=new Array()
var v_link=new Array()
var v_linkt=new Array()
var rowcolour=""

var titleheader="Hot News"
v_date[0] = '01/01/2005'
v_desc[0] = 'Happy New year to all coders out there'
v_link[0] = 'http://your_post_url_here'
v_linkt[0] = 'Read More'

v_date[1] = '25/12/2004'
v_desc[1] = 'All the best for Christmas'
v_link[1] = 'http://your_post_url_here'
v_linkt[1] = 'Click for more'

v_date[2] = '20/09/2004'
v_desc[2] = "Its my Birthday"
v_link[2] = 'http://your_post_url_here'
v_linkt[2] = 'Click me'

hotnews=hotnews+"<table align='center' border='0' width='92%' cellspacing='0' cellpadding='0' class='tableborder'>"
hotnews=hotnews+"<tr><td>"
hotnews=hotnews+"<table cellpadding='4' cellspacing='1' border='0' width='100%'>"
hotnews=hotnews+"<tr><td class='maintitle' align='center' colspan='3'>"
hotnews=hotnews+"<font color='FFFFFF' size='2'><b>" + titleheader + "</b></font></td></tr>"

for(d=0; d<v_date.length; d++)
{
if (d % 2 == 0) {cellcolour='row3'} else {cellcolour='row4'}

hotnews=hotnews+"<tr>"
hotnews=hotnews+"<td width='20%' valign='top' class=" + cellcolour + ">"+ v_date[d] + "</td>"
hotnews=hotnews+"<td width='60%' valign='top' class=" + cellcolour + ">"+ v_desc[d] + "</td>"
hotnews=hotnews+"<td width='20%' valign='top' class=" + cellcolour + "><a href='" + v_link[d]+ "'>" + v_linkt[d] +"</a></td>"
hotnews=hotnews+"</tr>"
}

hotnews=hotnews+"<tr><td class='darkrow2' colspan='5'>&nbsp;</td></tr>"
hotnews=hotnews+"</table></td></tr></table>"

document.write(hotnews)

// End Hotnews -->
</SCRIPT>


In the above there will be 3 rows displayed.. the text that appear in the following fields.

titleheader = the box title
v_date[n] = your news date goes here
v_desc[n] = brief description
v_link[n] = url to your news posting
v_linkt[n] = the text thats displayed rather that the above url

n = is the array index, this starts at 0 and goes up... , array 0 is displayed first.


Draw back of the above.

As more and more lines are added the box will just increase in size, so you would have to decide to say only have 5 news items displayed and you have to would have to drop off a old item when adding something new.

It would be nice if the above say displayed the first 5 news items and anymore would be in scrollable window to see the rest.

When adding new items, as i have the latest news showing at the top, it mean you have to increase each index value first to make room for the new one to go at array 0

yes i know i could have used say

var v_date = new array(date1, date2, date3, date4)

but with big URLS it very hard to read and amend where the above its more readable.

Comments always welcome, and please feel free to update this and make it better :)
Offline Profile Quote Post Goto Top
 
1 user reading this topic (1 Guest and 0 Anonymous)
« Previous Topic · Codes & Modifications · Next Topic »
Add Reply