Forum Moderators: martinibuster
I am a beginner in using CSS but if this would work it would sure save a lot of time.
Any CSS experts out there who could help me? I suspect others here would be interested as well.
It takes some work from the point of view of replacing the code in all the pages at once, but I have heard that there are some html editors that can do a quick lookup and replace.
SSI includes using PHP is easy as pie.
Thanks for the SSI solution. If I can't find a CSS solution I'll look into it. I already am using CSS though so was hoping I could just use that.
If anyone out there is a CSS pro let me know if it's impossible. Maybe I am dreaming.
I know some people love using PHP and this may force me to learn about it.
Your iframe is almost like a mini browser displaying the content of a totaly different page.
Maybee someone with a little more CSS knowledge will kill me right off by proving me wrong. lol
Mack.
SSI includes using PHP is easy as pie.
One of the best sites that I've found for learning about CSS is mezzoblue's css Zen Garden — Resource Guide.
Thanks everyone for your suggestions and help.
First, if you use htm or html pages you must parse them as php so that the php code can be executed. This is done by changing the MIME types in cpanel. If you use php pages then you can pretty much skip this.
Then you decide where you want the adsense banner and add a line of code as follows:
<?php include('adsense.txt');?>
Then just save your adsense code into the file called adsense.txt and you are ready to go. I think that using includes puts a bit of strain in the server and might slow down delivery a bit, but it is hardly noticeable. However, if you are already stretching the resources on your server is one thing to think about.
The fact I'm even asking this probably shows how clueless I am.
Another question, would adding a mime type extension make it possible to use htm extenders? Maybe I am way over my head here.
Would setting the AdSense script on something other than the HTML page would the Google AdSense bot be able to crawl the right page?
Lots of us do it like this with no problem. The actual page being served is the "master page" {trademark pending}, the includes become pieces of code.
I do not include the code only. I include a header {with the code as part of it}, a footer, and a side navigation bar. So far no problem... although sometimes, I would see the page hiccup for 1/2 a second before it continues to load, but that is sometimes right at where the adsense code starts. Therefore, I think it is probably Google's fault.
4eyes, Can you explain more how to do it with a java script?
When you get your adsense code it comes as two parts, one that resides in your page and one that is called remotely from Google.
You just cut and paste the first part into an external javascript page.
You end up with:
<script language="JavaScript" type="text/javascript" src="http://www.yourdomain.com/js/adsense.js">
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
With the external javascript file being saved in the folder "/js" as a file named 'adsense.js' and containing the following:
google_ad_client = "pub-************xxxxxx";
google_ad_width = 250;
google_ad_height = 250;
google_ad_format = "250x250_as";
google_color_link = "660099";
google_color_url = "000033";
google_color_bg = "FFFFFF";
google_color_text = "000033";
google_color_border = "FFFFFF";
Obviously, with your particular code rather than the above.
All the other solutions seem over complicated to me.
So I went back to just including the html in all the static files.
Using a server side include of the whole ad code(in any of the various ways) would be acceptable, but I'm not about to make every single page served from my servers have to be processed for SSI by the web service just to include some ad text.
It'd be different if they were already dynamic pages, but they're all static html right now, with very little server load.
Authors specify the style and location of generated content with the :before and :after pseudo-elements. As their names indicate, the :before and :after pseudo-elements specify the location of content before and after an element's document tree content. The 'content' property, in conjunction with these pseudo-elements, specifies what is inserted.For example, the following rule inserts the string "Note: " before the content of every P element whose "class" attribute has the value "note":
P.note:before { content: "Note: " }
Related:
[webmasterworld.com...]