Welcome, Guest. Please login or register.
Did you miss your activation email?
February 12, 2012, 01:35:49 PM

Login with username, password and session length
Search:     Advanced search
Wollen Sie dem WebsiteBaker Team beitreten?
Nähere Informationen finden Sie unter hier und auf unserer neuen Webseite.
149639 Posts in 21099 Topics by 7538 Members
Latest Member: ionline
* Home Help Search Login Register
Pages: [1]   Go Down
Print
Author Topic: different banner on different pages  (Read 1023 times)
MicahK

Offline Offline

Posts: 21


« 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
BerndJM

Offline Offline

Posts: 1764



« 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

Offline Offline

Posts: 21


« 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
marathoner

Offline Offline

Posts: 495


« 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

Offline Offline

Posts: 21


« 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
marathoner

Offline Offline

Posts: 495


« 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:
<?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

Offline Offline

Posts: 21


« Reply #6 on: March 01, 2008, 05:57:33 AM »

Pretty easy if you understand PHP...  grin  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:
<?php if (($page_id==4)||($page_id==7))
 {echo 
"<img=\"media/banner/testbanner.gif\" src=\"Banner\"></img>";} ......  ?>
Logged
BerndJM

Offline Offline

Posts: 1764



« 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:
<?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

Offline Offline

Posts: 21


« Reply #8 on: March 01, 2008, 03:24:03 PM »

Whoops!   shocked  I did not notice that.  However, it did not change anything. 
Thanks for noticing that.
Logged
Pages: [1]   Go Up
Print
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.16 | SMF © 2011, Simple Machines Valid XHTML 1.0! Valid CSS!