***PHP Include Problem*****

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
Illuminary
Forum Newbie
Posts: 4
Joined: Mon Oct 22, 2007 6:19 am

***PHP Include Problem*****

Post by Illuminary »

Everah | Please use the proper bbCode tags when posting code in the forums.

Hey guys I am having a problem with some php includes...

I am using this code here in my source:

Code: Select all

<?php include("http://www.xxxxxxxxxxxxxx.com/phpincludes/colonaa.php"); ?>
And then on my website when it pastes the code it shows like this:

Code: Select all

 <script type="text/javascript">
                  <!--
auctionads_ad_client = "xxxxxxxxxxxxxxxxxx";auctionads_ad_campaign = "xxxxxxxxxxxxxxxxxxxxxxxxxxx";auctionads_ad_width = "401";auctionads_ad_height = "159";auctionads_ad_kw =  "colon";auctionads_new_ad = "Horizontal";auctionads_new_ad_color = "blue";auctionads_new_ad_num = "2";-->
                </script>
                <script type="text/javascript" src="http://ads.auctionads.com/pagead/show_ads.js">
                </script>
And then my auction ads are not showing because when the php inlcude pastes it pastes all messy like that and my ads will not show...

Now, it was working fine before but now all of a sudden it is doing this???

Does anyone know whats the problem here?

Steve
Last edited by Illuminary on Mon Oct 22, 2007 10:36 am, edited 1 time in total.
User avatar
aaronhall
DevNet Resident
Posts: 1040
Joined: Tue Aug 13, 2002 5:10 pm
Location: Back in Phoenix, missing the microbrews
Contact:

Post by aaronhall »

The javascript looks valid.. that's probably not your problem. Check for JS errors from your browser if you're convinced it's a js issue
Illuminary
Forum Newbie
Posts: 4
Joined: Mon Oct 22, 2007 6:19 am

Post by Illuminary »

Everah | Please use the proper bbCode tags when posting code in the forums.
It is not showing though... I have other java on that page and it is showing see this is how it is supposed to look like:

Code: Select all

<script type="text/javascript"><!--
auctionads_ad_client = "xxxxxxxxxxxxxxxxxxxx";
auctionads_ad_campaign = "xxxxxxxxxxxxxxxxxxx";
auctionads_ad_width = "401";
auctionads_ad_height = "159";
auctionads_ad_kw =  "xxxxxxx";
auctionads_new_ad = "Horizontal";
auctionads_new_ad_color = "blue";
auctionads_new_ad_num = "2";
--></script>
<script type="text/javascript" src="http://ads.auctionads.com/pagead/show_ads.js">
</script>
And this is what it looks like on the code of my page that the php include is on:

Code: Select all

 <script type="text/javascript">
<!--
auctionads_ad_client = "xxxxxxxxxxxxxxxxxx";auctionads_ad_campaign = "xxxxxxxxxxxxxxxxxxxxxxxxxxx";auctionads_ad_width = "401";auctionads_ad_height = "159";auctionads_ad_kw = "xxxxx";auctionads_new_ad = "Horizontal";auctionads_new_ad_color = "blue";auctionads_new_ad_num = "2";-->
</script>
<script type="text/javascript" src="http://ads.auctionads.com/pagead/show_ads.js">
</script>
This one right above doe snot work...

Now you see what I mean now?

Steve
Everah | Please use the proper bbCode tags when posting code in the forums.
User avatar
aaronhall
DevNet Resident
Posts: 1040
Joined: Tue Aug 13, 2002 5:10 pm
Location: Back in Phoenix, missing the microbrews
Contact:

Post by aaronhall »

I understand what you mean, but both appear to be syntactically valid. Check for javascript errors on the latter.

PHP includes don't discard whitespace, so this shouldn't be a problem with the include function. You might be better off including the file with the script tag

<script type="text/javascript" src="thefile.js"></script>

If you do this, make sure to remove any script tags from the file being included
Illuminary
Forum Newbie
Posts: 4
Joined: Mon Oct 22, 2007 6:19 am

Post by Illuminary »

aaronhall wrote:I understand what you mean, but both appear to be syntactically valid. Check for javascript errors on the latter.

PHP includes don't discard whitespace, so this shouldn't be a problem with the include function. You might be better off including the file with the script tag

<script type="text/javascript" src="thefile.js"></script>

If you do this, make sure to remove any script tags from the file being included
Ok, so all I do is add <script type="text/javascript" src="thefile.js"></script> to my php file that the include is on? Heres a question... do I put that in the head or body?

Also I am not 100% sure in what you mean when you say " make sure to remove any script tags from the file being included"... can you please elaborate more on this?

Cheers!

Steve
User avatar
aaronhall
DevNet Resident
Posts: 1040
Joined: Tue Aug 13, 2002 5:10 pm
Location: Back in Phoenix, missing the microbrews
Contact:

Post by aaronhall »

Place that tag in the file into which you want "thefile.js" included. Remove the <script> tags from thefile.js.
Illuminary
Forum Newbie
Posts: 4
Joined: Mon Oct 22, 2007 6:19 am

Post by Illuminary »

Cool

Hey could I make it so the source is a file somewhere else.... like on another domain... src="http://www.mylocation.com/thefile.js" and also just to confirm I would then put <script type="text/javascript" src="http://www.mylocation.com/thefile.js"></script> in the body if my code where I want my ad to show, correct?

Steve
User avatar
aaronhall
DevNet Resident
Posts: 1040
Joined: Tue Aug 13, 2002 5:10 pm
Location: Back in Phoenix, missing the microbrews
Contact:

Post by aaronhall »

Should work.. give it a try
Post Reply