Tokyoj

Topic: How to create a banner section

OK...this is an easy one...for some reason I just can't find WHERE to add my banner table.

I know how to use home.tpl to add a banner that shows up on the top page, right side, but on sub-pages the banners disappear. I'm trying to get the banners to show up on ALL pages or at least the pages I choose.

This isn't Adsense/Google Ad's...but banners. I'm going to use a banner management software to manage campaigns
I've tried
sidebar.tpl
home.tple
but I just can't seem to get the banners to display on other pages.
Is it as a simple as adding the table into ALL the pages individually?
Thanks...

---------------
Tokyoj
"You can't build a reputation on what you're going to do." (Henry Ford)
"Insanity is doing the same thing over and over, expecting different results." (Albert Einstein)

Chronos

Re: How to create a banner section

Depending on where you want to the banner it should be added to either the header.tpl for a top position or sidebar.tpl for a top-right / right position. Obviously the code should be outside any {if $CURRENT_PAGE != } tag or it'll only show on specific pages.

You can either use the {php} to fully implement it within the template itself (not the cleanest code though), or add the content through SMARTY within the index.php (since it's loaded on every page).

Member of Jobberbase Development Team - Implementation and Coding

Visit my Blog: ChronoScripts (JobberBase scripts, support and freelance)
JobBoards: Telefonisch Werk and Top Bijbaan

Tokyoj

Re: How to create a banner section

Thanks Chronos,
I've been trying sidebar.tpl because it handles the right side and where I want the banners to site, but even with the below code, the banners only appear on the top page.

{if $CURRENT_PAGE == ''}
<!-- #stats -->
<div id="stats">
<strong>{$translations.category.total_jobs} : {$jobs_count_all} </strong>
<br />
{foreach item=job from=$jobs_count_all_categs}
<a href="{$BASE_URL}jobs/{$job.categ_varname}/">{$job.categ_name}</a> : <strong>{$job.categ_count}</strong> <br />
    {/foreach}
</div>
{/if}

<img src="img/bannerNo1.jpg" />                 
<img src="img/bannerNo2.jpg" />                 
<img src="img/bannerNo3.jpg" />                 

Could you explain in a bit more detail how to insert the below banner table into the index.php? (my PHP is only basic)

<table>
<tr>
<td> <img src="img/bannerNo1.jpg" /> </td>
</tr>
</table>

Thank you.

---------------
Tokyoj
"You can't build a reputation on what you're going to do." (Henry Ford)
"Insanity is doing the same thing over and over, expecting different results." (Albert Einstein)

putypuruty

Re: How to create a banner section

Hi, TokyoJ!

The problem is that you forgot the file extension wink You should have <img src="img/bannerNo1.jpg" /> (or whatever extension the picture has).

Tokyoj

Re: How to create a banner section

Actually just forgot to type of in the thread here. They're in the code. ( added the extensions in the above post to be more accurate)

The banners show on the top page...they just don't appear on the other pages...

---------------
Tokyoj
"You can't build a reputation on what you're going to do." (Henry Ford)
"Insanity is doing the same thing over and over, expecting different results." (Albert Einstein)

links

Re: How to create a banner section

Hi,

Try using <img src="{$BASE_URL}img/bannerNo1.jpg" />   

It worked for me on localhost.

Good luck!

Chronos

Re: How to create a banner section

The solution that links offers should work, and turning it in a link should be easy. I'm a fan of splitting the code and design between the PHP and TPL files, so here's an easy solution to have random images displayed at one or all pages.

I'm not sure if you're going to use an existing banner management system or make a custom though (if people request this I can make something for the admin panel, I'm going to need it in the future anyway).

1. Add in sidebar.tpl or wherever you want the banner:

Code:
{if $banner_1}<span style='banner-style1'>{$banner_1}</span>{/if}

2. Open index.php for banner info (would be better if it's pulled from the database and manageable from the admin panel ofcourse):

Find:

Code:
    if(!isset($_SERVER['HTTP_REFERER'])) {
       $_SERVER['HTTP_REFERER'] = '';
    }

Add under:

Code:
// Random Banners Script

  $ammount = '6'; //The ammount of banners available (all should be set below)
  $randomize = Rand (1,$ammount); //Picks one randomly (all equal chance)

  switch($randomize)
  {
    case 1: $image = 'banner_1.gif'; $url = 'http://www.jobberbase.com/page-1'; $bannertext = 'Jobberbase Website'; break;
    case 2: $image = 'banner_2.gif'; $url = 'http://www.jobberbase.com/page-2'; $bannertext = 'Jobberbase Website'; break;
    case 3: $image = 'banner_3.gif'; $url = 'http://www.jobberbase.com/page-3'; $bannertext = 'Jobberbase Website'; break;
    case 4: $image = 'banner_4.gif'; $url = 'http://www.jobberbase.com/page-4'; $bannertext = 'Jobberbase Website'; break;
    case 5: $image = 'banner_5.gif'; $url = 'http://www.jobberbase.com/page-5'; $bannertext = 'Jobberbase Website'; break;
    case 6: $image = 'banner_6.gif'; $url = 'http://www.jobberbase.com/page-6'; $bannertext = 'Jobberbase Website'; break;
  }

  $banner_1 = '<a href="'.$url.'" title="'.$bannertext.'"><img src="'.BASE_URL.'img/banners/'.$image.'" alt="'.$bannertext.'" /></a>';
  $smarty->assign('banner_1', $banner_1);

// End Random Banners Script

You can adjust the CSS to add different styles to the <span>, like you should remove any mouse-over effect for links as it would be ugly with images. Note that I didn't test this code, let me know if it works or not.

Last edited by Chronos (2009-01-07 23:00:03)

Member of Jobberbase Development Team - Implementation and Coding

Visit my Blog: ChronoScripts (JobberBase scripts, support and freelance)
JobBoards: Telefonisch Werk and Top Bijbaan

Tokyoj

Re: How to create a banner section

links...that worked perfectly. Thank you.

Chronos...for banner management, I'm going to use http://www.openx.org/
It's opensource and seems to be able to do everything I want/need (rotation, campaigns, tracking, billing, etc...) + alpha. Just need to learn how to use it and this is a good chance.

---------------
Tokyoj
"You can't build a reputation on what you're going to do." (Henry Ford)
"Insanity is doing the same thing over and over, expecting different results." (Albert Einstein)

jermon

Re: How to create a banner section

Tokyoj how did the banner go?

I am too looking for a way to insert some banners or even google adsense on the right side sidebar.tpl? Really for now im looking at just doing adsense so would it apply the same way as what Chronos explained above?

Tokyoj

Re: How to create a banner section

this got put on hold for other tweaks and redesign issues. Can't really decide 'where' to put the banners until the designs are done....once it's done, I'll post what the finished stuff.

---------------
Tokyoj
"You can't build a reputation on what you're going to do." (Henry Ford)
"Insanity is doing the same thing over and over, expecting different results." (Albert Einstein)

nht48823

Re: How to create a banner section

How do I add an additional column in footer.tpl for my banner section? Now when I insert the Google code the banner is not aligned center even when I center is it seem more aligned right. When I align left the banner moves all the way to the left of the page. http://www.inerc.com/testing/

Tokyoj

Re: How to create a banner section

To answer your questions:
1. The CSS handles all the formating. For the footer attributes look around line 221 for
div.footer {

2. The footer is made up of <div> </div> sections...
    <div class="footer">
        <div id="footer-contents">
           
<div id="footer-col1">
    {$translations.footer.column_use}:<br />
    <a href="{$BASE_URL}post/" title="{$translations.footer.new_job_title}">{$translations.footer.new_job}</a><br />
    <a href="{$BASE_URL}{$articles.widgets.url}/" title="{$articles.widgets.page_title}">{$articles.widgets.title}</a><br />
    <a href="{$BASE_URL}rss/" title="{$translations.footer.rss_title}">{$translations.footer.rss}</a><br />
    </div>
</div>
Just follow the same format for as the other columns and see how things go.

---------------
Tokyoj
"You can't build a reputation on what you're going to do." (Henry Ford)
"Insanity is doing the same thing over and over, expecting different results." (Albert Einstein)

edreggi

Re: How to create a banner section

I am using OpenAds which is now called OpenX.  I prefer OpenAds because it is simple, easy interface and it doesn't require many things OpenX requires on your Server.

I highly recommend OpenAds.

shairyar

Re: How to create a banner section

great information smile