Newbie needs help with Gallery...

Doug_B

Joined: 2004-11-06
Posts: 44
Posted: Sat, 2004-11-06 19:23

I've been trying to change the header in Gallery for my application. I tried to follow pixelpoet's excellent tutorial from the knowledge base, but when I go into gallery/html_wrap/wrapper.header/default to change the code this is what comes up; (BTW the Gallery works excellently)
<?php
// This header file detects whether Gallery is embedded in any
// known PHP applications and then decorates Gallery appropriately.

global $GALLERY_EMBEDDED_INSIDE;

switch($GALLERY_EMBEDDED_INSIDE) {
case "nuke":
global $PHP_SELF;
if (!eregi("modules.php", $PHP_SELF)) {
die ("You can't access this file directly...");
}

/*
* Nuke owns the <head> tag and doesn't share. So, if we want to get our
* style sheet in place we've got to intercept Nuke's header and modify it
* to insert a few lines of our own in place. We could speed this process
* up greatly if we cached the results and saved it somewhere handy (like
* the session) but then we'd be vulnerable to attack by somebody who has
* write permissions in the directory that the session files live. They
* could create a bogus session file, set that ID into their cookie and
* then pass their own code into our eval() below.
*/
$header = "";
if ($fd = fopen("header.php", "r")) {
while (!feof($fd)) {
$line = fgets($fd, 1024);
$line = str_replace('<?php', '', $line);
$line = str_replace('?>', '', $line);
$header .= $line;
if (strstr($line, "<head")) {
$links = getStyleSheetLink();
$links = str_replace('"', '\"', $links);
$header .= 'echo "' . $links . '\n";' . "\n";
}
}
}

/*
* We can control whether we see the right side blocks
* by setting the value of the $index variable. To
* see the blocks, set $index to 1. To hide them set
* $index to 0. We default to 0 to leave more room for
* the photos. If you change this value, you should
* also change it in wrapper.footer
*
* Note that we save the current value of $index in
* $tmp_index and restore it when we're done. If we
* don't do this, navigation won't work!
*/
global $index;
$tmp_index = $index;
$index = 0;

eval($header);

OpenTable();

$index = $tmp_index;
break;
}
?>
Can anyone help me? Thanks in advance,
Doug_B, new user

 
khsjr1970

Joined: 2004-04-24
Posts: 271
Posted: Sat, 2004-11-06 19:40

The code from pixel poets web sit is inserted on the next line after ?> at the end and begin from there.

 
Doug_B

Joined: 2004-11-06
Posts: 44
Posted: Sat, 2004-11-06 19:51

Wow, thanks for being so quick, what a great community you all have got here! Much appreciate the help,
Doug_B

 
Doug_B

Joined: 2004-11-06
Posts: 44
Posted: Sat, 2004-11-06 20:05

Ooops, another question. As I'm new to the gallery mod's I'm unsure of exactly what has to remain in the copy from Pixelpoet's script. This is how I've made my changes;
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<!-- THIS IS THE ROW FOR THE HEADER GRAPHIC OR HEADER TEXT -->
<tr>
<td><img src="gallery/images/logo2.gif" height="100%" width="100%" border="0" alt="0">
</td>
</tr>
<!-- THIS ROW COULD BE FOR A HORIZONTAL NAVBAR ACROSS THE TOP OF THE PAGE -->
<tr>
<td><a href="mailto:d.burt@canadianelectricflight.com">SEND E-MAIL</a> || <a href="http://www.canadianelectricflight.com">BACK TO THE CEF HOMEPAGE</a>
</td>
</tr>
<!-- THIS IS THE ROW FOR THE GALLERY CODE. YOU ADD NOTHING -->
<tr>
<td valign="top">
Do I have to modify anymore of the script or is it OK now? Thanks again for being on the ball here...
Doug_B

 
khsjr1970

Joined: 2004-04-24
Posts: 271
Posted: Sat, 2004-11-06 21:31

basically, what pixel poet has done is given you an outline.

The <HTML> tags that she has can be replaced by your own in any way you want.

you can easily add rows more tables, anything you want. Just keep in mind the last few lines of her code,

