WebsiteBaker Logo
  • *
  • Templates
  • Help
  • Add-ons
  • Download
  • Home
*
Welcome, Guest. Please login or register.

Login with username, password and session length
 

News


WebsiteBaker 2.13.6 is now available!


Will it continue with WB? It goes on! | Geht es mit WB weiter? Es geht weiter!
https://forum.websitebaker.org/index.php/topic,32340.msg226702.html#msg226702


The forum email address board@websitebaker.org is working again
https://forum.websitebaker.org/index.php/topic,32358.0.html


R.I.P Dietmar (luisehahne) and thank you for all your valuable work for WB
https://forum.websitebaker.org/index.php/topic,32355.0.html


* Support WebsiteBaker

Your donations will help to:

  • Pay for our dedicated server
  • Pay for domain registration
  • and much more!

You can donate by clicking on the button below.


  • Home
  • Help
  • Search
  • Login
  • Register

  • WebsiteBaker Community Forum »
  • WebsiteBaker Support (2.8.x) »
  • Droplets & Snippets »
  • different banner on different pages
  • Print
Pages: [1]   Go Down

Author Topic: different banner on different pages  (Read 11408 times)

MicahK

  • Guest
different banner on different pages
« on: March 01, 2008, 01:27:59 AM »
How do I have a banner on say, Home, and a different banner on Contact Us?
Thanks,

Micah
Logged

Offline BerndJM

  • Posts: 1764
  • Gender: Male
Re: different banner on different pages
« Reply #1 on: March 01, 2008, 02:00:14 AM »
Hi,

have look at the "Randomimage" Snipplet you can find at the addons page.
In addition you can should perform a search here in the forum for "random image" and you'll find some interesting stuff about it

Regards Bernd
Logged
In theory, there is no difference between theory and practice. But, in practice, there is.

MicahK

  • Guest
Re: different banner on different pages
« Reply #2 on: March 01, 2008, 02:29:41 AM »
I thought about using the Random Image mod, but that will not work, as I need the banner to replace the main banner and not change, but only on certain pages.  I tried Sections, but could not get them to work... 
Logged

Offline marathoner

  • Posts: 495
Re: different banner on different pages
« Reply #3 on: March 01, 2008, 03:21:59 AM »
I think it depends on your objective. Is it to have a random image or is the objective to use a given banner for certain pages (i.e. the contact us page would always use the contact us banner). If it's the later (which it sounds like) then you have several options:

1) Learn how to use sections
2) Create different templates that are exactly the same except for the banner and then use that template for the appropriate page
3) Use a little PHP in your template so that if page_id=1 then use banner1, and if page_id=2 then use a different banner.
Logged

MicahK

  • Guest
Re: different banner on different pages
« Reply #4 on: March 01, 2008, 03:45:21 AM »
It is to have a given banner for a given page, you are correct.
I would prefer to use PHP, but I don't know it well enough.  Maybe I can find something I can use online.
The template idea would be a good bit more work, but I will try that.
Thanks!
Logged

Offline marathoner

  • Posts: 495
Re: different banner on different pages
« Reply #5 on: March 01, 2008, 03:54:26 AM »
It's pretty easy, just include a bit of PHP in your template index.php where the banner is displayed and then call the appropriate banner based on the page_id. You can have as many different page/banner combinations as you want.

For example, I use this approach to include some java script on my pages...but only for those pages that use the JS. Here's my snippet (you'll need to modify to suit your needs by using an <IMG> tag):
Code: [Select]
<?php if (($page_id==27)||($page_id==29)||($page_id==34)||($page_id==37))
 {echo 
"<script type=\"text/javascript\" src=\"/js/general.js\"></script>\n";}?>


You would change this to basically something like "if page_id=X then use image Y otherwise use image Z"
Logged

MicahK

  • Guest
Re: different banner on different pages
« Reply #6 on: March 01, 2008, 05:57:33 AM »
Pretty easy if you understand PHP...  :-D  Sadly, I am just starting.  I have just a little C# practice, and I think I know what I need, just cannot get it to work without errors.
I cannot get the if else to go... any suggestions, or should I take the question to a PHP forum?
Thanks!

Code: [Select]
<?php if (($page_id==4)||($page_id==7))
 {echo 
"<img=\"media/banner/testbanner.gif\" src=\"Banner\"></img>";} ......  ?>
Logged

Offline BerndJM

  • Posts: 1764
  • Gender: Male
Re: different banner on different pages
« Reply #7 on: March 01, 2008, 11:28:30 AM »
Hi in your case it's an issue of "knowing how to code HTML".

Code: [Select]
<?php if (($page_id==4)||($page_id==7))
 {echo 
"<img src=\"media/banner/testbanner.gif\" alt=\"Banner\" />";}  ?>

Additional please have have a look on a html tutorial about the correct syntax for the img-tag

Regards Bernd

Logged
In theory, there is no difference between theory and practice. But, in practice, there is.

MicahK

  • Guest
Re: different banner on different pages
« Reply #8 on: March 01, 2008, 03:24:03 PM »
Whoops!   :-o  I did not notice that.  However, it did not change anything. 
Thanks for noticing that.
Logged

  • Print
Pages: [1]   Go Up
  • WebsiteBaker Community Forum »
  • WebsiteBaker Support (2.8.x) »
  • Droplets & Snippets »
  • different banner on different pages
 

  • SMF 2.0.19 | SMF © 2017, Simple Machines
  • XHTML
  • RSS
  • WAP2