Forum Moderators: coopster

Message Too Old, No Replies

Add banner to all pages automatically

Is there any script or solution?

         

Noximus

4:44 pm on Oct 30, 2005 (gmt 0)

10+ Year Member



Dear Experts,
Has anyone got any tried & tested method of automaticaly adding a banner/Adsense advert to the header of every web pageof the same site?
I want to add banner to 1000s of pages automatically without having to edit the html of each and every page of my site. I mean the solution which are used by free hosting providers, like Freeservers, Tripod and others. Do you know anything about it? Please help me . In advance thank you.

skipfactor

4:59 pm on Oct 30, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Probably not what you're looking for but I use templates for AdSense.

Noximus

5:29 pm on Oct 30, 2005 (gmt 0)

10+ Year Member



But how do it netfirms.com or freeservers.com?
What software do they use?
There is definitely some solution, but what is it?

coopster

5:16 pm on Oct 31, 2005 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



If you were parsing every page via PHP you could automatically include a banner on every page by using PHP's auto_prepend_file [php.net] configuration directive to tell each and every page to run this particular file for every request.

AjiNIMC

6:42 pm on Oct 31, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



The best way to design your site is to have following files

1) header.tpl
2) page.tpl (this can differ from page to page)
3) footer.tpl

(this minimum architecture will allow you to have common header and footer, very similar to most of the cms systems).

This will ease your work of having banner on each page. You can try mambo for your cms.

Noximus

6:57 pm on Oct 31, 2005 (gmt 0)

10+ Year Member



coopster, AjiNIMC ,
Thank you for reply, but the problem is that the website is already ready and I don't know how to place ads on 1000s of pages without editing them manually.
Is there some script wich will enable all the pages to get in the header and footer some code for placing any ad?

coopster

7:14 pm on Oct 31, 2005 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



I suppose you could use the auto_prepend_file and auto_append_file directives to start output buffering and end output buffering accordingly. In the ob_start() [php.net] you could define a function so that when you do the ob_end_flush() [php.net] you could run a regular expression to find the <body> tag and replace it with the <body> tag followed by your ad. Just an idea. Perhaps somebody else can think of something else ...?

bsterz

7:53 pm on Oct 31, 2005 (gmt 0)

10+ Year Member



mod_layout would allow you to add div tags at the footer that would display a header in a div tag, but this would not "push down" any of the other html.

Bill

Noximus

6:52 pm on Nov 1, 2005 (gmt 0)

10+ Year Member



Thank you guys for your comments and time.