My fieldframe matrix is called {page_images}, and within {page_content} the client simply inserts {image_x} where x is the row they want to reference in the fieldframe matrix…
I’ve been using the LG Replace, FF Matrix combo for image uploads into content areas on the last few sites I’ve done. It really is a powerful way to give clients more control over image placement.
In the {content} field I’ve put in the {product_list} tag to be replaced, but on output the tag is not replaced as expected.
Am I doing something wrong?
Is it because my {content} field is Textile format?
I have 2 custom fields, {main_content} and {main_extended}. I’m using LG Replace, and FF Matrix with my {main_content} and {main_extended} custom fields set to use the JM WYMEditor fieldframe (http://expressionengine.com/forums/viewthread/125927/).
Here’s the issue: If {main_extended} is set to use WYMEditor, the whole page crashes and burns quite spectacularly: http://www.easterlydev.com/about/community-involvement/. It does the same if both {main_content} and {main_extended} use WYMEditor. However, if I set the field type of {main_extended} to straight textarea, all is well.
With the help of Kurt Deutscher (thanks Kurt!) we were able to determine that SOMETHING doesn’t like a closing curly brace in the {main_extended} custom field. Whether that something is LG Replace or WYMEditor, I’m not sure. I’ve posted this in both the LG Replace thread and the JM WYMEditor thread in hopes that someone cleverer than me can figure this out.
Here’s how I got this extension to work with the TEH Textile extension and the Textile plugin.
Thanks for this excellent post, which pointed the way for me. However, my experience was slightly different (and simpler). I’m using the Textile plugin (v.1.1.1 (2.0.0 r2779)) and Textile Editor Helper (TEH) extension 1.2. Maybe the later version of TEH explains the difference in my experience, but I do not need to wrap parentheses or “=” around my needle to get it to work.
However, by viewing page source I could see that Textile was indeed converting curly braces to entities (as you said). So, rather than your 3 replacement lines for the plugin code (around line 177), I used only one, built on your model, which looks for the HTML curly brace entities 123 and 125 (each preceded by “&#” and followed by “;”) and turns them back into the actual braces, as you do. (I’d post the actual code line, but I can’t figure out how to get this forum to let me post entities that display literally. You get the idea.)
And with that, the LG Replace plugin seems to work just fine with Textile, using a plain old LG Replace needle like {images1}—no “()” or “==” wrapped around it.
Edit: If you want to be able to wrap a div or whatever around your needle when it’s inserted, you may want to keep the third line of the original plugin code mod, the one that strips Textile’s paragraph tags from around the needle.
However, by viewing page source I could see that Textile was indeed converting curly braces to entities (as you said). So, rather than your 3 replacement lines for the plugin code (around line 177), I used only one, built on your model, which looks for the HTML curly brace entities 123 and 125 (each preceded by “&#” and followed by “;”) and turns them back into the actual braces, as you do. (I’d post the actual code line, but I can’t figure out how to get this forum to let me post entities that display literally. You get the idea.)
Here’s an example of the code Spacewalk is talking about in the previous post - I used this simple solution and it worked for me too. (note, remove the space between & #123 and & #125 in the example below. The space is only there because otherwise the forum marks them up as { }‘s.)
// reset lg_replace tags when using extension and plugin $text = str_replace(array('& #123;', '& #125;'), array('{', '}'), $text);
Edit: If you want to be able to wrap a div or whatever around your needle when it’s inserted, you may want to keep the third line of the original plugin code mod, the one that strips Textile’s paragraph tags from around the needle.
I may need to modify this plugin to strip paragraph tags from around the needle when using XHTML. Would love to find a way to get XHTML to ignore needles when they’re the only thing on a line - sometimes I’m replacing needles with a div and a bunch of markup that I don’t want wrapped inside a ‘p’ tag.
Here’s an example of the code Spacewalk is talking about in the previous post - I used this simple solution and it worked for me too. (note, remove the space between & #123 and & #125 in the example below. The space is only there because otherwise the forum marks them up as { }‘s.)
// reset lg_replace tags when using extension and plugin $text = str_replace(array('& #123;', '& #125;'), array('{', '}'), $text);
Awesome, this solved my problems with the textile formatting too. Many thanks!
Wow this is brilliant. It should be noted (if it hasn’t already) that you cannot put the exp:lg_replace:haystack tag inside your exp:weblog:entries loop. You need to surround the entire loop with it.
I’d LOVE the option of stripping paragraph tags around the needle when the field is formatted XHTML (which, for me, it’s almost always going to be when using this plugin). Right now I’m using it to inject an list of other entries into the page and the spacing issues caused by the extra paragraph tag is a problem.
I was having trouble with using both lg_replace and textile, and tried following steps outlined by bhggraphicdesign but with no look.
I’ve just made the most obvious and simple change and it all works fine. Make sure that textile formatting takes place after lg_replace has done it’s replacing. E.g.
I was having trouble with using both lg_replace and textile, and tried following steps outlined by bhggraphicdesign but with no look.
I’ve just made the most obvious and simple change and it all works fine. Make sure that textile formatting takes place after lg_replace has done it’s replacing. E.g.
Wow seems this little bugger is still useful for quite a few people.
I actually need to use it in my current project so I might give the code a once over to see if I can *easily* add any improvements.
LG Replace is still the only/easiest? way to include images within the text flow of an entry. So given the comment above (and 754 downloads at this time), I’m wondering why this is not available on the Levi Graham addon page or had any updates/improvements.
I may need to modify this plugin to strip paragraph tags from around the needle when using XHTML. Would love to find a way to get XHTML to ignore needles when they’re the only thing on a line - sometimes I’m replacing needles with a div and a bunch of markup that I don’t want wrapped inside a ‘p’ tag.
Masuga, did you ever get around to a resolution for those dreaded ‘p’ tags?