<!-- THIS IS THE ROW FOR THE GALLERY CODE. YOU ADD NOTHING -->
<tr>
<td valign="top">

that part of the code can not be maipulated and should be left alone.

As well as <HTML> can be added it can be deleted. For example.

on my gallery I removed the send email to and back to homepage links, while adding a scripted nav bar at the top.

for reference, see, http://www.verymisunderstood.com

 
Doug_B

Joined: 2004-11-06
Posts: 44
Posted: Sat, 2004-11-06 22:14

Whoa,
I'm still very new at this and appreciate your feedback. I'm going to go ahead and remove the Href, navbar and title and see what happens. Thanks again,
Doug_B

 
Doug_B

Joined: 2004-11-06
Posts: 44
Posted: Sat, 2004-11-06 22:54

OK,

Tried it using this code and got....nothing? The whole page blanked out. I know that I'm new at it but this is ridiculous

<table width="whatever" border="0" cellpadding="0" cellspacing="0">
<tr>
<td><img src="http://www.canadianelectricflight.com/gallery/images/logo2.gif height="100%" width="100%" border="0" alt="0"></td>
</tr>
<!-- THIS IS THE ROW FOR THE GALLERY CODE. YOU ADD NOTHING -->
<tr>
<td valign="top">
Where'd I go wrong. Thanks again,
Doug_B

 
khsjr1970

Joined: 2004-04-24
Posts: 271
Posted: Sat, 2004-11-06 23:58

first thing that sticks out is that you have table width, left at "whatever" this needs to be corrected.

here is a look at what i did to accomplish the header graphic.

<?php
// $Id: wrapper.header.default,v 1.20 2004/03/31 21:11:43 jenst Exp $
// This header file detects whether Gallery is embedded in any
// known PHP applications and then decorates Gallery appropriately.

global $GALLERY_EMBEDDED_INSIDE;
global $GALLERY_EMBEDDED_INSIDE_TYPE;

