Hello everyone. This will be hard to explain but ill give it a try: I have script developed from a friend and all I want is to get this line working into the output: <div style="display:inline-block;width:728px;height:90px;"> Code (markup): Let me explain how it works: When a user created an ad they get a code to place into thair websites and the code looks like this in the .php file: <textarea rows="1" class="span8"><div class="buysiteads-ad" data-type="<?php echo strtolower($o->creative_type);?>" data-size="<?php echo $o->creative_size;?>" data-id="<?php echo $o->ad_id;?>"></div></textarea> Code (markup): And here is what the users get as output: <div class="buysiteads-ad" data-type="image" data-size="728x90" data-id="41"></div> Code (markup): What I want: I want the code up to be there but before it should be added this one also: <div style="display:inline-block;width:728px;height:90px;"> Till here is not a problem I can do it <div style="display:inline-block; but the width:728px;width:728px;height:90px; I cant figure it out. If I add : <textarea rows="1" class="span8"><div style="display:inline-block;<?php echo $o->creative_size;?> Code (markup): Am getting only "728x90" and not 728px;height:90px; Can someone help on this please?
You can do the following: <textarea rows="1" class="span8"><div style="display: inline-block; <?php $dimensions = explode('x',$o->creative_size); echo 'width:'.$dimensions[0].'px;height:'.$dimensions[1].'px;'; ?> PHP:
Thank you for the help @PoPSiCLe but am getting this output: <div style="display: inline-block; width:px;height:px; Code (markup):
If you get that as output, there's something wrong with the output you're getting from the $o->creative_size - or something else isn't working as expected. Try to do a var_dump($dimensions) and maybe also a var_dump($o->creative_size) to see what they actually contain. But you say you get that as output, but you do not get any error-messages?
Hello. No, there is only a message if I dont close the div. But if i close it I get the result I have posted up.