Add .js (Page Peel Off Script) to album

fabiansfx

Joined: 2009-12-11
Posts: 6
Posted: Fri, 2009-12-11 20:33

For a special website feature I need a page peel off effect which I found on this site:

http://www.marcofolio.net/webdesign/create_a_peeling_corner_on_your_website.html

I cannot find out on which page to embed the code so the peel off effect shows on all pages.

Can someone please help me?

Thanks!

Fabian

 
nivekiam
nivekiam's picture

Joined: 2002-12-10
Posts: 16504
Posted: Fri, 2009-12-11 22:08

Don't know which theme you're using. But if using Matrix or most standard themes, you'd probably need to add the code to /themes/YourTheme/templates/local/theme.tpl

Be sure to wrap the javascript in {literal} tags:

{literal}

JAVASCRIPT HERE

{/literal}

I bolded the local directory above for you to take note that you should create that directory and copy the theme.tpl file into that directory and make your changes there. See this for more info:
http://codex.gallery2.org/Gallery2:Editing_Templates
____________________________________________
Like Gallery? Like the support? Donate now!!! See G2 live here

 
fabiansfx

Joined: 2009-12-11
Posts: 6
Posted: Fri, 2009-12-11 22:13

ok!!
Great!

I understand the Local part, but the placing of the script is not important within the theme.tpl?

 
nivekiam
nivekiam's picture

Joined: 2002-12-10
Posts: 16504
Posted: Fri, 2009-12-11 22:19

Think of theme.tpl as your "normal" .html page. That's where the head and body of the html page is defined. So, I'd probably just follow the instructions on that other page. Honestly, I'd probably see if I could put the JS into a separate .js file and load that so you're not re-downloading all of that JS with every single page load.

But if you do put the JS in the smarty based .tpl page you'll need to be sure to wrap it with {literal} tags.
____________________________________________
Like Gallery? Like the support? Donate now!!! See G2 live here

 
fabiansfx

Joined: 2009-12-11
Posts: 6
Posted: Fri, 2009-12-11 22:29

Thanks :-).

I thought it was just simple copy paste, but those {literal} tags must be more like:

{if $theme.pageType == 'album' || $theme.pageType == 'photo'}
<script src="peel/peel.js" type="text/javascript"></script>

But I have to spend more time on this.. tis is completely new to me :-).

 
nivekiam
nivekiam's picture

Joined: 2002-12-10
Posts: 16504
Posted: Fri, 2009-12-11 22:40

See this for more info on the literal tag:
http://www.smarty.net/manual/en/language.function.literal.php
____________________________________________
Like Gallery? Like the support? Donate now!!! See G2 live here

 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 27300
Posted: Fri, 2009-12-11 22:49

You don't need literal tags if youy are just adding:
<script src="peel/peel.js" type="text/javascript"></script>

But in your above example for only adding the code the albums and photo pages then you need to close the if:
{/if}

Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team

 
fabiansfx

Joined: 2009-12-11
Posts: 6
Posted: Sun, 2009-12-13 16:37

hmmm.. I must be missing something.

I cannot get this simple thing to work...
Is there anybody who uses a similar script?

 
nivekiam
nivekiam's picture

Joined: 2002-12-10
Posts: 16504
Posted: Sun, 2009-12-13 16:59

A link to your site where you're trying to get this working would be helpful if you need help with this.
____________________________________________
Like Gallery? Like the support? Donate now!!! See G2 live here

 
fabiansfx

Joined: 2009-12-11
Posts: 6
Posted: Sun, 2009-12-13 19:21

I'm working on this page:

http://impact-sfx.com/media/main.php

Long from perfect, but it's a start :-)

 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 27300
Posted: Tue, 2009-12-15 01:25

Edit the js file

jaaspeel.ad_url = escape('http://www.marcofolio.net/other/bloggers_unite_-_blog_against_abuse.html');

jaaspeel.small_path = 'http://EXAMPLE.com/gallery2/peel/small.swf';
jaaspeel.small_image = escape('http://EXAMPLE.com/gallery2/peel/small.jpg');
jaaspeel.small_width = '100';
jaaspeel.small_height = '100';
jaaspeel.small_params = 'ico=' + jaaspeel.small_image;

jaaspeel.big_path = 'http://EXAMPLE.com/gallery2/peel/large.swf';
jaaspeel.big_image = escape('http://EXAMPLE.com/gallery2/peel/large.jpg');

Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team

 
fabiansfx

Joined: 2009-12-11
Posts: 6
Posted: Tue, 2009-12-15 22:12

Thank you all!!

It finally worked!
The main problem in the end was: cache... not only the templatecache settings in Gallery2, but also the cache in my local browser did some strange things...

Just to see what happenes, I tried the same thing on Safari in 'private mode / no cache' and it worked like a charm!

Thank you all for helping me out!