TinyPortal

Development => Support => Topic started by: pheasant_plucker on June 12, 2010, 07:27:28 AM

Title: Text in block overwriting the block below?
Post by: pheasant_plucker on June 12, 2010, 07:27:28 AM
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
Title: Re: Text in block overwriting the block below?
Post by: IchBin on June 12, 2010, 10:30:42 PM
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>';
Title: Re: Text in block overwriting the block below?
Post by: pheasant_plucker on June 13, 2010, 07:36:00 AM
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
Title: Re: Text in block overwriting the block below?
Post by: IchBin on June 13, 2010, 08:29:18 PM
Try taking the z-index out and stuff. There's no need to have "display: block" on a div either.
Title: Re: Text in block overwriting the block below?
Post by: pheasant_plucker on June 14, 2010, 05:22:40 PM
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