Go Back   Web Server Hosting Forum by BODHost > Support > PHP Forum
 

Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old 03-07-09, 06:29
BOD Member
 
Join Date: Jan 2009
Posts: 102
Default PHP Coding help?

If I'm trying to find a way to code some ads that always display in the same column on every page of my site and can be changed by amending one page of code, would I be doing the right thing by coding for use in PHP or should I be using a .shtml???

I'm so confused by all this.
Reply With Quote
  #2 (permalink)  
Old 03-07-09, 10:28
BOD Member
 
Join Date: Jan 2009
Posts: 73
Default

you can use php to do this - its pretty easy to do, there are two stages to this, firstly make a .php file (I'll call it advert.php) inside this file you will need to place the code to display your advert. Then inside the pages at the point where you want the advert to appear, simply put the code
Code:
include "advert.php"
inside your php tags
You can find more info here PHP: include - Manual
Reply With Quote
  #3 (permalink)  
Old 03-07-09, 15:16
BOD Member
 
Join Date: Jan 2009
Posts: 98
Default

Using the include function would probably be the best way as the other person stated.

I've done it before and it works fine. So if you were adding Google Adsense, just place your Adsense code inside that ads.php file and it should work without any problems.

Alternatively, if your pages are static HTML, PHP functions obviously won't work and you'll have to use an iframe, however I'd avoid that plus I don't think most ad providers allow it. I'd only iframe ads that you put in there yourself such as banners to your other sites etc.
Reply With Quote
  #4 (permalink)  
Old 03-07-09, 15:36
BOD Member
 
Join Date: Mar 2009
Posts: 24
Default

You would have to rename the pages to be .php instead of .html so that the include works, otherwise it wouldn't work properly it wont affect the way that the pages display, it will only cause them to be processed by the php interpreter before being sent to the client's browser =)
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off
Forum Jump


All times are GMT -6. The time now is 23:37.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
Copyright © 1999-2012, BODHost Ltd. All rights reserved.