The module works great when I put code into a page - also had success when combined with PHP, but when I place the code into my theme's page.tpl.php, all I see is the code - no photos. Any suggestions? I would like the photos to show up in the header, adjacent to the logo and can't think of another way.

Comments

nevets’s picture

A guess since all you see is the code is that you need to wrap the code in <?php and ?>.

johnhorning’s picture

Not sure why you would suggest wrapping it - this is not php code is it? In page.tpl.php wouldn't you write something like this?

echo "[bg|pathname|4|110|random|4|]";

I don't understand this "mystery code".

vm’s picture

looks like you may be trying to use filter code , which would explain why it shows in a page , where the filter can act on it. I don't believe you can arbitrarily throw filter style coding into the tpl.php and expect phptemplate to know what to do with it.

johnhorning’s picture

I see what you mean. I may try something dangerous next - copy some of the code from the module and paste it into Page.tpl.php. That's always fun. Any other suggestions?

vm’s picture

I may be helpful to those trying to help to expalin eactly what you are trying to do, rather then how you are trying to do it. There may be another method someone can suggest.

I assume you are just trying to pull images into the template, but why ?

johnhorning’s picture

Ok - I do appreciate your help. I'm just trying to display the images in the header of the home page and I would like to do more than just display static photos. I like what Brilliant Gallery does. I don't really want to replace the entire home page either. Is that enough to go on?

johnhorning’s picture

I should add that the images should be adjacent (on the right side) of the logo so don't think a block in the header will work.

vm’s picture

yep now I understand more however, I don't believe you are going to be able to pull this off in the tpl.php.

you would need to place your in a bock maybe, and place that block in the header region or something a little more creative.

johnhorning’s picture

Status: Closed (fixed) » Active

Ok. Gave up on trying to use Brilliant Gallery in the header. Was able to get random images from a directory to display in the header at least, which is mostly what I wanted.

Inserted this code into my page.tpl.php, if anyone's interested:

  if ($header_photos==1 && arg(0)=='node' && arg(1)=='') {
    $picdir="files/pictures/".$_subdomain."/thumbnails/";
    $dir=opendir($picdir);
    $i=0;
    while($imgfile=readdir($dir))
    {
     if ($imgfile != "." && $imgfile!=".."){
      $imgarray[$i]=$imgfile;
      $i++;
     }
    }
    closedir($dir);
    if(is_dir($picdir)) {
     $rand=rand(0,count($imgarray)-1);
     if($rand >= 0) {echo '<img src="'.$picdir.$imgarray[$rand].'" title="'.substr_replace($imgarray[$rand],"",-4).'" alt="'.substr_replace($imgarray[$rand],"",-4).'" >';}
     $rand=rand(0,count($imgarray)-1);
     if($rand >= 0) {echo '<img src="'.$picdir.$imgarray[$rand].'" title="'.substr_replace($imgarray[$rand],"",-4).'" alt="'.substr_replace($imgarray[$rand],"",-4).'" >';}
     $rand=rand(0,count($imgarray)-1);
     if($rand >= 0) {echo '<img src="'.$picdir.$imgarray[$rand].'" title="'.substr_replace($imgarray[$rand],"",-4).'" alt="'.substr_replace($imgarray[$rand],"",-4).'" >';}
     }
   }

A google search turns up other ways as well.

I appreciate the efforts of those that responded.

vm’s picture

Status: Active » Closed (fixed)

Status: Active » Closed (fixed)