jQuery and prettyPhoto help

Creating and modifying plugins.
Post Reply
Mangek
Regular
Posts: 85
Joined: Tue Jun 24, 2008 1:08 am
Location: Sweden
Contact:

jQuery and prettyPhoto help

Post 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 )
onli
Regular
Posts: 3044
Joined: Tue Sep 09, 2008 10:04 pm
Contact:

Re: jQuery and prettyPhoto help

Post by onli »

How exactly did you try to insert prettyPhoto? :)
sincerely
Mangek
Regular
Posts: 85
Joined: Tue Jun 24, 2008 1:08 am
Location: Sweden
Contact:

Re: jQuery and prettyPhoto help

Post 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. :)
onli
Regular
Posts: 3044
Joined: Tue Sep 09, 2008 10:04 pm
Contact:

Re: jQuery and prettyPhoto help

Post 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.
Mangek
Regular
Posts: 85
Joined: Tue Jun 24, 2008 1:08 am
Location: Sweden
Contact:

Re: jQuery and prettyPhoto help

Post by Mangek »

Hey onli,

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