html_wrap not doing what I want.

danando

Joined: 2008-10-01
Posts: 1
Posted: Thu, 2008-10-02 00:06

Hi there, I'm relatively new to Gallery 2, but I'm trying to embed G2 into my website, and when i enter the code as shown in the tutorials, and then save it, the page outputs a white screen.

Here is the code:

Quote:
{*
* $Revision: 15342 $
* 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 lang="{g->language}">
<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|markup:strip|default:$theme.item.pathComponent}</title>
{/if}

{* Include this theme's style sheet *}
<link rel="stylesheet" type="text/css" href="{g->theme url="theme.css"}"/>
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_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_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>

<link href="scripts/lightbox/lightbox.css" rel="stylesheet" media="screen" type="text/css" />

<script type="text/javascript" src="scripts/lightbox/prototype.js"></script>

<script type="text/javascript" src="scripts/lightbox/scriptaculous.js?load=effects"></script>

<script type="text/javascript" src="scripts/lightbox/lightbox.js"></script>

</head>
<body class="gallery" bgcolor="#e1e1e1" onload="MM_preloadImages('images/index_05_1.png','images/index_06_1.png','images/index_07_1.png','images/index_08_1.png','images/index_09_1.png')"><br />
<br />
<table width="725" border="0" cellspacing="0" cellpadding="0" align="center">
<tr>
<td colspan="5"><div align="left"><img src="images/index_03.jpg" width="725" height="104" /></div></td>
</tr>
<tr>
<td width="113"><a href="index.html" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image6','','images/index_05_1.png',1)"><img src="images/index_05.png" name="Image6" width="113" height="31" border="0" id="Image6" /></a></td>
<td width="145"><a href="about.html" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image7','','images/index_06_1.png',1)"><img src="images/index_06.png" name="Image7" width="178" height="31" border="0" id="Image7" /></a></td>
<td width="145"><a href="events.html" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image8','','images/index_07_1.png',1)"><img src="images/index_07.png" name="Image8" width="142" height="31" border="0" id="Image8" /></a></td>
<td width="145"><a href="photos.html" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image9','','images/index_08_1.png',1)"><img src="images/index_08_1.png" name="Image9" width="161" height="31" border="0" id="Image9" /></a></td>
<td width="145"><a href="contact.html" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image10','','images/index_09_1.png',1)"><img src="images/index_09.png" name="Image10" width="131" height="31" border="0" id="Image10" /></a></td>
</tr>
<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}
{elseif $theme.pageType == 'progressbar'}
<div id="gsHeader">
<img src="{g->url href="images/galleryLogo_sm.gif"}" width="107" height="48" alt=""/>
</div>
{g->theme include="progressbar.tpl"}
{else}
<div id="gsHeader">
<a href="{g->url}"><img src="{g->url href="images/galleryLogo_sm.gif"}"
width="107" height="48" alt=""/></a>
</div>

<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"}
{/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}

{* Put any debugging output here, if debugging is enabled *}
{g->debug}
<td colspan="5" align="center"><span class="style3">&copy; 2008 Daniel Anderson.</span></td>
</tr>
</table>
</body>
</html>

The page i am trying to embed gallery into is here

Any help would be greatly appreciated.

Thanks in advance.
Daniel

 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 27300
Posted: Thu, 2008-10-02 00:34

Your code your quted has:

{* Include this theme's style sheet *}
<link rel="stylesheet" type="text/css" href="{g->theme url="theme.css"}"/>
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;
}

You dont start the javascript tag. yet you end it lower in the page.
Also when adding JS code to templates you need to read up on:
http://www.smarty.net/manual/en/language.function.literal.php
or
http://www.smarty.net/manual/en/language.function.ldelim.php

Dave

_____________________________________________
Blog & G2 || floridave - Gallery Team