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.

Code to make five ads appear

Discussion in 'Co-op Advertising Network' started by giorgioarmani, Oct 22, 2004.

  1. #1
    How do I get five text link ads to appear nicely one after the other with a comma or a "|" between each one?

    I currently am using:

    <?php
    	ini_set ("include_path", ini_get ("include_path") . ':../:../../:../../../:../../../../');
    	include ('ad_network.php');
    	include ('ad_network.php');
    	include ('ad_network.php');
    	include ('ad_network.php');
    	include ('ad_network.php');
    	echo $ad_network[0];,
    	echo $ad_network[1];,
    	echo $ad_network[2];,
    	echo $ad_network[3];,
    	echo $ad_network[4];,
    	echo $ad_network[5];,
    ?>
    PHP:
    But this is giving me an error...
     
    giorgioarmani, Oct 22, 2004 IP
  2. T0PS3O

    T0PS3O Feel Good PLC

    Messages:
    13,219
    Likes Received:
    777
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Seems to me like you need to alternate each include with the echo. Now you just overrule each include.
     
    T0PS3O, Oct 22, 2004 IP
  3. giorgioarmani

    giorgioarmani Well-Known Member

    Messages:
    2,633
    Likes Received:
    40
    Best Answers:
    0
    Trophy Points:
    160
    #3
    Thnx for the speedy response!

    What I am actually trying to achieve is:

    LINK1, LINK2, LINK3, LINK4, LINK5 or LINK1 | LINK2 | LINK3 | LINK4 | LINK5
    so my question is where would I add the ", " or the " | " to the php? The way its done now gives an error....
     
    giorgioarmani, Oct 22, 2004 IP
  4. SEbasic

    SEbasic Peon

    Messages:
    6,317
    Likes Received:
    318
    Best Answers:
    0
    Trophy Points:
    0
    #4
    I've had that problem too - I couldn't work it out.
     
    SEbasic, Oct 22, 2004 IP
  5. T0PS3O

    T0PS3O Feel Good PLC

    Messages:
    13,219
    Likes Received:
    777
    Best Answers:
    0
    Trophy Points:
    0
    #5
    What's the error?

    Your parsing is wrong.

    echo $something;,

    The comma violates php coding laws.

    It should be echo ' Sponsors: '.$ad_network[0].', '.$ad_network[1].' and keep writing here '.$ad_network[2].' end.'; etc.

    You can't have anything after the ;
     
    T0PS3O, Oct 22, 2004 IP
  6. giorgioarmani

    giorgioarmani Well-Known Member

    Messages:
    2,633
    Likes Received:
    40
    Best Answers:
    0
    Trophy Points:
    160
    #6
    Parse error: parse error, unexpected ',' in /home/absolute/public_html/hidden/footer.inc on line 74
     
    giorgioarmani, Oct 22, 2004 IP
  7. SEbasic

    SEbasic Peon

    Messages:
    6,317
    Likes Received:
    318
    Best Answers:
    0
    Trophy Points:
    0
    #7
    Well, not quite right (I don't think)...

    <?php
        ini_set ("include_path", ini_get ("include_path") . ':../:../../:../../../:../../../../');
        include ('ad_network.php');
        include ('ad_network.php');
        include ('ad_network.php');
        include ('ad_network.php');
        include ('ad_network.php');
        echo $ad_network[0];
        echo $ad_network[1];
        echo $ad_network[2];
        echo $ad_network[3];
        echo $ad_network[4];
    ?>
    
    Code (markup):
    There was an extra echo in there...

    But I couldn't find out where to place the | formatting either, so in the ad_network.php file, I just added a space to this line

    		$ad_network[] = $ad . '<!-- an-hl --> ';
    
    Code (markup):
    The space is next to the -->

    I couldn't think of another way to do it...
     
    SEbasic, Oct 22, 2004 IP
  8. T0PS3O

    T0PS3O Feel Good PLC

    Messages:
    13,219
    Likes Received:
    777
    Best Answers:
    0
    Trophy Points:
    0
    #8
    <?php 
        ini_set ("include_path", ini_get ("include_path") . ':../:../../:../../../:../../../../'); 
        include ('ad_network.php'); 
        include ('ad_network.php'); 
        include ('ad_network.php'); 
        include ('ad_network.php'); 
        include ('ad_network.php'); 
        echo ''.$ad_network[0].', '.$ad_network[1].', '.$ad_network[0].', '.$ad_network[2].'';
    ?> 
    PHP:
    But I don't participate in this network. Your PHP is fundamentally wrong, that's exactly why you get the unexpected parsing error. I do believe, from a logical point of view that the including 5 times the same file like that doesn't make sense. but at least this will fix the error.

    Check by confirmaing that line 74 is the first echo statement.
     
    T0PS3O, Oct 22, 2004 IP
  9. giorgioarmani

    giorgioarmani Well-Known Member

    Messages:
    2,633
    Likes Received:
    40
    Best Answers:
    0
    Trophy Points:
    160
    #9
    Ok so it appears to be solved now

    Added this:
    $ad_network[] = $ad . '<!-- an-hl --> | ';
    PHP:
    to the actual ad_network.php file as SEbasic suggest gives the LINK1 | LINK2 formatting I wanted! Thank you!


    And to T0PS3O I did have it like that before but thought it was giving me the error because I also added the " | " there too... Now its all good by putting the formatting in the ad_network file instead! Thanks!

    Cheers folks! :)
     
    giorgioarmani, Oct 22, 2004 IP
  10. l0cke

    l0cke Active Member

    Messages:
    178
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    73
    #10
    I would recommend not modifing the ad_network.php file. You will have to modify it every time Shawn releases a new one (Not saying he is going to but it could happen). See this post: http://forums.digitalpoint.com/showpost.php?p=37949&postcount=38, it should help you out. You can replace echo $ad_network . ' '; with echo $ad_network . ' | '; or whatever.
     
    l0cke, Oct 22, 2004 IP
  11. giorgioarmani

    giorgioarmani Well-Known Member

    Messages:
    2,633
    Likes Received:
    40
    Best Answers:
    0
    Trophy Points:
    160
    #11
    Sounds good... Thanks!
     
    giorgioarmani, Oct 22, 2004 IP