Hello everybody,
First i want to express my thanks to the developpers of Gallery, after trying a lot of different programs to create online photo-albums i finally found Gallery, and i just love it! Keep up the good work!
Ok, so let´s go on to my question: is it possible to insert a different header for each album? I design specific headers that fit the content of the album, but all i can do so far is a universal header for all albums. If anyone knows how to solve my problem, i wouls very much appreciate it. Thanx in advance!
Regards, Herodes
Posts: 8601
One way to do that is in html_wrap/album.header (copy from album.header.default if you haven't already).. you could add something like:
This will look for a file called {albumname}.header in the html_wrap directory and include it if found.. otherwise it will use a default header.. by album "name" I mean the name you see the URL; for album01 you would create html_wrap/album01.header for its header.
Posts: 2
Sorry, I tried to follow the explantion Mindless wrote, but I must have missed something 'cause it didn't work. Here 's my code of the the <AlbumName>.header file. Note that when I use the <AlbumName>.header name (in my case zadik.header), nothing happens... there's no header at all, as though the deafaultheader is in affect. When I rename the file to album.header it takes control on all the albums!!
My code is:
Please advise, referring specifacly to where I should make the changes to make it work only on the zadik album.
Posts: 8601
You need album.header and zadik.header. Copy album.header.default to album.header and make the changes I described above.. keep the zadik.header file you have above.
Posts: 2
10Q!
Posts: 12
I am also trying to include a different header for each album. I have included the code posted by mindless in my album.header file (copied from album.header.default), and creaded a new file called Niya.header. 'Niya" is the {albumtitle} for the album.
When I view the album page, I get the following error:
"Parse error: parse error in /var/www/html/gallery/html_wrap/album.header on line 30"
Here are the lines (with line numbers added) in my album.header file is:
[code]
27 <?php global $GALLERY_BASEDIR;
28 $albumheader = $GALLERY_BASEDIR . '/html_wrap/' . $gallery->album->fields["name"] . '.header';
29 if (fs_file_exists($albumheader) && !broken_link($albumheader)) {
30 include($albumheader);
31 } else { ?>
32 /* default album header goes here... */
33 <?php } ?>
[/code/}
I have tried this with a few other albums as well, with the same results.
Any suggestions?
Thanks.
Posts: 8601
Not sure what you've got before line 27 or after line 33, but you should have something in place of my comment for line 32. Let me be more specific about the contents of album.header:
1) copy album.header.default to album.header
2) insert the text you have listed as lines 27-31 in album.header just after this:
3) Add the text you have listed as line 33 at the bottom of the file.
Posts: 12
Thanks for the quick response.
> you should have something in place of my comment for line 32.
I assumed the comment was ok, but I have since taken it out.
> 1) copy album.header.default to album.header
Yep, did that.
> 2) insert the text you have listed as lines 27-31 in album.header just after this:
Did that too.
> 3) Add the text you have listed as line 33 at the bottom of the file.
Ah, I had misread your comment. So, this
<?php } ?>
goes at the very end of the file, after the HTML table?
Like so?...
That's what I have now, and I still get a parse error that points to this line:
PHP is completely new to me, but looking at this, I think I get the basic concept, and I am excited to get it to work. I'm sure it's just a simple thing that is a little bit off.
thanks again.
Posts: 11
Could this code also help with embedding different music into different slideshows?
For instance, I need wedding music to go with a wedding slideshow and kiddie music to go with the kids' slideshow...
Thanks...
Heidi Hafner
Posts: 8601
bodie8, other than including wrapper.header twice at the top the code looks ok to me.. I don't see what's causing the error. Perhaps you can post your album.header as an attachment or post the url of your gallery and I can take a look..
hehafner, yes, you could use a similar technique to include any code in different albums.. I'm not familiar with adding music on a page, but if you put the correct html in the {albumname}.header files it could work..
Posts: 12
> other than including wrapper.header twice at the top
(that was just an accident in the post, not actually in my album.header)
I'm not sure what the problem was, but it disappeared when I removed extra character spaces from:
I didn't see anything obviously wrong, no odd hidden characters, and BBEdit is usually pretty good about revealing that sort of thing.
Anyway, I just deleted all character spaces that separated each line, and even replaced them with my own, and it worked fine. Must have been some hidden gremlins from my original copy/paste of the code in the first place.
Works great now! Thanks!
Posts: 75
This one has got me beat. I'm getting:
Parse error: parse error in /home/sites/site96/html/Gallery/html_wrap/album.header on line 18
17 <?php
18 includeHtmlWrap("wrapper.header");
19 ?>
20
21
22<?php global $GALLERY_BASEDIR;
23$albumheader = $GALLERY_BASEDIR . '/html_wrap/' . $gallery->album->24fields["name"] . '.header';
25if (fs_file_exists($albumheader) && !broken_link($albumheader)) {
26† † include($albumheader);
27} else { ?>
(I've left the rest of the line numbers out)
<table width="100%" border="0">
<tr>
<td>
<table cellpadding="0" cellspacing="0" width="100%" border="0" align="center" class="mod_headliner">
<tr valign="middle">
<td class="leftspacer"></td>
<td>
<table cellspacing="0" cellpadding="0" class="mod_toplight_bg">
<tr>
<td class="mod_toplight_left" align="right"></td>
<td nowrap class="head" align="left">
&<?php echo $gallery->album->fields["title"] ?>&
</td>
<td class="mod_toplight_right" align="left">
</td>
</tr>
</table>
</td>
</tr>
</table>
<table width="100%" cellpadding="0" cellspacing="0">
<tr>
<td class="mod_under_hl"></td>
</tr>
</table>
</td>
</tr>
<tr>
<td valign="top">
<?php } ?>
I'm just not sure what can be wrong here. I have the other {albumname}.header in place but it looks like I'm not even getting past the default.
Thanks,
Leslie
Posts: 27300
leslienord,
Try removing the two empty lines 20 and 21. Then look at line 26 you have a t and t
Then if that does not work post your code as a text attachment and we'll see what is the trouble is.
In the future you can use the Code tags in the forum it makes it easy to see things as the white space is not stripped.
Dave
Posts: 75
Spaces! Not the ones at lines 20 & 21 but the t and t were actually spaces that as soon as I removed them - Voila! Two sucesses in one day - I feel very blessed.
THANK YOU!
Leslie
Posts: 11
Hi
I read through this whole thread and attempted to apply this mod to no avail--I just get a blank header but it might the CSS file overriding it?
Heres all the info
Our gallery http://www.anwc.org/gallery/
I am using the white skin, I have a custom header on the albums page(thanks for the tutorial) and have customized the css file
----------------------------------------------------------------------------
Heres the CSS for the gallery headers (now this jpg is on all myalbums)
-----------------------------------------------------------------------
.head /* page headers behind the Gallery title*/
{
background-image: url(../images/weddingsgall2.jpg);
line-height:140%;
letter-spacing: .2em;
border:0px dashed #999999;
width: 452px;
height: 65px;
}
------------------------------------------------------------------------
Heres my album.header code (as done per your suggestion)
----------------------------------------------------------------------
<?php
// This is the default album header (for the gallery
// page: view_album.php). It's companion is album.footer.default.
//
// To override this header, create a file called album.header
// in this directory.
//
// NOTE: This header gets inserted below the <body> tag.
//
// Some tips:
// * Some application variables:
// - Gallery Title: $gallery->app->galleryTitle
// - Album Title: $gallery->album->fields["title"]
//
// $Id: album.header.default,v 1.16 2003/10/20 02:20:23 john_kirkland Exp $
?>
<?php
includeHtmlWrap("wrapper.header");
?>
<?php global $GALLERY_BASEDIR;
$albumheader = $GALLERY_BASEDIR . '/html_wrap/' . $gallery->album->fields["name"] . '.header';
if (fs_file_exists($albumheader) && !broken_link($albumheader)) {
include($albumheader);
} else { ?>
<table width="100%" border="0">
<tr>
<td>
<table cellpadding="0" cellspacing="0" width="100%" border="0" align="center" class="mod_headliner">
<tr valign="middle">
<td class="leftspacer"></td>
<td>
<table cellspacing="0" cellpadding="0" class="mod_toplight_bg">
<tr>
<td class="mod_toplight_left" align="right"></td>
<td nowrap class="head" align="left">
&<?php echo $gallery->album->fields["title"] ?>&
</td>
<td class="mod_toplight_right" align="left">
</td>
</tr>
</table>
</td>
</tr>
</table>
<table width="100%" cellpadding="0" cellspacing="0">
<tr>
<td class="mod_under_hl"></td>
</tr>
</table>
</td>
</tr>
<tr>
<td valign="top">
<?php } ?>
-----------------------------------------------------------------------------
Heres my weddings.header code (the header i want on the weddings page)
-----------------------------------------------------------------------------
?>
<?php
includeHtmlWrap("wrapper.header");
?>
<table width=100% border=0>
<tr>
<td>
<span class="head">
<?php echo $gallery->album->fields["title"] ?>
</span>
</td>
</tr>
<tr>
<td valign="top">
<p> <p align="center"> <img border="0" src="http://www.anwc.org/images/weddingsgall.jpg" width="452" height="65"></p>
<p align="center"><a href="mailto:anwclub@covad.net"><font color="#DF0024" size="1" face="Verdana">Send
E-mail</font></a><font color="#DF0024" size="1" face="Verdana"> | </font>
<font color="#DF0024" size="1" face="Verdana"><a href="http://www.anwc.org/home.html">ANWC
Home </a></font>
&</p></td>
-------------------------------------------------------------------------
Now for this to work do I need to get rid of the header in the CSS code?
(by the way..the image i have currently in the css code 'weddingsgall2.jpg' is not the one i want at the top of the that weddings gallery..its weddingsgall.jpg--i just created a new one so all the albums wouldnt have a wedding title)
Or am I missing some code somewhere in the headers?
Thanks in advance
Posts: 27300
Your album.header looks fine from what I can tell.
Your wedding.header does not. First it has a ?> at the top. That is not required.
Next it should have the same format as the ORIGINAL album.header with the opening table cell at the bottom. The original album.header had:
<tr>
<td valign="top">
at the bottom to start the rest of the Gallery page. There might be more wrong as I did not look in detail. But you should be able to make a copy of the original album.header and call it wedding.header and add some test text to see if it works.
As for the css. If you have a image for the body in the css it will show on all pages.
Dave
Posts: 11
Ahhhh! thank you!
Thats what I didnt get..that the wedding head had to be exactly same except for the ..etc
Got it
Thanks for your help fellow Canuck
Posts: 8
I've gone over this post several times and find it far to vague for me to do this. I have no idea for example if I need code in each album directory. Can someone help clarify this process (I'm unfamiliar with php though).
Posts: 27300
garyferrer,
If you want a custom header for a particular album this is the steps you need to do:
Take this code and save it as album.header
then take this code and save it as album01.header
Edit to your desires.
Now if you want another album other than album01, (with a custom header) then you have to make another copy of the second file and call it albumname.header. Gallery will look for a header file and if not found it will give the default header. All these files are in the html_wrap directory. No code required in the album directory.
Dave
Posts: 27300
For 1.4.4:
http://gallery.menalto.com/index.php?name=PNphpBB2&file=viewtopic&p=87570#87570
Posts: 3
Hi,
I have a small variation of the issue: I have already done a customization of the footer, but now I want that customization to be used on all pages BUT those of one album and all its subalbums. In that album users are allowed to add their own albums, so I cannot hardcode specific names of the subalbums, I would have to somehow use the 'base-album'. Is there a way to do this?
Tx
Michael
Posts: 3
Well, here's what I did:
(the IF checks if we're NOT inside one of the 'critical' albums and if so, it will execute the code which prints additional footer-info)
Works fine for the way I use it, since applying that naming-convention is not a problem with the way the stuff is organized.
But still it would be nice to know if there was a better way to handle it, without relying on such naming conventions, so I would appreciate any comments...
Cheers
Michael
P.S: since that specific gallery is for registered users only, you can't see the effect of not showing the mods, but feel free to browse my gallery @ http://3baas.de/fotos[/]
Posts: 36
This worked great! The only hiccup I'm getting is that when you go back to the main gallery page from this album with a customized header, the main album page (album.php) does not include the wrapper.header file unless I refresh the page. Any clues as to how to solve this?
You can see what I mean by starting here:
http://www.thestoddards.com/gallery/elle, then select the main gallery link (The Stoddard Photo Gallery). Notice there is no header. Now hit F5 to refresh the page, and you'll see the header.
Thanks for any help anyone can provide.
Posts: 1301
You've got two body tags in there - maybe that's part of the problem?
Gaile
Posts: 36
Thanks, Gaile. That helped me debug it a bit more. It's not actually the double body tags, but it looks like the is not including wrapper.header on the intial page load (and thus no header), and is including it on the refresh (then the header showing). This is consitently happening when coming from a page with a custom header.
I'm using
to control whether or not the wrapper is included, and it seems to work well with this one hiccup. Is it possible that it's holding the "elle" in memory when it first loads the page?
Any suggestions on things to try would be much appreciated.
Thanks,
Rod
Posts: 26
I read this post as I would also like to have differents header for differents albums (actually a logo for a white background and another one for a dark background). I tried to follow the steps, but I might missing something...
The default header well shows up on all albums including the one which is named "Chine" (Chine.header well exists !) :
album.header
Chine.header
http://pictur.net/gallery/Chine (Gallery v1.5-RC2 )
Any help would be much appreciated.
Stéphane.
Posts: 75
I just upgraded the gallery I used the custom header code on to version 1.5 and it no longer displays the custom headers. What needs to be changed?
Thanks again,
Leslie
Posts: 27300
Posts: 75
Thank you once again - worked like a charm.
Leslie
Posts: 7
Hi, I am having problems implementing this - trying to get different albums to have different headers.
If I use the default album.header it works:
<?php
// This is the default album header (for the gallery
// page: view_album.php). It's companion is album.footer.default.
//
// To override this header, create a file called album.header
// in this directory.
//
// NOTE: This header gets inserted below the <body> tag.
//
// Some tips:
// * Some application variables:
// - Gallery Title: $gallery->app->galleryTitle
// - Album Title: $gallery->album->fields["title"]
//
// $Id: album.header.default,v 1.17 2004/07/17 11:35:20 jenst Exp $
?>
<?php
includeHtmlWrap("wrapper.header");
if (!includeTemplate('album.header.tpl')) {
?>
<table width="100%" border="0">
<tr>
<td>
<table cellpadding="0" cellspacing="0" width="100%" border="0" align="center" class="mod_headliner">
<tr valign="middle">
<td class="leftspacer"></td>
<td>
<table cellspacing="0" cellpadding="0" class="mod_toplight_bg">
<tr>
<td class="mod_toplight_left" align="right"></td>
<td nowrap class="head" align="left">
&<?php echo $gallery->album->fields["title"] ?>&
</td>
<td class="mod_toplight_right" align="left">
</td>
</tr>
</table>
</td>
</tr>
</table>
<table width="100%" cellpadding="0" cellspacing="0">
<tr>
<td class="mod_under_hl"></td>
</tr>
</table>
</td>
</tr>
<tr>
<td valign="top">
<?php
}
?>
If I paste in the code from this topic (the various versions) the html rendering stops at the <body> tag and I get a blank page?
<?php
// This is the default album header (for the gallery
// page: view_album.php). It's companion is album.footer.default.
//
// To override this header, create a file called album.header
// in this directory.
//
// NOTE: This header gets inserted below the <body> tag.
//
// Some tips:
// * Some application variables:
// - Gallery Title: $gallery->app->galleryTitle
// - Album Title: $gallery->album->fields["title"]
//
// $Id: album.header.default,v 1.16 2003/10/20 02:20:23 john_kirkland Exp $
?>
<?php global $GALLERY_BASEDIR;
$albumheader = $GALLERY_BASEDIR . '/html_wrap/' . $gallery->album->fields["name"] . '.header';
if (fs_file_exists($albumheader) && !broken_link($albumheader)) {
include($albumheader);
} else { ?>
<?php
includeHtmlWrap("wrapper.header");
?>
<table width="100%" border="0">
<tr>
<td>
<table cellpadding="0" cellspacing="0" width="100%" border="0" align="center" class="mod_headliner">
<tr valign="middle">
<td class="leftspacer"></td>
<td>
<table cellspacing="0" cellpadding="0" class="mod_toplight_bg">
<tr>
<td class="mod_toplight_left" align="right"></td>
<td nowrap class="head" align="left">
&<?php echo $gallery->album->fields["title"] ?>&
</td>
<td class="mod_toplight_right" align="left">
</td>
</tr>
</table>
</td>
</tr>
</table>
<table width="100%" cellpadding="0" cellspacing="0">
<tr>
<td class="mod_under_hl"></td>
</tr>
</table>
</td>
</tr>
<tr>
<td valign="top">
<?php } ?>
What am I doing wrong. Many thanks for your help.
Alex
Posts: 27300
http://gallery.menalto.com/index.php?name=PNphpBB2&file=viewtopic&p=140944#140944
add replace
global $GALLERY_BASEDIR;
with
$GALLERY_BASEDIR = dirname(__FILE__);
Posts: 7
Thanks for your reply I have made this change and now have:
<?php
// This is the default album header (for the gallery
// page: view_album.php). It's companion is album.footer.default.
//
// To override this header, create a file called album.header
// in this directory.
//
// NOTE: This header gets inserted below the <body> tag.
//
// Some tips:
// * Some application variables:
// - Gallery Title: $gallery->app->galleryTitle
// - Album Title: $gallery->album->fields["title"]
//
// $Id: album.header.default,v 1.16 2003/10/20 02:20:23 john_kirkland Exp $
?>
<?php global $GALLERY_BASEDIR = dirname(__FILE__);
$albumheader = $GALLERY_BASEDIR . '/html_wrap/' . $gallery->album->fields["name"] . '.header';
if (fs_file_exists($albumheader) && !broken_link($albumheader)) {
include($albumheader);
} else { ?>
<?php
includeHtmlWrap("wrapper.header");
?>
<table width="100%" border="0">
<tr>
<td>
<table cellpadding="0" cellspacing="0" width="100%" border="0" align="center" class="mod_headliner">
<tr valign="middle">
<td class="leftspacer"></td>
<td>
<table cellspacing="0" cellpadding="0" class="mod_toplight_bg">
<tr>
<td class="mod_toplight_left" align="right"></td>
<td nowrap class="head" align="left">
&<?php echo $gallery->album->fields["title"] ?>&
</td>
<td class="mod_toplight_right" align="left">
</td>
</tr>
</table>
</td>
</tr>
</table>
<table width="100%" cellpadding="0" cellspacing="0">
<tr>
<td class="mod_under_hl"></td>
</tr>
</table>
</td>
</tr>
<tr>
<td valign="top">
<?php } ?>
But it still won't work. I don't know anything about PHP. Should I have put in a real name for__FILE__? Your help much appreciated.
alex
Posts: 27300
<?php global $GALLERY_BASEDIR = dirname(__FILE__);
remove the word global
Posts: 7
Thanks floridave,
I am not doing well on this one. I now have:
<?php
// This is the default album header (for the gallery
// page: view_album.php). It's companion is album.footer.default.
//
// To override this header, create a file called album.header
// in this directory.
//
// NOTE: This header gets inserted below the <body> tag.
//
// Some tips:
// * Some application variables:
// - Gallery Title: $gallery->app->galleryTitle
// - Album Title: $gallery->album->fields["title"]
//
// $Id: album.header.default,v 1.16 2003/10/20 02:20:23 john_kirkland Exp $
?>
<?php $GALLERY_BASEDIR = dirname(__FILE__);
$albumheader = $GALLERY_BASEDIR . '/html_wrap/' . $gallery->album->fields["name"] . '.header';
if (fs_file_exists($albumheader) && !broken_link($albumheader)) {
include($albumheader);
} else { ?>
<table width="100%" border="0">
<tr>
<td>
<table cellpadding="0" cellspacing="0" width="100%" border="0" align="center" class="mod_headliner">
<tr valign="middle">
<td class="leftspacer"></td>
<td>
<table cellspacing="0" cellpadding="0" class="mod_toplight_bg">
<tr>
<td class="mod_toplight_left" align="right"></td>
<td nowrap class="head" align="left">
<?php echo $gallery->album->fields["title"] ?>
</td>
<td class="mod_toplight_right" align="left">
</td>
</tr>
</table>
</td>
</tr>
</table>
<table width="100%" cellpadding="0" cellspacing="0">
<tr>
<td class="mod_under_hl"></td>
</tr>
</table>
</td>
</tr>
<tr>
<td valign="top">
<?php } ?>
At least the page is rendering....
I have an album name mjp (url ...www.xxx.com/gallery/mjp). I have a file mjp.header in the html_wrap drirectory. I have writen "test" in this file - have also tried proper html.
The problem is that the page for the mjp album is rendering with the default.header table?
Any ideas what I am doing wrong?
Many thanks once again,
Alex
Posts: 27300
real urls would be helpfull PM me if you don't want the world to see what is on the world wide web.
and wrap your code in code tags!
Dave
Posts: 7
Sorry. At the moment I just have guff on the site... www.bellfish.net/gallery/mjp
Regards, Alex
Posts: 27300
try this as your /html_wrap/album.header
Posts: 7
Fantastic. A quick question - why / and not /html_wrap/? I was assuming that the GALLERY_BASEDIR was the gallery directory?
Thanks again.
Alex
Posts: 7
I've got the customized headers working well, but am having a hard time coding the album.footer to get it to choose a different footer for each album. I'm using the following code:
Where should I insert it in my album.footer file to make this work?
Thanks,
Dirk
Posts: 27300
it should go at the top, did you put the closing brace at the bottom?
Posts: 7
Thanks. The ending bracket did the trick.
One more question. Is there a way to change the album.header code below ...
... so that subalbums automatically use the parent album's header if its own header file doesn't exist?
Thanks,
Dirk
Posts: 4
I was wondering if anyone could tell me if the information in this thread could be used for what I'm trying to do.
Right now I'm using the wrapper.header file to put my menu on both the "photos" and "portfolio" sections of my site.
http://www.shatterthelens.com/mygallery/photos
But as you can see, the menu is the same for both. Ideally in the Photos section, I would use the .jpg with :Photos: and in the Porfolio section i would use the jpg with :Porfolio:, but right now it's always photos.
Thanks in advance :D
Posts: 7
I've figured out a way to have child albums default to a parent album's header, modifying the code a bit. I suppose this wouldn't work on a child album of a child album, but there's probably a way to work around that somehow.
This first checks for a custom header for a particular album. If it doesn't find it, it will use its parent album's custom header. If it doesn't find either, it'll use album.header.
Dirk
Posts: 2
How to use this Coding in the Gallery. thanks you
Posts: 27300
G1 or G2?
Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team