News:

Wondering if this will always be free?  See why free is better.

Main Menu

Need to add banner code to Theme

Started by The Wizard, August 25, 2014, 10:31:30 AM

Previous topic - Next topic

The Wizard

Hello:

I am using SMF 2.0.8 and the Bright Forest theme - http://custom.simplemachines.org/themes/index.php?lemma=336

In the index.template.php I need to add my banner code after this line - // Custom banners and shoutboxes should be placed here, before the linktree.

Except in this theme this line does not exist. Does anyone know where I should add my banner code in this theme?

The Banner code I need to add in case you need to see -

// Monthly Banner code

global $sourcedir;

if (file_exists($sourcedir . '/banner/BannerRotation.php'))
{
require_once($sourcedir . '/banner/BannerRotation.php');
BannerRotation();
}



Thanks

Wiz





All Colours Sam

You can use $context['template_layers'] var to insert your banner on all themes:

Sources/Load.php:

After this:

$context['template_layers'] = array('html', 'body');

Add this:

if (file_exists($sourcedir . '/banner/BannerRotation.php'))
   {
         require_once($sourcedir . '/banner/BannerRotation.php');
         BannerRotation();
   }

array_splice($context['template_layers'], 2, 0, 'banner_rotation');

Of course this means BannerRotation() needs to follow SMF's template system, you need to create a new template file and put all your "view" code inside the function template_banner_rotation()  BannerRotation() needs to pass all the data to this template, preferable within a $context var.
Oh, wouldn't it be great if I *was* crazy? ...then the world would be okay
Suki

The Wizard

Hello Suki:

I am looking for something simple as the bright forest theme is a older theme. My graphic artist wanted to go with a square theme, and has chosen this one so I'm stuck with it. I am unfamiliar with this style of theme and so any help would be appreciated.

Wiz 

All Colours Sam

With the proposed change you don't actually need to bother with any template edits...

But if you want to follow that path, atach your index.template file here.
Oh, wouldn't it be great if I *was* crazy? ...then the world would be okay
Suki


All Colours Sam

This si the menu stuff:


echo '
</div>
', template_menu(), '
<div id="content">';


Just put your code below that part.
Oh, wouldn't it be great if I *was* crazy? ...then the world would be okay
Suki


Advertisement: