TP-Docs
HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media

Recent

Welcome to TinyPortal. Please login or sign up.

Members
  • Total Members: 3,963
  • Latest: BiZaJe
Stats
  • Total Posts: 195,917
  • Total Topics: 21,308
  • Online today: 884
  • Online ever: 8,223 (February 19, 2025, 04:35:35 AM)
Users Online
  • Users: 0
  • Guests: 451
  • Total: 451

Text in block overwriting the block below?

Started by pheasant_plucker, June 12, 2010, 07:27:28 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

pheasant_plucker

I know it's probably not a tiny portal issue but I have a javascript/php file which displays the top ten classifieds adverts from the forum in the order of for sale, wanted, then an Advert. In normal text size view everything is fine but if the user zooms their text size the text over writes the block below. I have tried using z-index in the code but it has no effect. Is there something I can modify in the TP code to effect this?


$query1= "SELECT title, datelisted, ID_LISTING FROM YaBB_class_listing WHERE removed < 1 AND ID_CAT <> 15 AND ID_CAT <> 19 ORDER BY datelisted desc  LIMIT 0,11 ";
       $result1=mysql_query($query1);
   $query= "SELECT title, datelisted, ID_LISTING FROM YaBB_class_listing WHERE removed < 1 AND ID_CAT = 15 ORDER BY datelisted desc  LIMIT 0,11 ";
       $result=mysql_query($query);
echo'
<script type="text/javascript">

if (document.all || document.getElementById){ //if IE4 or NS6+
document.write(\'<style type="text/css">\n\');
document.write(\'.dyncontent{display: none; width: 180px; height: 500px; }\n\');
document.write(\'</style>\');
}
var curcontentindex=0;
var messages=new Array();

function getElementByClass(classname){
var inc=0;
var alltags=document.all? document.all : document.getElementsByTagName("*");
for (i=0; i<alltags.length; i++){
   if (alltags[i].className==classname)
     messages[inc++]=alltags[i];
}
}

function rotatecontent(){
//get current message index (to show it):
curcontentindex=(curcontentindex<messages.length-1)? curcontentindex+1 : 0;
//get previous message index (to hide it):
prevcontentindex=(curcontentindex==0)? messages.length-1 : curcontentindex-1;
messages[prevcontentindex].style.display="none"; //hide previous message
messages[curcontentindex].style.display="block"; //show current message
}

window.onload=function(){
if (document.all || document.getElementById){
   getElementByClass("dyncontent");
   setInterval("rotatecontent()", 10000);
}
}

</script>';

echo'
<div class="dyncontent" style="display: block; background: #E0E0E0"; z-index: -100; >
  <div align="center"><a href="http://www.rcmf.co.uk/4um/index.php?action=classifieds"><b>For Sale</b></a></div><hr>';
while ($row1=mysql_fetch_array($result1))
       {

       echo'<a href="/4um/index.php?action=classifieds;sa=view;id='. $row1['ID_LISTING'] .'">'. $row1['title'] .'</a><br/> ';

     $my_t1=getdate(date($row1['datelisted']));
echo '<small>','Listed '.("$my_t1[month] $my_t1[mday]").'<br/></small>';
      }
echo'</div>
<div class="dyncontent" style="background: #E0E0E0"; z-index: -100;>
<div align="center"><a href="http://www.rcmf.co.uk/4um/index.php?action=classifieds;cat=15"><b>Articles Wanted</b></a></div><hr>';
   while ($row=mysql_fetch_array($result))
       {

       echo'<a href="/4um/index.php?action=classifieds;sa=view;id='. $row['ID_LISTING'] .'">'. $row['title'] .'</a><br/> ';

     $my_t=getdate(date($row['datelisted']));
echo '<small>','Listed '.("$my_t[month] $my_t[mday]").'<br/>';
       echo'</small>';
       }
     echo'</div>
<div class="dyncontent" ><a href="http://www.hobbyking.com" target="_blank"><img src="http://www.rcmf.co.uk/4um/Themes/default/images/ImagesOnBoard/hobbyking-large.jpg" width="180" height="500" alt="Hobbyking.com" title="Hobbyking.com"/></a></div>
';


Gerry

IchBin

#1
There was a couple of missing quotes that I noticed. If this doesn't work, I'd go over the code and make sure every tag has it's match, and that all the attributes of the tags are using all the single/double quotes that they need.
$query1= "SELECT title, datelisted, ID_LISTING FROM YaBB_class_listing WHERE removed < 1 AND ID_CAT <> 15 AND ID_CAT <> 19 ORDER BY datelisted desc  LIMIT 0,11 ";
$result1=mysql_query($query1);
$query= "SELECT title, datelisted, ID_LISTING FROM YaBB_class_listing WHERE removed < 1 AND ID_CAT = 15 ORDER BY datelisted desc  LIMIT 0,11 ";
$result=mysql_query($query);
echo'
<script type="text/javascript">

if (document.all || document.getElementById){ //if IE4 or NS6+
document.write(\'<style type="text/css">\n\');
document.write(\'.dyncontent{display: none; width: 180px; height: 500px; }\n\');
document.write(\'</style>\');
}
var curcontentindex=0;
var messages=new Array();

function getElementByClass(classname){
var inc=0;
var alltags=document.all? document.all : document.getElementsByTagName("*");
for (i=0; i<alltags.length; i++){
if (alltags[i].className==classname)
messages[inc++]=alltags[i];
}
}

function rotatecontent(){
//get current message index (to show it):
curcontentindex=(curcontentindex<messages.length-1)? curcontentindex+1 : 0;
//get previous message index (to hide it):
prevcontentindex=(curcontentindex==0)? messages.length-1 : curcontentindex-1;
messages[prevcontentindex].style.display="none"; //hide previous message
messages[curcontentindex].style.display="block"; //show current message
}

window.onload=function(){
if (document.all || document.getElementById){
getElementByClass("dyncontent");
setInterval("rotatecontent()", 10000);
}
}

</script>';

echo'
<div class="dyncontent" style="display: block; background: #E0E0E0"; z-index: -100;">
<div align="center">
<a href="http://www.rcmf.co.uk/4um/index.php?action=classifieds"><b>For Sale</b></a>
</div><hr />';
while ($row1=mysql_fetch_array($result1)) {
echo'
<a href="/4um/index.php?action=classifieds;sa=view;id='. $row1['ID_LISTING'] .'">'. $row1['title'] .'</a><br/> ';

$my_t1=getdate(date($row1['datelisted']));
echo '<small>','Listed '.("$my_t1[month] $my_t1[mday]").'<br/></small>';
}
echo'
</div>
<div class="dyncontent" style="background: #E0E0E0"; z-index: -100;">
<div align="center">
<a href="http://www.rcmf.co.uk/4um/index.php?action=classifieds;cat=15"><b>Articles Wanted</b></a>
</div><hr />';
while ($row=mysql_fetch_array($result)) {
echo'
<a href="/4um/index.php?action=classifieds;sa=view;id='. $row['ID_LISTING'] .'">'. $row['title'] .'</a><br/> ';

$my_t=getdate(date($row['datelisted']));
echo '<small> Listed '.("$my_t[month] $my_t[mday]").'<br /></small>';
}
     echo'
</div>
<div class="dyncontent">
<a href="http://www.hobbyking.com" target="_blank">
<img src="http://www.rcmf.co.uk/4um/Themes/default/images/ImagesOnBoard/hobbyking-large.jpg" width="180" height="500" alt="Hobbyking.com" title="Hobbyking.com"/>
</a>
</div>';

pheasant_plucker

Thanks for the help but it's just the same. I'll go over it again but it appears as if when the divs show they float above the block rather than in it.

Gerry

IchBin

Try taking the z-index out and stuff. There's no need to have "display: block" on a div either.

pheasant_plucker

It will not work without the display:block. All the content is loaded in to the div and displayed in rotation. Funnily enough it works fine in v1.0 beta 3 on a test site I have so it could be a v0.9.8 thing!

Gerry

This website is proudly hosted on Crocweb Cloud Website Hosting.