Header and Footer in Matrix Layout in G2 Alpha 2

lvthunder

Joined: 2003-09-12
Posts: 808
Posted: Fri, 2004-09-03 04:56

I downloaded and installed Gallery 2 Alpha 2 and I'm trying to modify the Matrix Layout and Theme to match the rest of my website. I almost had it in Alpha 1, but when I read in Alpha 2 that some of the div tags were removed I decided to throw out what I have done and start agian. After looking at the code for a couple hours I can not find where the header and footer are stored. Shouldn't these be with the rest of the tpl files for the layout. I'm still not sure on the process of files it goes thru.

Thanks in advance,
Stephen Cupp

 
rasheid

Joined: 2004-08-31
Posts: 28
Posted: Fri, 2004-09-03 13:32
lvthunder wrote:
I downloaded and installed Gallery 2 Alpha 2 and I'm trying to modify the Matrix Layout and Theme to match the rest of my website. I almost had it in Alpha 1, but when I read in Alpha 2 that some of the div tags were removed I decided to throw out what I have done and start agian. After looking at the code for a couple hours I can not find where the header and footer are stored. Shouldn't these be with the rest of the tpl files for the layout. I'm still not sure on the process of files it goes thru.

Thanks in advance,
Stephen Cupp

You can just replace the logo image in /images

 
rasheid

Joined: 2004-08-31
Posts: 28
Posted: Fri, 2004-09-03 13:33

you can just replace the logo image in /images

 
mindless
mindless's picture

Joined: 2004-01-04
Posts: 8601
Posted: Fri, 2004-09-03 14:46

