Take the 2-minute tour ×
ExpressionEngine® Answers is a question and answer site for administrators, end users, developers and designers for ExpressionEngine® CMS. It's 100% free, no registration required.

I have run into a strange situation where a Backward Slash \ is being added to the end of each sentence in the search excerpt field just before each period. For example:

Lorem ipsum dolor sit amet, consectetur adipiscing elit\. Vivamus et sodales nunc\. Aenean sit amet massa at ante porttitor euismod a sit amet ante\. Morbi vitae est eu ante rutrum cursus sit amet nec nunc\. Aliquam erat volutpat\. Curabitur eget odio arcu, vel fermentum felis\. Sed pellentesque lorem ac nibh…

It happens no matter what type of field I have set as the excerpt (RTE or Textarea).

The search results template is fairly straightforward:

<div class="content group">
        <h1>Resultados de la búsqueda</h1>

        <div class="article primary d-all">

        <p>You searched for <strong>{exp:search:keywords}</strong> 
        and got {exp:search:total_results}{total_results}{/exp:search:total_results} result{if "{exp:search:total_results}" != 1}s{/if}.</p>
        <ul>
            {exp:search:search_results}
            <li><a href="{site_url}{auto_path}">{title}</a> {excerpt}</li>
            {/exp:search:search_results}
        </ul>
        </div>
    </div>

The slash is not being displayed within the entry template, just in the search results template.

Any thoughts would be appreciated.

Thanks!

Updated to show text with slashes. It was removed by the SE template for some reason.

share|improve this question
    
There don't appear to be any backslashes or forward slashes in your example text. Can you correct it so that it appears as you're seeing it? –  Isaac Raway Dec 27 '12 at 2:13
    
The slashes were removed by the SE template. I have fixed it. Thanks for bringing that to my attention. You can also go here: fuentelatina.org and do a search for Iran to see it in action. –  Brad Hopkins Dec 27 '12 at 2:44
    
Do you have any non-core extensions installed? Also, are there any template tags around this tag or is this at the root of the template? Is this in an embed, snippet, stash, or morsel perhaps? –  Isaac Raway Dec 27 '12 at 4:06
    
I have the following extensions installed: CE Image - AWS, Channel Files Extension, Playa and VZ URL. The above code is at the root of the template. –  Brad Hopkins Dec 27 '12 at 14:20
add comment

1 Answer 1

This is a bug (see bug report #19102). It's because the excerpt is being filtered through PHP's preg_quote(). You can either remove the preg_quote() from line 1507 of mod.search.php for now and just leave it as $excerpt and hope you don't have anything that looks like a replacement pattern in your search excerpts, or just show the custom fields themselves in the template and limit the text with a character-limiter plugin.

share|improve this answer
    
Awesome. Thanks for the insight. I decided to use the custom fields themselves. Worked like a charm. –  Brad Hopkins Dec 27 '12 at 17:35
1  
Brad - please remember to accept Kevin's answer as correct. Kevin - can you post a link to the relevant bug report so folks can track this issue? –  Derek Hogue Dec 27 '12 at 19:43
3  
Sure here you go, I submitted the bug after I posted the answer. support.ellislab.com/bugs/detail/19102 –  Kevin Cupp Dec 27 '12 at 20:32
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.