News:

Bored?  Looking to kill some time?  Want to chat with other SMF users?  Join us in IRC chat or Discord

Main Menu

ad on top

Started by Bigguy, May 14, 2005, 07:08:57 PM

Previous topic - Next topic

Bigguy

Now all I need to figure out is how to place an ad at the top of every page without stretching the header
I know you can insert an ad code but evertime I do it it stretches the page. I see this forum has done it nicely. If you look at the top of this page, thats what I want to do with my ad. But how ?(Lewis Media ad)

Bigguy

Sorry for the double post, I dont want to get in trouble here. But can no one help out a guy down on his luck  :D

MicroTechXP

Ok go to
QuoteCurrent Theme's Settings
in the admin menu. Then go to
QuoteModify the index template. (the main template)
WHich is at the top... Then add you ad code at the top of the page.

-MicroTechXP

Bigguy

Have you tried this ? Does it work

A.M.A

If you are after google's ads, there are some topics on how to use it. If it is a special add script/code then could you please post that code here and I'll try to make it work.
Really sorry .. real life is demanding my full attention .. will be back soon hopefully :)

MicroTechXP

Yes it works but not on the default theam. Give the ad code to A.M.A and he will try to figure it out...

Bigguy

ok this is the code I need for the ad to show up on all pages. The server I`m on decides what banner it shows. so I guess you could cal it a rotating banner. I have mods installed on my board to if that matters. I am running smf 1.0.3 forum with arcade,shop and faster parse code installed and the database has been updated. I dont know if you needed all that info buut there it is. Hope you have luck with this. Thanks in advance.

If you could also tell me HOW you got it to work that would be cool to. I have tried to put the code at the top of the "index.template.php" file with no success.

Quote<?php include("http://www.x10hosting.com/advert/quick_get.php?id=advanced") ?>

A.M.A

in index.template.php before:
// The logo and the three info boxes.
add your include like this:
include('/path/to/script/myscript.php');

more info can be found in Integrating the forum into your site...

Really sorry .. real life is demanding my full attention .. will be back soon hopefully :)

Bigguy

#8
So are you saying it would look like this ??

Quoteinclude('/path/to/script/myscript.php');<?php include("http://www.x10hosting.com/advert/quick_get.php?id=advanced") ?>


Or like this ??

Quoteinclude('<?php include("http://www.x10hosting.com/advert/quick_get.php?id=advanced") ?>');

A.M.A

no .. just use it as
include('/path/to/script/myscript.php');
Really sorry .. real life is demanding my full attention .. will be back soon hopefully :)

Bigguy

And were it says path/to/script/mysript.php what do I put. Nothing is stored on my account. there is no path to anything that is the entire script. It loads up according to what x10 tells it to load. So basically there is no path or the path is this   
Quote<?php include("http://www.x10hosting.com/advert/quick_get.php?id=advanced") ?>

or are you saying like this   include('http://www.x10hosting.com/advert/quick_get.php?id=advanced');

Maybe I`m not understanding.

Bigguy

Sorry for double posting. Is it more like this :

Quoteinclude('/path/to/script/myscript.php');
and then this
Quote<?php include("http://www.x10hosting.com/advert/quick_get.php?id=advanced") ?>
before
Quote// The logo and the three info boxes.
this

A.M.A

so you are saying your host ask you to put only <?php include("") ?>
With no script and it will be filled automatically .. do not know for sure if this will work for them! any how I've posted the correct use for using include in SMF theme. You may try using it with no arguments i.e. just only:
include('');
but do not use
<?php include(''?>
cause it will give you a template parse error.
Really sorry .. real life is demanding my full attention .. will be back soon hopefully :)

Bigguy

My host asked me to put this line
Quote<?php include("http://www.x10hosting.com/advert/quick_get.php?id=advanced") ?>
on my page so there rotating banners will show. This code works on almost every other forum software, but for some reason it doesnt want to work on smf. oh and I dont think It`s allowed to edit the code in anyway, they dont want ppl doing that.

P.S. I just tried the code the way you said, and it still gives a parse error

[Unknown]

That's not the line you can put in just anywhere in PHP.  If your host things that, they don't know what they are talking about.

Try adding:

';

include('http://www.x10hosting.com/advert/quick_get.php?id=advanced');

echo '


Or, if before this:

// The logo and the three info boxes.

Use:

include('http://www.x10hosting.com/advert/quick_get.php?id=advanced');

Not all forum software works the same way.  And if you have tried the code you posted and it has worked in all other softwares you've used, you haven't used that many.

-[Unknown]

Bigguy

Your right I haven`t used that many, with this ad code. I havent always been with this host. They are the only ones I have been with that tell you to insert there code yourself. as for other software I have tried a couple out there.

P.S. it works thank you very much.

Joseph

Jus to wrap it up - let me explain to you why that worked.....fundamentally the confusion comes from the fact that a php file can have HTML code in it, or PHP code in it - depending on the mode you're in.

If the file you were editing had mostly HTML content - then putting in

<?php include ('script.php'); ?>

would work....essentially that code says enter php processing mode with the "<?php" then include the script.php file, then exit php mode using "?>"

However, if the file you were working on was mostly one or two-line php code fragments, then just adding
include ('script.php'); would work. Because it's all php code, it doesn't need to be told to enter php mode (that happened at the top of the file) so you can just run the command.

What's a little different in this case, is that the file is most PHP, but it has long, multi-line commands, and you were trying to put something in the middle of that command.

Essentially, the template file has a really long command that says "show all of this stuff as a website" - if you stick that command right in the middle like you did originally, it will get confused.

So, unknown's code broke up the flow of the PHP to let your include statement work.

The '; told the PHP to stop showing stuff, then he had include('http://www.x10hosting.com/advert/quick_get.php?id=advanced'); to include your script, then he had echo ' to tell it to start showing stuff again.

It may seem a little confusing at first - but there's reason for it :)

So.....when your host asked you to just stick that line in - they were giving you an overly simplified solution, without really knowing what was running. They just assumed that your pages were all mostly HTML code - and that the line would work. If that were the case, then their solution is the right approach, it's a simple answer - however things are usually a bit more complicated :)

Cheers,

~ Joseph
Joseph Fung
Co-Founder & CEO, Kiite
Co-Founder TribeHR, Lewis Media, SMF

Bigguy

Thanks for explaining that to me, believe it or not I actually understood most of what you said. Thank you again. :)

Bigguy

OK guys now that the version has changed in smf, from 1.0.3 to 1.0.5 the ad code:

Quote<?php include("http://www.x10hosting.com/advert/quick_get.php?id=corporate") ?>

doesnt work, Is there a fix for this. TIA

[Unknown]

Your server's configuration settings were probably changed... when you say it doesn't work, what happens?

-[Unknown]

Advertisement: