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!

controlling loading of external feeds

Status
Not open for further replies.

mwpclark

Programmer
Mar 14, 2005
59
0
0
US
Hi

This may not be strictly a php question, but the site is primarily in php. I display jobs from simplyhired and items from ebay partner network. The php scripts that grab the 2 xml feeds are basically the same, using SimpleXML to interpret the raw xml and display the child elements.

The jobs are plain text and they load properly, in a column on the left side of the page. I am just starting with the ebay items, they have a small image plus text and load in a column on the right side of the page. When these ebay items load, the text is too wide. I have tried the images as float:left and align=left with the same result.

After the whole feed loads, the text jerks back to it's width limit of 180px. It is a bit disconcerting. I do not have the fastest connection, that may be part of the issue.

If it is possible to load the feed into a temp file first, or if there is some other php trick to control this process, I would prefer to wait the extra second and print to screen correctly formatted.

Here is how the display is formatted:

The parent page uses include to execute the xml-feed script.

parent div:
<div style="width:180px;font-family:arial;text-align:left;word-wrap:break-word;display:inline;">

item div:
<div style="font-size:11px;margin-top:4px;margin-bottom:4px;float:left;border-bottom:solid 1px #CCCCCC;padding-bottom:4px;text-align:left;">

item:
<a href="'.$viewItemURL.'" target="_blank"><img src="'.$galleryURL.'" alt="'.$title.'" style="float:left;padding-right:10px;border:0px;" /></a><a href="'.$viewItemURL.'" target="_blank"style="text-decoration:none;color:#0000CC;">'.$title.'</a>, Bid:&nbsp;'.$convertedCurrentPrice.', <span style="color:darkgreen;">'.$location.'</span> <a href="'.$viewItemURL.'" target="_blank" style="text-decoration:none;font-weight:bold;color:#0000CC;">&nbsp;&nbsp;&nbsp;&gt;&gt;view...</a>

The site is healthcarehiring.com, I am in the middle of deploying so it is not yet throughout the site.

Thanks for whatever suggestions there may be.

Mike
 
it looks like it is the loading of the image that is causing problems. not to mention the fact that you are using tables to control layout. naughty.

try wrapping the image in a div with a preset width. or even just give the img tag proper dimensions.

but this is not a php question at all. if this doesn't work and you need more help i suggest you post back in the html forum.
 
Thanks, you are probably right about the images being the issue. Unfortunately there is no image size data provided with the xml feed, they vary.

However while this is not the forum for it, I remain unconvinced that tables should be completely deprecated, they still do some things easily that divs won't do cross-browser or won't do at all.

There may yet be a php answer, to somehow pre-load the feed with images, read the image sizes if necessary and post the feed as a unit.
 
I *think* I answered my own question using the getimgsize function:

$imgsize = getimagesize($galleryURL);

echo '<a href="'.$viewItemURL.'" target="_blank"><img src="'.$galleryURL.'" '.$imgsize[3].' alt="'.$title.'" align="left" style="padding-right:10px;border:0px;" /></a><a href="'.$viewItemURL.'" target="_blank"style="text-decoration:none;color:#0000CC;">'.$title.'</a>, Bid:&nbsp;'.$convertedCurrentPrice.', <span style="color:darkgreen;">'.$location.'</span> <a href="'.$viewItemURL.'" target="_blank" style="text-decoration:none;font-weight:bold;color:#0000CC;">&nbsp;&nbsp;&nbsp;&gt;&gt;view...</a>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top