if(isset($GALLERY_EMBEDDED_INSIDE)) {
global $PHP_SELF;

if (
($GALLERY_EMBEDDED_INSIDE_TYPE == 'postnuke' && !defined("LOADED_AS_MODULE")) ||
($GALLERY_EMBEDDED_INSIDE_TYPE == 'phpnuke' && !eregi("modules.php", $PHP_SELF)) ||
($GALLERY_EMBEDDED_INSIDE_TYPE == 'nsnnuke' && !eregi("modules.php", $PHP_SELF)) ||
($GALLERY_EMBEDDED_INSIDE_TYPE == 'phpBB2' && !defined("LOADED_AS_MODULE"))
) {
die ("You can't access this file directly...");
}

switch ($GALLERY_EMBEDDED_INSIDE_TYPE) {

case 'phpnuke':
case 'postnuke':

/*
* Nuke owns the <head> tag and doesn't share. So, if we want to get our
* style sheet in place we've got to intercept Nuke's header and modify it
* to insert a few lines of our own in place. We could speed this process
* up greatly if we cached the results and saved it somewhere handy (like
* the session) but then we'd be vulnerable to attack by somebody who has
* write permissions in the directory that the session files live. They
* could create a bogus session file, set that ID into their cookie and
* then pass their own code into our eval() below.
*/
$header = "";
if ($fd = fopen("header.php", "r")) {
while (!feof($fd)) {
$line = fgets($fd, 1024);
$line = str_replace('<?php', '', $line);
$line = str_replace(' ?>', '', $line);
$header .= $line;
if (strstr($line, "<head")) {
$links = getStyleSheetLink();
$links = str_replace('"', '\"', $links);
$header .= 'echo "' . $links . '\n";' . "\n";
}
}
}

/*
* We can control whether we see the right side blocks
* by setting the value of the $index variable. To
* see the blocks, set $index to 1. To hide them set
* $index to 0. We default to 0 to leave more room for
* the photos. If you change this value, you should
* also change it in wrapper.footer
*
* Note that we save the current value of $index in
* $tmp_index and restore it when we're done. If we
* don't do this, navigation won't work!
*/
global $index;
$tmp_index = $index;
$index = 0;

eval($header);

OpenTable();

$index = $tmp_index;
break;

case 'phpBB2':
/*
* PhpBB2 uses a templating system and also owns the HEAD tags. The
* easiest way at the moment to tackle this issue is therefore to
* simply make sure we don't call this function if phpBB2 is being used
* and put the style sheet link into the template manually
*/

global $phpbb_root_path;
global $template;
global $db;
global $theme, $lang, $images;
global $board_config;
global $phpEx;
global $userdata, $u_login_logout;
global $s_privmsg_new, $s_last_visit;
global $l_privmsgs_text_unread, $l_privmsgs_text, $l_online_users;
global $page_title, $nav_links_html;

// Sort out the page title
$page_title .= $gallery->app->galleryTitle;

// Verify that the $phpbb_root_path isn't overwritten with a remote exploit
if (!realpath($phpbb_root_path)) {
print _("Security violation") ."\n";
exit;
} else {
if (! defined("PHPBB_ROOT_PATH")) {
define("PHPBB_ROOT_PATH", $phpbb_root_path);
}
include (PHPBB_ROOT_PATH . "includes/page_header.php");
}
break;

case 'GeekLog':
/*
** Display header and left blocks
*/
echo COM_siteHeader();
break;

}
}
?>
<table align="center" width="100%" cellpadding="0" cellspacing="0">
<tr>
<td>
<center>
<object classid="clsid:D27CDB6E-AE6D-11CF-96B8-444553540000" id="obj1" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0" border="0" width="630" height="80">
<param name="movie" value="http://www.verymisunderstood.com/images/header.swf">
<param name="quality" value="High">
<embed src="http://www.verymisunderstood.com/images/header.swf" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" name="obj1" width="630" height="80"></object>
</td>
</tr>
<tr>
<td>
<center>
<script id="Sothink Widgets:_pgtres\38269.6949421296_PageletServer.DynamicMenu.pgt" type="text/javascript" language="JavaScript1.2">
<!--
stm_bm(["tubtehr",430,"","http://www.verymisunderstood.com/_pgtres/blank.gif",0,"","",0,0,250,0,1000,1,0,0,"","",0],this);
stm_bp("p0",[0,4,0,0,1,2,0,0,100,"",-2,"",-2,90,0,0,"#000000","#996699","",3,0,0,"#ffffff"]);
stm_ai("p0i0",[0,"|","","",-1,-1,0,"","_self","","","","",0,0,0,"","",0,0,0,0,1,"#996699",0,"#996699",0,"","",3,3,0,0,"#edeae6 #666666 #666666 #edeae6","#edeae6 #666666 #666666 #edeae6","#ffffff","#ffffff","8pt Arial","8pt Arial",0,0]);
stm_aix("p0i1","p0i0",[0," Home ","","",-1,-1,0,"http://www.verymisunderstood.com","_self","","","","",0,0,0,"","",0,0,0,0,1,"#996699",0,"#996699",0,"","",3,3,0,0,"#ffffff","#ffffff","#ffffff","#ffff00","bold 10pt 'Verdana','Arial'","bold 10pt 'Verdana','Arial'"]);
stm_aix("p0i2","p0i0",[]);
stm_aix("p0i3","p0i1",[0," The Man ","","",-1,-1,0,"http://www.verymisunderstood.com/man/"]);
stm_aix("p0i4","p0i0",[]);
stm_aix("p0i5","p0i1",[0," The Studio ","","",-1,-1,0,"http://www.verymisunderstood.com/studio/"]);
stm_aix("p0i6","p0i0",[]);
stm_aix("p0i7","p0i1",[0," The Gallery ","","",-1,-1,0,"http://gallery.verymisunderstood.com/"]);
stm_aix("p0i8","p0i0",[]);
stm_aix("p0i9","p0i1",[0," The News ","","",-1,-1,0,"http://www.verymisunderstood.com/news.php"]);
stm_aix("p0i10","p0i0",[]);
stm_aix("p0i11","p0i1",[0," The FAQ\'s ","","",-1,-1,0,"http://www.verymisunderstood.com/faqs.html"]);
stm_aix("p0i12","p0i0",[]);
stm_ep();
stm_em();
//-->
</script>
</center>
</td>
</tr>
<!-- THIS IS THE ROW FOR THE GALLERY CODE. YOU ADD NOTHING -->
<tr>
<td>

