Page 1 of 1

jQuery and prettyPhoto help

Posted: Sat Mar 06, 2010 1:21 am
by Mangek
Hey guys n girls,

I'm trying to replace lightbox with prettyPhoto but when the javascript is called I get a smarty error:
Fatal error: Smarty error: [in /home/althalus/dirgefornovember/s9y/templates/oneroom/index.tpl line 185]: syntax error: unrecognized tag: $("a[rel^='prettyPhoto']").prettyPhoto(); (Smarty_Compiler.class.php, line 446) in /home/.kiwi/althalus/dirgefornovember/s9y/bundled-libs/Smarty/libs/Smarty.class.php on line 1093
I believe read somewhere that for things like these to work I need to register something, somewhere (I'm not sure where I read it or in what context).

Anywho, I tried installing the jQuery plugin, thinking that it may have something to do with fixing the problem, but still get the above error. (Isn't there a config option for the jQuery plugin? I don't see it if there is).

Any help with this would be awesome! :) (And if a prettyPhoto-plugin could be made, like with lightbox, that would be superawesome! :D )

Re: jQuery and prettyPhoto help

Posted: Sat Mar 06, 2010 1:20 pm
by onli
How exactly did you try to insert prettyPhoto? :)
sincerely

Re: jQuery and prettyPhoto help

Posted: Sat Mar 06, 2010 2:55 pm
by Mangek
Hey onli,

I used the scripts from here:
<script src="js/jquery.js" type="text/javascript" charset="utf-8"></script>
<link rel="stylesheet" href="css/prettyPhoto.css" type="text/css" media="screen" charset="utf-8" />
<script src="js/jquery.prettyPhoto.js" type="text/javascript" charset="utf-8"></script>
And this bit, just before my closing </body>:
<script type="text/javascript" charset="utf-8">
$(document).ready(function(){
$("a[rel^='prettyPhoto']").prettyPhoto();
});
</script>
It's the last bit there that's causing the error. Sorry I wasn't more clear in my first post. :)

Re: jQuery and prettyPhoto help

Posted: Sat Mar 06, 2010 4:05 pm
by onli
Ah, ok.
If you wrap {literal} {/literal} around the script-part, the error should go away.

PS: You don't have to insert the jquery.js manually if you install the jQuery-Plugin.

Re: jQuery and prettyPhoto help

Posted: Sat Mar 06, 2010 5:48 pm
by Mangek
Hey onli,

Thanks a lot, that did the trick! :) :)