PDA

View Full Version : New Posts In A Content Box?


tome109109
10-01-2008, 02:56 PM
A bit like on inwarez.com , you see how they have got the new posts javascript runnin on the sidebar? Are there any tuts/ guides on how to make this? Ive got the content box just need the JavaScript.

-Cheers Tom

Lynne
10-01-2008, 03:30 PM
Did you try looking in the page source? There is javascript right there in the source code.

tome109109
10-02-2008, 03:01 PM
yeh bit i have no idea what to do with it , please explain a little.

Lynne
10-02-2008, 03:45 PM
Hmmm, well, I'm not javascript expert, but I'd start by copying/pasting that javascript along with the ilayer and layer tags into my page (and the corresponding end tags for them). I'd spit that out just prior to spitting out the latest posts, just like he does:

<div>Latest Posts</div>
<div stuff>
<div stuff>
<script... javascript> several lines </script>
<ilayer...>
<layer...>

all your posts in div tags or similar

</ilayer...>
</layer...>
<script> move javascript </script>
<a onmouseover link>
<script and move javascript>
</script>
</div>
</div>
I would grab all that code and put it in my page and see what happens. Of course, I'd do this on a test page so as not to screw up the main page.

tome109109
10-02-2008, 03:52 PM
This is what ive got:<div class="links_top"><b>Latest Posts</b></div>
<div class="links_bg">
<div class="user_text">

<script type="text/javascript">

iens6=document.all||document.getElementById
ns4=document.layers

//specify speed of scroll (greater=faster)
var speed=7

if (iens6){
document.write('<a onmouseover="moveup()" onmouseout="clearTimeout(moveupvar)"><img src="images/post_top.gif" border="0" alt="Scroll Up" /></a>')
document.write('<div id="container" style="position:relative;width:100%;height:260px;border:0 px solid black;overflow:hidden;">')
document.write('<div id="content" style="position:absolute;width:100%; height: 754px; left:0;top:0;bottom:0;">')
}
</script>
<ilayer id="nscontainer" width="175" height="190" clip="0,0,150,160">
<layer id="nscontent" width="175" visibility="hidden">



<span class="smallfont">

<div style='padding-top: 1px; padding-bottom: 1px;'><font color='black'>
<script type="text/javascript" src="external.php?type=js"></script>
<script language="" type="text/javascript">
<!--
for (x = 0; x < 15; x++)
{
document.writeln(" &bull; <a href=\"showthread.php?t="+threads[x].threadid+"\"><b>"+threads
[x].title+"</b></a><br />By: "+threads[x].poster+" <br><br />");
}
//-->
</script>
</font></div>
</span>


</layer>
</ilayer>

<script language="JavaScript1.2">
if (iens6)
document.write('</div></div>')
</script>

<a onmouseover="movedown()" onmouseout="clearTimeout(movedownvar)"><img src="images/post_top1.gif" border="0" alt="Scroll Down" /></a>

<script language="JavaScript1.2">
if (iens6){
var crossobj=document.getElementById? document.getElementById("content") : document.all.content
var contentheight=crossobj.offsetHeight
}
else if (ns4){
var crossobj=document.nscontainer.document.nscontent
var contentheight=crossobj.clip.height
}

function movedown(){
if (iens6&&parseInt(crossobj.style.top)>=(contentheight*(-1)+100))
crossobj.style.top=parseInt(crossobj.style.top)-speed+"px"
else if (ns4&&crossobj.top>=(contentheight*(-1)+100))
crossobj.top-=speed
movedownvar=setTimeout("movedown()",20)
}

function moveup(){
if (iens6&&parseInt(crossobj.style.top)<=0)
crossobj.style.top=parseInt(crossobj.style.top)+sp eed+"px"
else if (ns4&&crossobj.top<=0)
crossobj.top+=speed
moveupvar=setTimeout("moveup()",20)

}

function getcontent_height(){
if (iens6)
contentheight=crossobj.offsetHeight
else if (ns4)
document.nscontainer.document.nscontent.visibility ="show"
}
window.onload=getcontent_height
</script>

</div>
</div>


<!//--- LATEST THREADS END -->

But it just comes up blank , any ideas?

Lynne
10-02-2008, 03:57 PM
Did you include the classes from the div tags - nscontainer and nscontent? And also any images that are needed? Also, do you get results - posts - without adding all that new javascript?

tome109109
10-02-2008, 04:01 PM
This is the full code:
<!--- LATEST THREADS -->

<div class="links_top"><b>Latest Posts</b></div>
<div class="links_bg">
<div class="user_text">

<script type="text/javascript">

iens6=document.all||document.getElementById
ns4=document.layers

//specify speed of scroll (greater=faster)
var speed=7

if (iens6){
document.write('<a onmouseover="moveup()" onmouseout="clearTimeout(moveupvar)"><img src="images/post_top.gif" border="0" alt="Scroll Up" /></a>')
document.write('<div id="container" style="position:relative;width:100%;height:260px;border:0 px solid black;overflow:hidden;">')
document.write('<div id="content" style="position:absolute;width:100%; height: 754px; left:0;top:0;bottom:0;">')
}
</script>
<ilayer id="nscontainer" width="175" height="190" clip="0,0,150,160">
<layer id="nscontent" width="175" visibility="hidden">



<span class="smallfont">

<div style='padding-top: 1px; padding-bottom: 1px;'><font color='black'>
<script type="text/javascript" src="external.php?type=js"></script>
<script language="" type="text/javascript">
<!--
for (x = 0; x < 15; x++)
{
document.writeln(" &bull; <a href=\"showthread.php?t="+threads[x].threadid+"\"><b>"+threads
[x].title+"</b></a><br />By: "+threads[x].poster+" <br><br />");
}
//-->
</script>
</font></div>
</span>


</layer>
</ilayer>

<script language="JavaScript1.2">
if (iens6)
document.write('</div></div>')
</script>

<a onmouseover="movedown()" onmouseout="clearTimeout(movedownvar)"><img src="images/post_top1.gif" border="0" alt="Scroll Down" /></a>

<script language="JavaScript1.2">
if (iens6){
var crossobj=document.getElementById? document.getElementById("content") : document.all.content
var contentheight=crossobj.offsetHeight
}
else if (ns4){
var crossobj=document.nscontainer.document.nscontent
var contentheight=crossobj.clip.height
}

function movedown(){
if (iens6&&parseInt(crossobj.style.top)>=(contentheight*(-1)+100))
crossobj.style.top=parseInt(crossobj.style.top)-speed+"px"
else if (ns4&&crossobj.top>=(contentheight*(-1)+100))
crossobj.top-=speed
movedownvar=setTimeout("movedown()",20)
}

function moveup(){
if (iens6&&parseInt(crossobj.style.top)<=0)
crossobj.style.top=parseInt(crossobj.style.top)+sp eed+"px"
else if (ns4&&crossobj.top<=0)
crossobj.top+=speed
moveupvar=setTimeout("moveup()",20)

}

function getcontent_height(){
if (iens6)
contentheight=crossobj.offsetHeight
else if (ns4)
document.nscontainer.document.nscontent.visibility ="show"
}
window.onload=getcontent_height
</script>

</div>
</div>


<!//--- LATEST THREADS END -->
And yeh i have uploaded all the images needed , ill try what u suggest now.

--------------- Added 1222969029 at 1222969029 ---------------

doesnt work... :(

--------------- Added 1222978390 at 1222978390 ---------------

Ok that code is working , but there must be some errors because it doesnt work when u post stuff , but only displays old ones. PLEASE HELP :(