As you will notice pixel poets table begins just after the closing the php with ?>

I am not using a static graphic file as my header, I am using a .swf file which is why it is being called in by using the <object> tag. I am also usuing a Javascript navigation script that is placed just under the .swf header graphic.

Hope this helps

 
khsjr1970

Joined: 2004-04-24
Posts: 271
Posted: Sun, 2004-11-07 00:07
Doug_B wrote:
OK,

Tried it using this code and got....nothing? The whole page blanked out. I know that I'm new at it but this is ridiculous

<table width="whatever" border="0" cellpadding="0" cellspacing="0">
<tr>
<td><img src="http://www.canadianelectricflight.com/gallery/images/logo2.gif height="100%" width="100%" border="0" alt="0"></td>
</tr>
<!-- THIS IS THE ROW FOR THE GALLERY CODE. YOU ADD NOTHING -->
<tr>
<td valign="top">
Where'd I go wrong. Thanks again,
Doug_B

height and width percentages arent for pictures or images they are for tables widths and heights, images are measured in pixels and the number format works for this. ie: width="120" height="300" my exmpales are based on example, your width and height would be based on the image you are using and its measurements.

 
Doug_B

Joined: 2004-11-06
Posts: 44
Posted: Sun, 2004-11-07 01:27

This is not my day, I'm completely failing to get this done, sorry to be such a bone head. I put this code in;

<?php
// This is the default gallery header (for the main gallery
// page: albums.php). It's companion is gallery.footer.default.
//
// To override this header, create a file called gallery.header
// in this directory.
//
// NOTE: This header cets inserted below the <body> tag.
//
// Some tips:
// * Some application variables:
// - Gallery Title: $gallery->app->galleryTitle
//
?>
<?php
includeHtmlWrap("wrapper.header");
?>

<table width=100% border=0>
<tr>
<td>
<span class="head">
<?php echo $gallery->app->galleryTitle ?>

<table align="center" width="100%" cellpadding="0" cellspacing="0">
<tr>
<td><img src="http://www.canadianelectricflight.com/gallery/images/logo2.gif height="9.722" width="0.958" border="0" alt="0"></td>
</tr>
<!-- THIS IS THE ROW FOR THE GALLERY CODE. YOU ADD NOTHING -->
<tr>
<td valign="top"> </span>
</td>
</tr>
<tr>
<td valign="top">

</span>
</td>
</tr>
<tr>
<td valign="top">

The original page comes up with the same header as before? Argghhhh... I can't believe I'm this dense
Doug_B

 
khsjr1970

Joined: 2004-04-24
Posts: 271
Posted: Sun, 2004-11-07 04:48

well now I see something totally different here.

You are supposed to be editing wrapper.header.default

not gallery.header.default

I really think you should start from scratch. Pixel Poets code definetly works as it is the same code I used. Pay close attention to what files you are editing and always make a back up of the file you are editing.

 
Doug_B

Joined: 2004-11-06
Posts: 44
Posted: Sun, 2004-11-07 19:45

Hey khsjr1970,
As I only wanted to modify the main Gallery page I am following Pixelpoet's Part 3, as opposed to Part 2 which is the one you've used. I don't understand what would be different though and as usual, I'm still stuck with the mod's. I just noticed something in the code though while I was re-reading what we've managed to try so far, I have to much after the last break. I'm going to try removing the code and trying again. Thanks for all your help...
Doug_B

 
Doug_B

Joined: 2004-11-06
Posts: 44
Posted: Sun, 2004-11-07 20:39

Hey Again,

Well I tried the mod and it gave me the Navbar I'd put in OK, however the header graphic is nowhere's to be found. I still have the Gallery title where I want the logo. Here's the code I'm now using, can yu see where I've gone wrong? Thanks a bunch for all your patience...

<?php
// This is the default gallery header (for the main gallery
// page: albums.php). It's companion is gallery.footer.default.
//
// To override this header, create a file called gallery.header
// in this directory.
//
// NOTE: This header cets inserted below the <body> tag.
//
// Some tips:
// * Some application variables:
// - Gallery Title: $gallery->app->galleryTitle
//
?>
<?php
includeHtmlWrap("wrapper.header");
?>

