Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Setting the Width in php
Old 10-10-2008, 05:46 AM Setting the Width in php
Novice Talker

Posts: 9
Trades: 0
<code>

function show_ads($number_of_ads=1){

global $ad;

if($number_of_ads > count($ad)){
$number_of_ads = count($ad);
}

list($usec, $sec) = explode(' ', microtime());
srand((float) $sec + ((float) $usec * 100000));

$rand_keys = array_rand($ad, $number_of_ads);

$show_ads = "<table><tr>";
for($i=0; $i<$number_of_ads; $i++){
$e = $ad[$rand_keys[$i]];
$show_ads .= "
<td width='300px'>
<a href='{$e[3]}' style='font:13px Arial; font-weight:bold; color: #0000ff'>{$e[0] }</a><br>
</td>

";
}
$show_ads .= "</tr></table>";

echo $show_ads;
}

?>

</code>

I am trying to set up an add rotator which is called from within a div in each page. The div's width is set to 300px but it seems that the ads shown dont follow the width rule and just get out of line.

In the code there's a <td width='300px'> which it does not seem to follow either.

I am new to php and don;t know what to do to be honest.

Last edited by Claudius; 10-10-2008 at 05:48 AM..
Claudius is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 10-10-2008, 07:47 AM Re: Setting the Width in php
tripy's Avatar
Do not try this at home!

Posts: 3,621
Name: Thierry
Location: I'm the uber Spaminator !
Trades: 0
the td width attribute is not the same than the css width directive.
you shoudl either write
Code:
<td width="300">
or
Code:
<td style="width:300px">
or give the td a css class that define the width.
__________________
Only a biker knows why a dog sticks his head out the window.
tripy is offline
Reply With Quote
View Public Profile Visit tripy's homepage!
 
Old 10-10-2008, 09:12 AM Re: Setting the Width in php
Novice Talker

Posts: 9
Trades: 0
It dosent work

It dosent obey the width tag, it just shows them all horizontally.
Claudius is offline
Reply With Quote
View Public Profile
 
Old 10-10-2008, 09:42 AM Re: Setting the Width in php
Novice Talker

Posts: 9
Trades: 0
Ahh no Worries I've sorted it out
Claudius is offline
Reply With Quote
View Public Profile
 
Old 10-10-2008, 11:48 AM Re: Setting the Width in php
RonnieTheDodger's Avatar
Extreme Talker

Posts: 232
Location: Central USA
Trades: 0
Let me guess on what you did here. I think you needed to set the Table width to 300px, and not the cell (TD).

Another thing you may consider is your cellpadding attribute for the Table, if other elements are too close to your ad.
__________________
Ronnie T. Dodger

[
Please login or register to view this content. Registration is FREE
] [
Please login or register to view this content. Registration is FREE
]
RonnieTheDodger is offline
Reply With Quote
View Public Profile Visit RonnieTheDodger's homepage!
 
Reply     « Reply to Setting the Width in php
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.57479 seconds with 12 queries