I love the theme and really appreciate all the work you have done. I am looking for a way to have the banner rotate based on the node I am viewing. For example, If I am on node 2, I could have a banner named banner2.jpg. Is there a way to right it into the code. I am already using the rotating image code from http://ma.tt/scripts/randomimage/ . Can I tell it which banner to place on which page?

Comments

dchapiesky’s picture

I fixed this in 6.x - you may be able to back port it....

check #241962: Banner assignment rather than banner rotation.... for the modification I did...

Specifically, I rewrote rotate.php to accept ?title=

The original style sheet had

#header {
padding: 0;
margin: 0;
height: 180px;
background: #000033 url(img/banners/rotate.php) no-repeat 0px 0px;
position:relative;
}

I moved this to page.tpl.php as an inline style sheet:

<head>
  <title><?php print $head_title ?></title>

  <?php print $head ?>


<style type="text/css" >

#header {
padding: 0;
margin: 0;
height: 180px;
position:relative;
<?php print 'background: #000033 url('.marinelli_banner().') no-repeat 0px 0px;' ?>
}
</style>

  <?php print $styles ?>

and wrote marinelli_banner() in template.php


function marinelli_banner() {
  $theTitleName = str_replace(' ', '', strtolower(drupal_get_title()));

  $theBannerUrl = base_path().path_to_theme()."/img/banners/AssignByTitle.php?title=".$theTitleName;
  return $theBannerUrl;
}

The title is retrieved, made lowercase, and stripped of all whitespace. The url is constructed and returned as part of the style sheet for the page...

I have no idea about mods for 5.x but this should give you a good chance at it...

check #234410: Random Header Not So Random For Me for caching issues related to banner image update...

Daniel

garg_art’s picture

Awesome!

dchapiesky’s picture

Any suggestions for it?

garg_art’s picture

I have not tested it yet and to see the full effect. But I think your thoughts are exactly taking this theme to the next level. random rotation is good. But contextual rotation is more meaningful for visitors as well as web site owner. It has tremendous extensibility. Like the Grandparents starts with black&white picture of them and Children starts with boisterous picture of boys/girls gone crazy in a slumber party.

That is powerful.

dchapiesky’s picture

Thanks...

the one bug I have found is this:

1) www.mysite.com - displays my welcome page - but gets a random banner
2) www.mysite.com/node/1234 - displays my welcome page - and gets the proper banner...

I need to check what the title of the page is when it is the default (drupal_get_title()) so that I can create a properly named banner file.

On a different note....

In template.php, I use drupal_get_title() to determine the page title. There is no reason the selection process couldn't be more personal or fine grained.... base it on user name? base it on how revered they are in the community with expert points, base it on pretty much anything....

Daniel

Lioz’s picture

Status: Active » Closed (won't fix)