Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

CSS background-image problem in IE

Status
Not open for further replies.

pajon

Programmer
Sep 27, 2001
8
US
I swear I'm not making this up, it's the weirdest thing I've ever seen.

I'm writing a Twitter module for Zencart, and basically using an image to 'skin' it with. I've got one div to show the 'skin' image, and another nested div offset to show the feed generated and formatted by the PHP.

Of course, everything works great in FF. However, in IE, I can't get the preferred image to show up in the div. Here's the kicker, though... if I play with the CSS and change the background-image: url() to a different, older image, they show up fine, in both IE and FF. In fact, there doesn't seem to be any ryhme or reason as far as differentiating, other than the images that DO show up weren't created today. Any new image I create WON'T work, but I can plug darn near any OLD image in and it shows up fine in both FF and IE.

I've tried gif's, png's, jpg's, different widths, different heights, different resolutions...

I thought it might be something to do with my setup, but I've duplicated it on another PC with different image tools.

I also am running a local version of SVN on Windows, so I thought that might have something to do with it, but I've checked the whole thing in and out and refreshed the depository, still the same results.

If anyone has ANY ideas, I'll look at them! This has been driving me crazy for two days!!!

I'll post my code, but I doubt the coding is the issue....

//twitter.php
<div class="twitterBox">
<div class="twitterFeed">
<dl>
<?php

//User Variables
$rssURL = " $ttlDisplay = 5;


//End User Variables

$insideitem = false;
$tag = "";
$description = "";
$link = "";
$pubdate = "";

$ttlDisplayed =0;

function startElement($parser, $name, $attrs) {
global $insideitem, $tag, $description, $link, $pubdate;
if ($insideitem) {
$tag = $name;
} elseif ($name == "ITEM") {
$insideitem = true;
}
}

function endElement($parser, $name) {
global $insideitem, $tag, $title, $description, $link, $pubdate, $ttlDisplay, $ttlDisplayed;
if ($name == "ITEM") {
if($ttlDisplayed < $ttlDisplay){
echo '<div class="tweetDateline">Tweeted: ' . $pubdate . '</div>';
echo '<div class="tweetItem">' . $description . "</div><br />";
$description = "";
$link = "";
$insideitem = false;
$pubdate="";
$ttlDisplayed++;
}
}
}

function characterData($parser, $data) {
global $insideitem, $tag, $title, $description, $link, $pubdate;
if ($insideitem) {
switch ($tag) {
case "DESCRIPTION":
$data = formatDescription($data);
$description .= $data;
break;
case "LINK":
$link .= $data;
break;
case "PUBDATE":
$pubdate .= $data;
$post= strtotime($pubdate);
$pubdate = date('m/d/Y',$post);
break;
}
}
}


function formatDescription($value){
//The Twitter XML description starts with the username and a colon, we want to strip that off
$intColon = strpos($value,":");
$newDescription = substr($value,$intColon + 2,strlen($value));
return $newDescription;
}

$xml_parser = xml_parser_create();
xml_set_element_handler($xml_parser, "startElement", "endElement");
xml_set_character_data_handler($xml_parser, "characterData");
$fp = fopen($rssURL,"r")
or die("Error reading RSS data.");
while ($data = fread($fp, 4096))
xml_parse($xml_parser, $data, feof($fp))
or die(sprintf("XML error: %s at line %d",
xml_error_string(xml_get_error_code($xml_parser)),
xml_get_current_line_number($xml_parser)));
fclose($fp);
xml_parser_free($xml_parser);

?>
</dl>

</div>
</div>


relavant css...

<style type="text/css">
/*twitter css*/

.twitterBox{
display: block;
width: 150px;
height: 450px;
position: relative;
background-color: fuchsia;
background-image: url(images/new2.gif);
background-repeat: no-repeat;
background-position: top;
}

.twitterFeed{
position:absolute;
top:40px;
left: 1.5px;
background-color: #ffffff;
font-size: smaller;
width: 143px;
height:380px;
overflow: auto;
padding-left: .5em;

}

.tweetDateLine{
text-decoration: underline;
font-family: sans-serif;
font-size: smaller;
}

.tweetItem{
font-family: sans-serif;
}

</style>
 
Posting the php code doesn't help us much, we'd need to see the html code that it generates. Does that code, and the CSS, validate? Which version(s) of IE? Can IE render the new images if you put them in an <img> tag?

Could it be a caching issue - try pressing ctrl-F5 to force a full refresh.

-- Chris Hunt
Webmaster & Tragedian
Extra Connections Ltd
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top