2 of 2
2
Plugin: Find and Replace Plus
Posted: 01 December 2009 01:45 PM   [ Ignore ]   [ # 19 ]  
Grad Student
Rank
Total Posts:  49
Joined  12-22-2005
Laisvunas - 24 October 2009 11:10 AM

Maybe Oliver Heine’s Strip Linebreaks plugin can help you?

Brilliant, thank you—the plugin worked perfectly for my needs.

Profile
 
 
Posted: 02 December 2009 06:05 AM   [ Ignore ]   [ # 20 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1156
Joined  02-02-2007

Hi ee_sa,

Your code should be

{exp:replace_plus find=":LD:exp:search:keywords:RD:" replace="<h1>:LD:exp:search:keywords:RD:</h1>" parse="inward"}
{
/exp:replace_plus} 
 Signature 

Full list of add-ons here

Child Categories
Browser Sniff
Category Id
Entries Number

Profile
 
 
Posted: 14 April 2010 10:08 AM   [ Ignore ]   [ # 21 ]  
Lab Assistant
RankRank
Total Posts:  268
Joined  06-26-2008

Hi Laisvunas,
I’d had trouble with Low’s find and replace plugin, so I thought I’d give this one a whirl. It’s not working at all! Here’s my code:

{exp:html_strip keep="strong,em,p,h2,ul,ol,li,a,div"}{exp:replace_plus find="<div class=QUOTEimagerightQUOTE.*?div>|<div class=QUOTEimagecenterQUOTE.*?div>|<div class=QUOTEimageleftQUOTE.*?div>" replace="" regex="yes" multiple="yes"}{article_body}{/exp:replace_plus}{/exp:html_strip} 

What am I doing wrong??
Thank you!

Profile
 
 
Posted: 14 April 2010 01:09 PM   [ Ignore ]   [ # 22 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1156
Joined  02-02-2007

Hi,

Two things I find wrong in your code:

1) If you need to change something with empty string, you should not use “replace” parameter;

2) you should use not QUOTE but :QUOTE:

 Signature 

Full list of add-ons here

Child Categories
Browser Sniff
Category Id
Entries Number

Profile
 
 
Posted: 14 April 2010 01:17 PM   [ Ignore ]   [ # 23 ]  
Lab Assistant
RankRank
Total Posts:  268
Joined  06-26-2008

Thank you! I changed my code to this:

{exp:replace_plus find="<div class=:QUOTE:articleside:QUOTE:.*?div>|<div class=:QUOTE:imageright:QUOTE:.*?div>|<div class=:QUOTE:imagecenter:QUOTE:.*?div>|<div class=:QUOTE:imageleft:QUOTE:.*?div>" regex="yes" multiple="yes"}{article_body}{/exp:replace_plus} 

And it works…except, as you can see, I added an additional parameter including the “articleside” div. The plugin is replacing all of the divs except for this one. Is there a reason for this? You can see this in action here: http://uvamagazine.org/mobile/article/this_old_academical_village/

The “articleside” div surrounds the paragraphs starting with “Handyman’s Delight”

Profile
 
 
Posted: 14 April 2010 01:26 PM   [ Ignore ]   [ # 24 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1156
Joined  02-02-2007

Hi,

you might need to escape quotes:

{exp:replace_plus find="<div class=\:QUOTE:articleside\:QUOTE:.*?div>|<div class=\:QUOTE:imageright\:QUOTE:.*?div>|<div class=\:QUOTE:imagecenter\:QUOTE:.*?div>|<div class=\:QUOTE:imageleft\:QUOTE:.*?div>" regex="yes" multiple="yes"}{article_body}{/exp:replace_plus} 

In case your regex pattern gets complicated you would better to check if it works in some program such as RegexBuddy, or in pure PHP and only then use it as plugin’s parameter.

 Signature 

Full list of add-ons here

Child Categories
Browser Sniff
Category Id
Entries Number

Profile
 
 
Posted: 16 April 2010 06:32 PM   [ Ignore ]   [ # 25 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  526
Joined  09-06-2006

Is there a way to do a wildcard? I’m using this to strip out LG Replace tags in the meta description and it would be great if I could replace a number with a wildcard. Currently I’m specifying:

{exp:replace_plus find="'|:QUOTE:|:LD:media_1:RD:|:LD:media_2:RD:|:LD:media_3:RD:|:LD:media_4:RD:|
:LD:media_5:RD:|:LD:media_6:RD:|:LD:media_7:RD:|:LD:media_8:RD:" 

so you see how a wildcard would be quite handy.

 Signature 

Kyle Summer | smartpill design | New Haven, CT |  twitter

Profile
 
 
Posted: 27 April 2010 05:15 PM   [ Ignore ]   [ # 26 ]  
Grad Student
Rank
Total Posts:  63
Joined  08-05-2006

I’d like to find all occurrences of the titles of a weblog. Can I populate the find parameter via an embedded template (or some other method) that creates a string something like “title1|title2|title3|title4″?

I tried, but didn’t have any luck.

I’m pondering ways to build an illustrated glossary that is easy for the client to maintain and whose terms can be automatically converted to links in any body of text.

Any advice would be appreciated.

Profile
 
 
Posted: 29 April 2010 03:04 AM   [ Ignore ]   [ # 27 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1156
Joined  02-02-2007

Can I populate the find parameter via an embedded template (or some other method) that creates a string something like “title1|title2|title3|title4″?

You cannot populate parameter via an embedded template because embedded template is pased after the main template.

To create the string like “title1|title2|title3|title4″ the plugin Value Aggregator might be helpful.

 Signature 

Full list of add-ons here

Child Categories
Browser Sniff
Category Id
Entries Number

Profile
 
 
Posted: 02 May 2010 02:27 AM   [ Ignore ]   [ # 28 ]  
Grad Student
Rank
Total Posts:  63
Joined  08-05-2006

Hi Laisvunas,

Thanks, but Value Aggregator doesn’t seem to be applicable my case.  I would like to find all the text that occurs in several custom fields of one weblog that match the titles of a second weblog. 

I tried Fresh Variables but that didn’t seem to work.  Making a Fresh Variable to create the list of titles of the second weblog (title1|title2|title3|title4|...) was no problem (I used the query module to create the list of 150 titles).  But I couldn’t get the fresh variable to work as a find parameter in a single-entry template for the first weblog:

{exp:replace_plus find=”{myFreshVariable}”}

Is this still an issue of parsing order? or maybe my implementation?  Any suggestions?

Thanks again.

Profile
 
 
Posted: 07 May 2010 07:31 AM   [ Ignore ]   [ # 29 ]  
Sr. Research Associate
Avatar
RankRankRankRankRank
Total Posts:  4003
Joined  05-13-2004

Hi,

I’m using your other plugin Entry Categories with the following code

<p>{exp:entry_cats entry_id="{entry_id}" backspace="2"}
    
<a href="{path='home/C/'}">{level1_category0_cat_name}</a> >
{/exp:entry_cats}</p

Which will output a list of subcategories with > separating them. However On the last category I don’t want the > to be there - how would I remove only the last instance here? Basically I’m looking to replicate the backspace parameter. Thank you for your time.

 Signature 

web: Caffeine Creations twitter @CS_sean

Profile
 
 
Posted: 08 May 2010 02:26 AM   [ Ignore ]   [ # 30 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1156
Joined  02-02-2007

Hi Sean,

You can avoid outputting unneded “>” symbols by using conditionals:

{exp:entry_cats entry_id="{entry_id}" backspace="2"}
  {level0_category0_cat_name}  {if level1_category0_cat_name} 
{level0_category0_cat_name}{/if}
{
/exp:entry_cats} 
 Signature 

Full list of add-ons here

Child Categories
Browser Sniff
Category Id
Entries Number

Profile
 
 
Posted: 09 May 2010 06:07 PM   [ Ignore ]   [ # 31 ]  
Sr. Research Associate
Avatar
RankRankRankRankRank
Total Posts:  4003
Joined  05-13-2004

Hmmm that didn’t work but I will try a couple of other conditionals.

 Signature 

web: Caffeine Creations twitter @CS_sean

Profile
 
 
   
2 of 2
2