Page 1 of 1
***PHP Include Problem*****
Posted: Mon Oct 22, 2007 6:27 am
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
Posted: Mon Oct 22, 2007 7:36 am
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
Posted: Mon Oct 22, 2007 7:44 am
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.
Posted: Mon Oct 22, 2007 7:56 am
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
Posted: Mon Oct 22, 2007 10:24 am
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
Posted: Mon Oct 22, 2007 11:45 am
by aaronhall
Place that tag in the file into which you want "thefile.js" included. Remove the <script> tags from thefile.js.
Posted: Mon Oct 22, 2007 12:14 pm
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
Posted: Mon Oct 22, 2007 12:29 pm
by aaronhall
Should work.. give it a try