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

LG Replace - A different kind of find and replace *NEW*

Development and Programming

JmanPro's avatar
JmanPro
49 posts
15 years ago
JmanPro's avatar JmanPro

What an amazing plugin! Thank you for something I’ve been needing!!!! For some reason, I seem to be missing how variables work with this plugin. Say I have {photos_12} in a weblog entry. The # 12 is dynamic, and will changed based on what photo needs to be added. I put in bold the problem areas for me. (What to put here?) Currently my code looks like:

{embed="global_embeds/header"}

    {exp:nsm_replace:haystack}
        
        {exp:channel:entries weblog="pages"}
            
            {page_body}
            
        {/exp:channel:entries}
            
        {exp:nsm_replace:content needle="photo_[b]What to put here?[/b]"}

            [b]What to put here[/b]

        {/exp:nsm_replace:content}    
            
    {/exp:nsm_replace:haystack}

{embed="global_embeds/footer"}

Hope that makes sense…

       
Paul Frost (orienteer)'s avatar
Paul Frost (orienteer)
389 posts
15 years ago
Paul Frost (orienteer)'s avatar Paul Frost (orienteer)

I think you will find the answer in this thread, if I’ve understood your question correctly.

       
JmanPro's avatar
JmanPro
49 posts
15 years ago
JmanPro's avatar JmanPro
I think you will find the answer in this thread, if I’ve understood your question correctly.

Thanks a bunch for the link! It gave me some more ideas. However, I think I know how to explain what I am needing to do a little bit better. If I am understanding correctly, this tutorial relies on the assumption that there are a fixed number of images. I will be using this on various pages, and one page might need 10 images while another might only need 2.

Ideally I would like to call up my images doing something like {image_1_left} or {image_1_left_large}. I would use img resizer to take care of the necessary processing, etc. So my issue is how would I do this without a set number of images? Is it possible with this plugin?

       
JmanPro's avatar
JmanPro
49 posts
15 years ago
JmanPro's avatar JmanPro

Ooh, maybe I have a solution. I could use Playa to select the images I want to use with a certain channel entry, and then count the # of rows in the Playa field, use a loop, etc. The thing it would NOT take care of would be if I wanted to specify float left or right on the images, etc.

       
Paul Frost (orienteer)'s avatar
Paul Frost (orienteer)
389 posts
15 years ago
Paul Frost (orienteer)'s avatar Paul Frost (orienteer)

I use it when there are a variable number of images and the ability to choose alignment and size. See “Adding images to entries (an easy way)”

       
journalistone's avatar
journalistone
78 posts
15 years ago
journalistone's avatar journalistone

Hello,

I am actually looking for something that replaces dynamic text content with an image.

For example, I have a list of features for products and where the feature says ‘yes’, I want to replace this with an image of a ‘tick’ and when ‘no’ I want to replace that with an image of a ‘cross’.

Because my custom field for the yes/no is driven by a select list with one custom_field_name, I am not sure whether this Plugin works?? Hopefully my query makes sense here. From my understanding this plugin works off the custom_field name or tag_name and not off the actual dynamic output of the tag???

I am looking for something that basically finds a word ‘yes’ and ‘no’ and outputs an image instead. Does this plugin do that ?

       
e-man's avatar
e-man
1,816 posts
15 years ago
e-man's avatar e-man
I am looking for something that basically finds a word ‘yes’ and ‘no’ and outputs an image instead. Does this plugin do that ?

You’re probably better off with Find/Replace then: http://devot-ee.com/add-ons/find-and-replace/

       
iain's avatar
iain
317 posts
15 years ago
iain's avatar iain

Can you not name the images yes.gif and no.gif? and just use {field}.gif in your template?

       
journalistone's avatar
journalistone
78 posts
15 years ago
journalistone's avatar journalistone

Iain !!! Thank you.

I feel like a complete ditz!

20-20 vision with hindsight !

Thank you.

       
insiteadvice's avatar
insiteadvice
68 posts
15 years ago
insiteadvice's avatar insiteadvice

anyone know of a similar solution that works with EE 2?

       
Matt Weinberg's avatar
Matt Weinberg
489 posts
15 years ago
Matt Weinberg's avatar Matt Weinberg

Leevi’s releasing a 2.0 version shortly.

       
First 3 4 5

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.