<table width=100% border=0>
<tr>
<td>
<span class="head">
<?php echo $gallery->app->galleryTitle ?>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<HEADER GRAPHIC>
<tr>
<td><img src="a href:http://www.canadianelectricflight.com/gallery/images/header_graphic.gif" height="9.722" width="0.958" border="0" alt="0">
</td>
</tr>
<HORIZONTAL NAVBAR>
<tr>
<td><a href="mailto:d.burt@canadianelectricflight.com">SEND E-MAIL</a> || <a href="http://www.canadianelectricflight.com/">BACK TO CANADIAN ELECTRIC FLIGHT</a>
</td>
</tr>
<!-- THIS IS THE ROW FOR THE GALLERY CODE. YOU ADD NOTHING -->
<tr>
<td valign="top">

I used the correct values for the measurement of the graphic etc. Where'd I go wrong here...
Doug_B

 
khsjr1970

Joined: 2004-04-24
Posts: 271
Posted: Mon, 2004-11-08 03:21

Personally I still dont understand why you are adding this code to a different header file then you were instructed to.

your php, code looks nothing like mine, and I fear you are changing the wrong files.

but moving past that situation, ( I address it again at the bottom of the post ) I notice these problems with your HTML within the tables.

In the line of code that is pulling in your graphic file you have

<img src="a href:http://www.canadianelectricflight.com/gallery/images/header_graphic.gif" height="9.722" width="0.958" border="0" alt="0">

change this to <img src="http://www.canadianelectricflight.com/gallery/images/header_graphic.gif" height="9.722" width="0.958" border="0" alt="0">

you have an added code left over in your code.

secondly make sure your graphic file is where you are telling it to look for it, in gallery/images

and you can shorten this, but using this method. <img src="images/header_graphic.gif" height="9.722" width="0.958" border="0" alt="0">

the only other thing that i see that is curious, is your measurements. you have decimal places added in there, and I dont know that decimal places work. my graphic for example is width="630" height="80" . graphics are measured in pixels, and there are not fractions of pixels. For your purposes, you may want to exclude your height and width altogether, unless you are certain you are adding in pixel information.

When the page call the graphic up it will learn the size of the graphic rather then have you tell it what it is.

right now your code would pull up a graphic of any size but would only show it at

9.722 pixels by 0.958 needless to say, that would be ONE TINY placeholder. Basically it would show as a smudge on the screen.

if you still dont understand image measurements send me your graphic file, ill return your measurements and you can add em

AGAIN THO, first make ABSOLUTLEY SURE YOU ARE MANIPULATING THE CORRECT HEADER FILE.

YOU ARE SUPPOSED TO MANIPULATING THE FILE NAMED WRAPPER.HEADER.DEFAULT NOT, GALLERY.HEADER.DEFAULT there is a difference, unless of course, you are purposely trying to put your graphics in another part of the gallery code.

This IS important because all of the header files are manipulated differently, but WRAPPER.HEADER.DEFAULT is the one you would change to make your changes seen on EVERY page in gallery, not just one.

I hope this better educates you. Good Luck, and may the force be with you. :D

send to

 
Doug_B

Joined: 2004-11-06
Posts: 44
Posted: Mon, 2004-11-08 05:15

Hey again,

I tried the new code and voila, it's a working, lean, mean machine. Many thanks for your patience and persistence in helping. BTW in reference to the correct header file, I only wanted to use the logo on the main (index) page. Pixel poet's reference tutorial covers it in Part 3 (one page, use gallery.header.default), rather than Part 2 (wrapper.header.default) which does the entire site. Many thanks again,
Relieved...
Doug_B

 
khsjr1970

Joined: 2004-04-24
Posts: 271
Posted: Mon, 2004-11-08 05:30

Congrats, and I'm glad you were using the file you wanted to :)

KHSjr

 
Doug_B

Joined: 2004-11-06
Posts: 44
Posted: Mon, 2004-11-08 06:08

Thanks again Ken, check your personal e-mail...
Doug_B