4 of 4
4
LG Replace - A different kind of find and replace *NEW*
Posted: 16 March 2010 12:14 PM   [ Ignore ]   [ # 55 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  653
Joined  07-18-2006

Just wanted to put in another “thank you” for a very useful plug-in. I was trying to get reeposition to work in a conditional and having no luck.  Fired this up and no problems - great plug-in - and it looks like I’m only scratching the surface regarding how to use it in a site!

Edit: turns out I’m having some weirdnesses using it in conditionals that I don’t have time now to track down.  So don’t quote me on that part wink

Profile
 
 
Posted: 23 March 2010 05:24 AM   [ Ignore ]   [ # 56 ]  
Sr. Research Associate
Avatar
RankRankRankRankRank
Total Posts:  4003
Joined  05-13-2004
Casey Reid - 05 August 2009 10:41 PM

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.

This sounds exactly like what I want to do with a current site. Does this work when inserting the FF Matrix combo into a wygwam field?

 Signature 

web: Caffeine Creations twitter @CS_sean

Profile
 
 
Posted: 23 March 2010 06:29 AM   [ Ignore ]   [ # 57 ]  
Sr. Research Associate
Avatar
RankRankRankRankRank
Total Posts:  4003
Joined  05-13-2004

Yes this is working great. However wygwam is inserting p tags around the needle. Anyone know a way to remove those p tags?

 Signature 

web: Caffeine Creations twitter @CS_sean

Profile
 
 
Posted: 23 March 2010 09:47 AM   [ Ignore ]   [ # 58 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1336
Joined  01-24-2006

Quick note to say I have rewritten this plugin for EE2. In the short term you can grab it from Github until I move it to my new site.

Link: http://github.com/newism/nsm.replace.ee_addon

 Signature 

EE-Garage.com - All my ExpressionEngine 2 Addons!


EE2 - NSM Better Meta - SEO Meta & XML Sitemap Generator
EE2 - NSM Live Look - Real entry previews


Newism - Newcastle - ExpressionEngine Experts

Profile
 
 
Posted: 28 April 2010 05:06 PM   [ Ignore ]   [ # 59 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  146
Joined  03-24-2007

Miraculous. Not only does this:

<?php
    
/* PHP Parse on Input */
    
global $DB;
    
$sql "SELECT title, field_id_26
            FROM exp_weblog_titles t JOIN exp_weblog_data d ON t.entry_id = d.entry_id
            WHERE t.weblog_id = 8 AND t.status='open'"
;
    
$links $DB->query($sql);
    
$linkList '';
    foreach(
$links->result as $link{
        $linkList 
.= $link['title''|';
    
}
?>
{exp
:lg_replace:haystack needles="<?php echo $linkList; ?>|vanity-url"}
    {exp
:weblog:entries weblog="site-specific-content" dynamic="off" search:site-key="={embed:site-key}" search:name="{embed:name}"}
        {detail}
    {
/exp:weblog:entries}
    <?php
    
foreach($links->result as $link{ ?>
        {exp
:lg_replace:replacement needle="<?php echo $link['title']; ?>"}
            <?php 
echo $link['field_id_26']?>
        {
/exp:lg_replace:replacement}
    <?php } ?>
    {exp
:lg_replace:replacement needle="vanity-url"}
        {segment_1}
    {
/exp:lg_replace:replacement}
{
/exp:lg_replace:haystack} 

Appear to be working, but it replaces the link list values first, and then replaces {vanity-url} within them. Not sure if there’s a more elegant way than PHP set to process on input, but am thrilled this worked so well.

 Signature 

.  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .
Mark J. Reeves
http://markjreeves.com
http://devot-ee.com/developers/ee/mark-j-reeves/
@circa1977

Profile
 
 
Posted: 01 May 2010 11:08 AM   [ Ignore ]   [ # 60 ]  
Lab Assistant
RankRank
Total Posts:  102
Joined  06-27-2009

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…

Profile
 
 
Posted: 01 May 2010 01:17 PM   [ Ignore ]   [ # 61 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  404
Joined  11-22-2006

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

 Signature 

pfweb.co.uk

Profile
 
 
Posted: 01 May 2010 06:49 PM   [ Ignore ]   [ # 62 ]  
Lab Assistant
RankRank
Total Posts:  102
Joined  06-27-2009
Paul Frost (orienteer) - 01 May 2010 05:17 PM

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?

Profile
 
 
Posted: 01 May 2010 06:54 PM   [ Ignore ]   [ # 63 ]  
Lab Assistant
RankRank
Total Posts:  102
Joined  06-27-2009

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.

Profile
 
 
Posted: 02 May 2010 03:15 AM   [ Ignore ]   [ # 64 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  404
Joined  11-22-2006

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)”

 Signature 

pfweb.co.uk

Profile
 
 
Posted: 05 July 2010 07:42 AM   [ Ignore ]   [ # 65 ]  
Lab Assistant
RankRank
Total Posts:  115
Joined  11-13-2008

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 ?

Profile
 
 
Posted: 05 July 2010 07:58 AM   [ Ignore ]   [ # 66 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1908
Joined  09-16-2004
journalistone - 05 July 2010 11:42 AM

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/

 Signature 

Peace, e-man.
stookstudio.com, websites built with care and web standards. I’m @erwinheiser

Profile
 
 
Posted: 05 July 2010 08:03 AM   [ Ignore ]   [ # 67 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  446
Joined  01-14-2006

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

 Signature 

Weblog | @iain | Taxonomy for EE2

Profile
 
 
Posted: 05 July 2010 08:24 AM   [ Ignore ]   [ # 68 ]  
Lab Assistant
RankRank
Total Posts:  115
Joined  11-13-2008

Iain !!! Thank you.

I feel like a complete ditz!

20-20 vision with hindsight !

Thank you.

Profile
 
 
Posted: 08 July 2010 11:02 AM   [ Ignore ]   [ # 69 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  123
Joined  05-06-2010

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

Profile
 
 
Posted: 08 July 2010 12:10 PM   [ Ignore ]   [ # 70 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  575
Joined  03-18-2007

Leevi’s releasing a 2.0 version shortly.

 Signature 

Follow me on Twitter: twitter.com/mrw

Note: I used to be slapshotw on this forum.

Profile
 
 
   
4 of 4
4