1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Align in PhP?

Discussion in 'PHP' started by belgin fish, Jul 2, 2009.

  1. #1
    Hey, well on my arcade I'm looking to align the add code in the center, the thing is you set the add codes in the admin panel and then you just add the php code to display the add,

    Like this :

    <?php
        echo show_ad("location=top468x60");
       ?>
    PHP:
    How would i align that center? Using php, or any other way. Or would i have to add something before the adsense code while it's still html.
    SEMrush

    Thanks
     
    belgin fish, Jul 2, 2009 IP
    SEMrush
  2. newgenservices

    newgenservices Well-Known Member

    Messages:
    862
    Likes Received:
    21
    Best Answers:
    0
    Trophy Points:
    105
    Digital Goods:
    1
    #2
    You can try

    
    <?php
    echo '<center>'.show_ad("location=top468x60").'</center>';
    ?>
    
    Code (markup):
    Or to make your things even simpler, use html first and PHP inside the center tags.

    
    <center><?php echo show_ad("location=top468x60"); ?></center>
    
    Code (markup):
    Also if possible, try to optimize your show_ad function so you just provide top468x60 instead of providing location=top468x60 unless your situation demands it.
     
    newgenservices, Jul 2, 2009 IP
    Matthew Sayle likes this.
  3. belgin fish

    belgin fish Well-Known Member

    Messages:
    1,518
    Likes Received:
    62
    Best Answers:
    0
    Trophy Points:
    185
    Digital Goods:
    2
    #3
    Thanks a lot, i will try it out
     
    belgin fish, Jul 2, 2009 IP
  4. valendino

    valendino Banned

    Messages:
    65
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Can you paste mroe code so we can find what you want to align?
     
    valendino, Jul 2, 2009 IP
  5. amuthavalli

    amuthavalli Peon

    Messages:
    110
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    you may use this also

    <?php
    echo '<p align="center">'.show_ad("location=top468x60").'</p>';
    ?
    Code (markup):
     
    amuthavalli, Jul 3, 2009 IP
  6. CarlosR2004

    CarlosR2004 Peon

    Messages:
    2
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #6
    I finally found a great slider for my wordpress site but the code does not with an align feature and I would like to center this slider.

    here's the code for my header.php file. The question is now, how to center this. Any help will be appreciated. Thanks


    <?php

    if(is_front_page())

    {

    if(function_exists('wp_content_slider')) { wp_content_slider(); }
    }
    ?>
     
    CarlosR2004, Nov 7, 2012 IP