If you want to add content around G2, like your website header or footer, copy templates/global.tpl to templates/global.tpl.local and edit that.
To modify matrix layout/theme look in layouts/matrix/templates/*.tpl and themes/matrix/styles/theme.css

 
lvthunder

Joined: 2003-09-12
Posts: 808
Posted: Fri, 2004-09-03 19:32
mindless wrote:
If you want to add content around G2, like your website header or footer, copy templates/global.tpl to templates/global.tpl.local and edit that.
To modify matrix layout/theme look in layouts/matrix/templates/*.tpl and themes/matrix/styles/theme.css

Thanks for the information. This is what I am looking for. I would think though that these headers and footers should be with the rest of the layout. This would help people who want to have different layouts on different albums.

Stephen Cupp

 
mindless
mindless's picture

Joined: 2004-01-04
Posts: 8601
Posted: Fri, 2004-09-03 19:48

Changes in global.tpl affect all pages, so your header/footer will appear no matter which layout is in use, or if you're viewing a page that isn't rendered by a layout.

 
lvthunder

Joined: 2003-09-12
Posts: 808
Posted: Fri, 2004-09-03 20:47
mindless wrote:
Changes in global.tpl affect all pages, so your header/footer will appear no matter which layout is in use, or if you're viewing a page that isn't rendered by a layout.

Yeah I knew that. I was just thinking that some people would want the header and footer to be different for each layout. I guess if that's the case they can move it out of the global.tpl.

 
bharat
bharat's picture

Joined: 2002-05-21
Posts: 7994
Posted: Sat, 2004-09-04 00:46

The tradeoff is if we leave the header and footer in the layout, then we also have to put it into each of our other views (ItemAdmin, SiteAdmin, UserAdmin, etc) which means that if you want to embed your G2 into your existing site you'd have to edit a lot of files to embed your header/footer. I'm sure that there are other ways to solve this, but I'd like to wait and see how people use it first.

 
jamzyamz
jamzyamz's picture

Joined: 2004-01-12
Posts: 154
Posted: Sat, 2004-09-25 02:19

I think global is awesome. I hated having to change all the headers/footers everytime I want to change one little thing to them.

 
shiva777

Joined: 2005-09-14
Posts: 7
Posted: Wed, 2005-09-21 23:40

I am also using G2 and cannot find global.tpl. Any idea where I can find this?
~shiva

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Wed, 2005-09-21 23:45

lol, a 1 year old topic. global.tpl doesn't exist anymore.

it's called themes/matrix/templates/theme.tpl now.

 
shiva777

Joined: 2005-09-14
Posts: 7
Posted: Fri, 2005-09-23 17:17

Thanks Valiant..I figured it was something like that...now I have located this file and have managed to get my header on there...the thing is that whenever I try to put javascript in (for rollover images) I get an error message:

Fatal error: Smarty error: [in gallery:themes/matrix/templates/theme.tpl line 22]: syntax error: unrecognized tag: //v3.0 var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array(); var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i/home/freaks/public_html/gallery2/lib/smarty/Smarty.class.php on line 1088

Any idea how I can get it to recognize script tags?
Many thanks!
~shiva

Here is my theme.tpl:

{*
* $Revision: 1.7 $
* If you want to customize this file, do not edit it directly since future upgrades
* may overwrite it. Instead, copy it into a new directory called "local" and edit that
* version. Gallery will look for that file first and use it if it exists.
*}
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
{* Let Gallery print out anything it wants to put into the <head> element *}
{g->head}

{* If Gallery doesn't provide a header, we use the album/photo title (or filename) *}
{if empty($head.title)}
<title>{$theme.item.title|default:$theme.item.pathComponent|markup:strip}</title>
{/if}

{* Include this theme's style sheet *}
<link rel="stylesheet" type="text/css" href="{g->theme url="theme.css"}"/>
<script language="JavaScript" type="text/JavaScript">
<!--
function MM_preloadImages() { //v3.0
var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
//-->
</script>
</head>
<body bgcolor="#825BE6" onLoad="MM_preloadImages('http://freaksforfun.net/Library/slices/top%20nav2_r2_c1_f2.jpg','http://freaksforfun.net/Library/slices/top%20nav2_r2_c2_f2.jpg','http://freaksforfun.net/Library/slices/top%20nav2_r2_c3_f2.jpg','http://freaksforfun.net/Library/slices/top%20nav2_r2_c4_f2.jpg','http://freaksforfun.net/Library/slices/top%20nav2_r2_c5_f2.jpg','http://freaksforfun.net/Library/slices/top%20nav2_r2_c6_f2.jpg')"><!-- #BeginLibraryItem "/Library/top nav2.lbi" -->
<table width="750" border="0" align="center" cellpadding="0" cellspacing="0">
<!-- fwtable fwsrc="header2.png" fwbase="top nav2.jpg" -->
<tr>
<td><img src="http://freaksforfun.net/Library/slices/spacer.gif" width="136" height="1" border="0"></td>
<td><img src="http://freaksforfun.net/Library/slices/spacer.gif" width="103" height="1" border="0"></td>
<td><img src="http://freaksforfun.net/Library/slices/spacer.gif" width="129" height="1" border="0"></td>
<td><img src="http://freaksforfun.net/Library/slices/spacer.gif" width="127" height="1" border="0"></td>
<td><img src="http://freaksforfun.net/Library/slices/spacer.gif" width="110" height="1" border="0"></td>
<td><img src="http://freaksforfun.net/Library/slices/spacer.gif" width="145" height="1" border="0"></td>
<td><img src="http://freaksforfun.net/Library/slices/spacer.gif" width="1" height="1" border="0"></td>
</tr>
<tr>
<td colspan="6"><img name="top20nav2_r1_c1" src="http://freaksforfun.net/Library/slices/top%20nav2_r1_c1.jpg" width="750" height="131" border="0"></td>
<td><img src="http://freaksforfun.net/Library/slices/spacer.gif" width="0" height="131" border="0"></td>
</tr>
<tr>
<td><a href="http://freaksforfun.net/freaksforfun.html" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('top20nav2_r2_c1','','http://freaksforfun.net/Library/slices/top%20nav2_r2_c1_f2.jpg',1)" ><img name="top20nav2_r2_c1" src="http://freaksforfun.net/Library/slices/top%20nav2_r2_c1.jpg" width="136" height="57" border="0"></a></td>
<td><a href="http://freaksforfun.net/gallery2" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('top20nav2_r2_c2','','http://freaksforfun.net/Library/slices/top%20nav2_r2_c2_f2.jpg',1)" ><img name="top20nav2_r2_c2" src="http://freaksforfun.net/Library/slices/top%20nav2_r2_c2.jpg" width="103" height="57" border="0"></a></td>
<td><a href="http://freaksforfun.net/calendar" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('top20nav2_r2_c3','','http://freaksforfun.net/Library/slices/top%20nav2_r2_c3_f2.jpg',1)" ><img name="top20nav2_r2_c3" src="http://freaksforfun.net/Library/slices/top%20nav2_r2_c3.jpg" width="129" height="57" border="0"></a></td>
<td><a href="http://freaksforfun.net/FreaksDir/" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('top20nav2_r2_c4','','http://freaksforfun.net/Library/slices/top%20nav2_r2_c4_f2.jpg',1)" ><img name="top20nav2_r2_c4" src="http://freaksforfun.net/Library/slices/top%20nav2_r2_c4.jpg" width="127" height="57" border="0"></a></td>
<td><a href="http://freaksforfun.net/FreaksDir/recomend" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('top20nav2_r2_c5','','http://freaksforfun.net/Library/slices/top%20nav2_r2_c5_f2.jpg',1)" ><img name="top20nav2_r2_c5" src="http://freaksforfun.net/Library/slices/top%20nav2_r2_c5.jpg" width="110" height="57" border="0"></a></td>
<td><a href="http://freaksforfun.tribe.net" target="_blank" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('top20nav2_r2_c6','','http://freaksforfun.net/Library/slices/top%20nav2_r2_c6_f2.jpg',1)" ><img name="top20nav2_r2_c6" src="http://freaksforfun.net/Library/slices/top%20nav2_r2_c6.jpg" width="145" height="57" border="0"></a></td>
<td><img src="http://freaksforfun.net/Library/slices/spacer.gif" width="1" height="57" border="0"></td>
</tr>
</table>
<div {g->mainDivAttributes}>
{*
* Some module views (eg slideshow) want the full screen. So for those, we
* don't draw a header, footer, navbar, etc. Those views are responsible for
* drawing everything.
*}
{if $theme.useFullScreen}
{include file="gallery:`$theme.moduleTemplate`" l10Domain=$theme.moduleL10Domain}
{else}

<div id="gsNavBar" class="gcBorder1">
<div class="gbSystemLinks">
{g->block type="core.SystemLinks"
order="core.SiteAdmin core.YourAccount core.Login core.Logout"
othersAt=4}
</div>

<div class="gbBreadCrumb">
{g->block type="core.BreadCrumb"}
</div>
</div>

{* Include the appropriate content type for the page we want to draw. *}
{if $theme.pageType == 'album'}
{g->theme include="album.tpl"}
{elseif $theme.pageType == 'photo'}
{g->theme include="photo.tpl"}
{elseif $theme.pageType == 'admin'}
{g->theme include="admin.tpl"}
{elseif $theme.pageType == 'module'}
{g->theme include="module.tpl"}
{elseif $theme.pageType == 'progressbar'}
{g->theme include="progressbar.tpl"}
{/if}

<div id="gsFooter">
{g->logoButton type="validation"}
{g->logoButton type="gallery2"}
{g->logoButton type="gallery2-version"}
{g->logoButton type="donate"}
</div>
{/if} {* end of full screen check *}
</div>

{*
* Give Gallery a chance to output any cleanup code, like javascript that
* needs to be run at the end of the <body> tag. If you take this out, some
* code won't work properly.
*}
{g->trailer}

<div align="center"><span class="style6"><a href="http://freaksforfun.net">Home</a>
- <a href="http://freaksforfun.net/freaksforfun.html">The Story</a> - <a href="http://freaksforfun.net/gallery2">Images</a>
- <a href="http://freaksforfun.net/calendar">Calendar</a> - <a href="http://freaksforfun.net/FreaksDir/%20">Directory</a>
- <a href="http://freaksforfun.net/FreaksDir/recomend">Hot Tips</a> - <a href="http://freaksforfun.tribe.net" target="_blank">Tribe.net</a></span></span></span> </span>
<br>
<br>
</div>
<div align="center">
<span class="style6"><a href="http://freaksforfun.net/cafepress.html" target="_blank" class="style3">Don't have enough Freak Gear? Get MORE at CafePress!
</a> <br>
<br>
<a href="http://freaksforfun.net/contact.html">Questions or comments about the site?</a></span>
</span>
<p>&nbsp;</p>
</div>
{* Put any debugging output here, if debugging is enabled *}
{g->debug}
</body>
</html>

 
lvthunder

Joined: 2003-09-12
Posts: 808
Posted: Fri, 2005-09-23 18:21

The easy way would be to put the Javascript in a .js file and call that file instead of having the JavaScript in the template file. If not I think there is a {literal} tag in Smarty (check the manual to be sure that's the tag).

 
Jasper_e

Joined: 2004-12-14
Posts: 6
Posted: Sun, 2005-09-25 13:15

If you're embedding gallery in your own site by modifying the theme.tpl file you might also want to change the way font sizes are set in the .css file.
On my personal site font sizes got real small because it added a menu to the left of the page and only allowed a total pagewidth suitable for 800*600 screen resolutions.
In the css the font-size was set as a percentage, changing this to a static 12px fixed this for me.