Need PHP help from a expert please.

Discussion in 'PHP' started by Zoti Media Group, May 27, 2014.

  1. #1
    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">&lt;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;?>"&gt;&lt;/div&gt;</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">&lt;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? :)
     
    Zoti Media Group, May 27, 2014 IP
  2. PoPSiCLe

    PoPSiCLe Illustrious Member

    Messages:
    4,623
    Likes Received:
    725
    Best Answers:
    152
    Trophy Points:
    470
    #2
    You can do the following:
    
    <textarea rows="1" class="span8">&lt;div style="display: inline-block; <?php $dimensions = explode('x',$o->creative_size); echo 'width:'.$dimensions[0].'px;height:'.$dimensions[1].'px;'; ?>
    
    PHP:
     
    PoPSiCLe, May 27, 2014 IP
    ThePHPMaster likes this.
  3. Zoti Media Group

    Zoti Media Group Notable Member

    Messages:
    1,599
    Likes Received:
    113
    Best Answers:
    2
    Trophy Points:
    265
    Digital Goods:
    2
    #3
    Thank you for the help @PoPSiCLe but am getting this output:
    <div style="display: inline-block; width:px;height:px;
    Code (markup):
     
    Zoti Media Group, May 27, 2014 IP
  4. Zoti Media Group

    Zoti Media Group Notable Member

    Messages:
    1,599
    Likes Received:
    113
    Best Answers:
    2
    Trophy Points:
    265
    Digital Goods:
    2
    #4
    I have also tried to close the div "&lt;/div&gt;" and still nothing.
     
    Zoti Media Group, May 27, 2014 IP
  5. PoPSiCLe

    PoPSiCLe Illustrious Member

    Messages:
    4,623
    Likes Received:
    725
    Best Answers:
    152
    Trophy Points:
    470
    #5
    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?
     
    PoPSiCLe, May 27, 2014 IP
  6. Zoti Media Group

    Zoti Media Group Notable Member

    Messages:
    1,599
    Likes Received:
    113
    Best Answers:
    2
    Trophy Points:
    265
    Digital Goods:
    2
    #6
    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.
     
    Zoti Media Group, May 28, 2014 IP
  7. Code Developer

    Code Developer Active Member

    Messages:
    48
    Likes Received:
    2
    Best Answers:
    2
    Trophy Points:
    58
    #7
    Hi,can you try below code & post the output here.

    print_r($o->creative_size);
     
    Code Developer, May 28, 2014 IP