Why does my banner not appear?

PHP is not something I use very much, so I have lttle experience, however I thought I had done everything correctly

http://www.c5d.co.uk/clubrecordtwo.php is the web page.

I have used this in the HTML

                        <!-- BEGIN menu.php INCLUDE -->
<?php include $_SERVER["DOCUMENT_ROOT"] . "/includes/bannerstwo.php"; ?>
<!-- END menu.php INCLUDE -->
   <!-- BEGIN menu.php INCLUDE -->
<?php include $_SERVER["DOCUMENT_ROOT"] . "/includes/footertwo.php"; ?>
<!-- END menu.php INCLUDE -->

The footer is called correctly, but the bannerstwo does not appear. Can anyone give me a clue?

It appears that things are including. All the pairs of comments(<!-- BEGIN menu.php INCLUDE -->) have code inbetween them.
It is a little confusing, because the comments are all the same, saying menu.php instead of what is actually being included. That won’t fix it, but may make troubleshooting easier, if the comments say something useful.

I really don’t know what you are trying to tell me, as all the php scripts I have begin that way. And surely the divs can’t affect this when the php item is closed?

Change the commenting to:-

<!-- BEGIN bannerstwo.php INCLUDE -->
<?php include $_SERVER["DOCUMENT_ROOT"] . "/includes/bannerstwo.php"; ?>
<!-- END bannerstwo.php INCLUDE -->

So we know which block of code is coming from the include.

If the include failed to load, there would be a pair of comments with no block of code between them, I see no such pair.

1 Like

I have done that and the banners show in the HTML if you look at the source, but they don’t show.

so the URLs may be wrong?

I see the banners in both the source and on the page. :confused:

I don’t understand what you mean.

If the URLs were incorrect, surely the details wouldn’t show

                        <!-- BEGIN bannerstwo.php INCLUDE -->
   <ul class="opendays">
						   <li><p><a href="http://www.brsgolf.com/ashtonunderlyne/playing_schedule.php"><img class="ad125" src="http://www.c5d.co.uk/whatson.png" alt="What's On"/></a></p></li>
                           <li><p><a href="http://www.howdidido.co.uk" target="_blank"><img class="ad125" src="http://www.c5d.co.uk/howdidido.jpg" alt="How Did I Do"></a></p></li>
                            <li><p><a href="http://www.brsgolf.com/ashtonunderlyne/opens_home.php" target="_blank"><img class="ad125" src="http://www.c5d.co.uk/brsgolf.jpg" alt="Book An Open" /></a></p></li>
                            <li><p><a href="http://www.c5d.co.uk/teetimefour.php"><img class="ad125" src="http://www.c5d.co.uk/tee-time.png" alt="book a tee"/></a></p></li>
                            <li><p><a href="http://www.c5d.co.uk/hurstweatherfour.php"><img class="ad125" src="http://www.c5d.co.uk/hurstweather.jpg" alt="Weather Widget"></a></p></li>
                            <li><p><a href="http://www.c5d.co.uk/teetimefour.php"></a></p></li>
							<li><p><a href="http://www.europeantour.com" target="_blank"><img class="ad125" src="http://www.c5d.co.uk/matt.png" alt="Follow Matt Nixon on Tour"></a></p></li>
							<li><p><a href="http://www.odgl.org.uk" target="_blank"><img class="ad125" src="http://www.c5d.co.uk/odgl.png" alt="Oldham Golf League"></a></p></li>
						    <li><p><a href="http://www.mdga.org.uk" target="_blank"><img class="ad125" src="http://www.c5d.co.uk/mdga.png" alt="Manchester & Dist Golf Alliance"></a></p></li>
							<li><p><a href="http://www.llcga.org" target="_blank"><img class="ad125" src="http://www.c5d.co.uk/llgca.png" alt="Lancashire Ladies"></a></p></li>
							<li><p><a href="http://www.randa.org" target="_blank"><img class="ad125" src="http://www.c5d.co.uk/randa.png" alt="R & A"></a></p></li>
							<li><p><a href="http://www.europeantour.com" target="_blank"><img class="ad125" src="http://www.c5d.co.uk/etour.png" alt="The European Tour"></a></p></li>
							<li><p><a href="http://www.facebook.com/home.php?sk=group_152294981498083&amp;ap=1" target="_blank"><img class="ad125" src="http://www.c5d.co.uk/facebook.png" alt="Facebook"></a></p></li>
							<li><p><a href="http://www.c5d.co.uk/notwitterfour.php"><img class="ad125" src="http://www.c5d.co.uk/twitter.png" alt="Follow Us"></a></p></li>
<!-- END bannerstwo.php INCLUDE -->

Isn’t it odd because they don’t show on mine.

I guess it’s time to clean out the cache and start again.

Well they still don’t show on Chrome which is my default, but they do on Firefox and Edge so I guess you have solved it.

Thank you very much

I have sussed it. Google Ad Block Grrr

1 Like

Just checked in Chrome and I see it there.
Do you have any custom setting in Chrome or ad blocker?
At least I don’t think there is any problem with your includes, it must be something with your browser.

We crossed ! Ad blocker

ha been there done that. Even worse i had an ad blocker on my parents home machine which is linux so i was really stumped for a while as both windows and linux wouldn’t show but other machines would. My fault for using an ad blocker. On the flip side though you now know what happens when there is an ad blocker running so you could look to code something to show instead.

I found that simply having a div called ‘adverts’ was the problem so perhaps renaming sections would get around the ad blocker.

On the subject of commenting code i personally use the php comments rather than html if i am doing something with php.

<?php //this is a comment on one line /* or you can block a section out on two lines with these before doing whatever php you are doing*/ $something = $somethingelse; ?>
That way only i see the comments as they are not parsed to the final output. Using <!--Comment --> will show in the final markup and be visible to anyone looking at the source code of your pages and the less people that know you have a file called ‘bannerstwo.php’ (etc) the better. just a thought.

1 Like

Thanks for the consolation!

At least I could check it with Firefox and IE. A quick google and the answer came up

During developement, the idea is to make us helper-bees aware of what is being imported from a php file and what is local HTML. The comment marks can be removed when the page goes live.

1 Like

Yes, in this case the comments were useful in identifying the “problem” code.

1 Like

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.