We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

syntax error when using replace plugin

Development and Programming

avroo's avatar
avroo
164 posts
17 years ago
avroo's avatar avroo

I need to add a JS script function to my images (custom field), so I tried to use the replace plugin.

Replace this: width=”100”

with this: with=”100” onmouseover=”zxcZoom(this,null,140,null,15,’C’);” onMouseOut=”zxcZoom(this);”

Problem: it breaks up because of the single quote at argument 6 (‘C’) in zxcZoom.

I’ve tried adding single quotes like this:

find=’width=…etc’, but that doesn’t work. NOTE: the single quote in zxcZoom is required (object needed).

Anybody that can help me out here? Thanks!

       
Robin Sowell's avatar
Robin Sowell
13,160 posts
17 years ago
Robin Sowell's avatar Robin Sowell

This may be a third party plugin and I’ll end up shifting it to the ‘plugins’ forum. However, let’s take a look at the code your using in the template, see if we spot anything obvious. Also- note that the docs suggest using quote tags instead of double quotes- which may make a difference.

       
avroo's avatar
avroo
164 posts
17 years ago
avroo's avatar avroo

what kind of quote tags do you mean?

I am using this code in my template:

{exp:replace find='width="100"' replace='width="100" onmouseover="alert('test');" onMouseOut="zxcZoom(this);” '} {image} {/exp:replace}

and I’ve tried:

{exp:replace find='width="100"' replace='width="100" onmouseover="alert(\'test{{SINGLEQUOTE:d14a3b56ed57f53400f3b4a001e5a655}});" onMouseOut="zxcZoom(this);” '} {image} {/exp:replace}

both don’t work..

       
Robin Sowell's avatar
Robin Sowell
13,160 posts
17 years ago
Robin Sowell's avatar Robin Sowell

I don’t have the plugin installed, so can’t do a quick test. What happens if you use double quotes and then the QUOTE tag to denote double quotes inside it? I think that’s what the docs are suggesting.

       
avroo's avatar
avroo
164 posts
17 years ago
avroo's avatar avroo

I get something like this:

width=”100” onmouseover=”alert( height=”100” >

you can see where it breaks..

what do you mean with these “quote tags” ?

       
Robin Sowell's avatar
Robin Sowell
13,160 posts
17 years ago
Robin Sowell's avatar Robin Sowell

Keep in mind- this is a third party plugin, so not officially supported. And I don’t have it installed to test. But according to the docs:

If you want to use a double quote in a parameter value, use the string “QUOTE” instead.

So going by that, I’d be trying something like:

{exp:replace find="width=QUOTE100QUOTE" replace="width=QUOTE100QUOTE etc...

It’s the first thing I’d try. And if that doesn’t work, the plugin author may have a better idea. I’ll go ahead and shift this down to the third party plugin forums- you’ll likely get a response from folks using the plugin there.

Make sense?

       
avroo's avatar
avroo
164 posts
17 years ago
avroo's avatar avroo

ok thanks, where can I find this plugin?

       
Low's avatar
Low
407 posts
17 years ago
Low's avatar Low
ok thanks, where can I find this plugin?

Right here

       

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.