Active member
Joined
Jan 19, 2023
Messages
31
Credits
195
For some of my static websites, I was using the <? include("ad.php"); ?> code for including the advertising code from file ad.php on each page. I have noticed that the ads are not being displayed, this command is not working. Is there any alternative command which can be used to display advertising on every page without manually copy pasting the ad code. The webhosting company has not replied to my support ticket for more than 24 hours.
 
Royal member
Premium Member
Joined
Dec 19, 2022
Messages
1,299
Credits
1,295
Is ad.php in the same directory as the file you're trying to use the include statement in? Is *that* file included by something else?
 
Well-known member
Joined
Apr 29, 2023
Messages
63
Credits
94
It will most likely cause an error but you can also modify that to
<?php require_once('ad.php');?>
Then atleast you will know why its not loading. Its most likely a path issue, in other words php cant find the file, which is what @Arantor is eluding too. When you get the error just screenshot it then change the code back to what you have and attach it to your next reply.
 
Royal member
Premium Member
Joined
Dec 19, 2022
Messages
1,299
Credits
1,295
require_once throws an error while include throws a warning - the fact that there's no visible warning likely means the error won't be visible either, it'll just disappear to a broken layout with the error in whatever log it's been squirrelled away in.
 
Well-known member
Joined
Apr 29, 2023
Messages
63
Credits
94
Honestly, its been so long since ive used either (directly) that all I could remember without tracking it down is that require _* was the more severe and would have a better chance at displaying without the need for a config change. But youre right, if one doesnt show there is def a chance the other will not.
 
Royal member
Premium Member
Joined
Dec 19, 2022
Messages
1,299
Credits
1,295
I live in WordPress land professionally, we still do a lot of nonsense like that over there. I even had to write my own PSR-4 autoloader like some kind of savage!
 
Well-known member
Joined
Apr 29, 2023
Messages
63
Credits
94
Personally I have a very hard time getting motivated to write code when I know there is already code that will do the job better than the shiv I'm gonna write as this one off lol.

/edit
I think we just hi-jacked his support thread....
 
Top