Code not parsing

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
Vegan
Forum Regular
Posts: 574
Joined: Fri Sep 05, 2008 3:34 pm
Location: Victoria, BC
Contact:

Code not parsing

Post by Vegan »

I wonder if I have made a mistake with Apache, I have some code to show an ad, but PHP is not parsing the PHP code to generate the ad.

Thoughts, I using Linux Server for the record.
Hardcore Games™ Legendary is the Only Way to Play™
My site is powered by LAMP
User avatar
daedalus__
DevNet Resident
Posts: 1925
Joined: Thu Feb 09, 2006 4:52 pm

Re: Code not parsing

Post by daedalus__ »

what's your config look like?

what distro?
User avatar
Vegan
Forum Regular
Posts: 574
Joined: Fri Sep 05, 2008 3:34 pm
Location: Victoria, BC
Contact:

Re: Code not parsing

Post by Vegan »

I have checked everything, the include works, so I am wondering what am I doing wrong?

For example:

Code: Select all

<?php include $_SERVER["DOCUMENT_ROOT"] . "/google.php"; ?>

And I see the code for Google Analytics fine, so my ad tool has some PHP code:

Code: Select all

 
// Tower Ads intended for display below the navigation block
 
$ads = array(
    // Microsoft has the best selection of advertisements
    array(
        'http://click.linksynergy.com/fs-bin/click?id=jaxflTaXP3Y&offerid=166833.10000242&subid=0&type=4',
        'Microsoft Store',
        'http://ad.linksynergy.com/fs-bin/show?id=jaxflTaXP3Y&bids=166833.10000242&subid=0&type=4&gridnum=9'
    ),
    array(
        'http://click.linksynergy.com/fs-bin/click?id=jaxflTaXP3Y&offerid=166833.10000292&subid=0&type=4',
        'Microsoft Store',
        'http://ad.linksynergy.com/fs-bin/show?id=jaxflTaXP3Y&bids=166833.10000292&subid=0&type=4&gridnum=9'
    )
);
 
$ad = $ads[array_rand($ads)];
echo "<a href='{$ad[0]}'><img alt='{$ad[1]}' src='{$ad[2]}'/></a><br />";
 

This simply comes up as included text (not the ad desired), thoughts?
Hardcore Games™ Legendary is the Only Way to Play™
My site is powered by LAMP
User avatar
manohoo
Forum Contributor
Posts: 201
Joined: Wed Dec 23, 2009 12:28 pm

Re: Code not parsing

Post by manohoo »

It sounds like the code you displayed is an .html file. Change the extension to .php and let me know what happens.

And don't forget to close your php code with the "?>" tag.
User avatar
daedalus__
DevNet Resident
Posts: 1925
Joined: Thu Feb 09, 2006 4:52 pm

Re: Code not parsing

Post by daedalus__ »

does it output the html tags and all that? are they being parsed? im confused >.<
Post Reply