3

Is there an add-on which provides a template tag for automatically finding preset phrases and replacing them with alternatives that have been defined using a module interface?

My client would like this so that they can add standard hyperlinks throughout their content without having to do it manually. It would be a bonus if it provided an API which could be used when channel entries are created so that new mappings could be generated automatically.

For example the book title gets automatically substituted with <a href="XYZ">Fishing for Idiots</a> in the following content:

{auto_replace}
{body}
{/auto_replace}

// Where {body} evaluates to:
The book Fishing for Idiots features blah blah blah...

3 Answers 3

2

The Shortcode addon was just released today and it's exactly what you are wanting.

Shortcode aims to allow for more dynamic use of content by authors and editors, allowing for injection of reusable bits of content or even whole pieces of functionality into any field in EE. Shortcode provides two types of codes for use in any content in EE: user-defined Macros specific to each author and each site, as well as a simple API for third-party plugins and modules to expose their tags through the shortcode Rich Text Editor dialog (or manual entry in any type of field) - complete with automatically rendered options forms.

Two Types of Codes

Macros - User defined, author and site specific bits of reusable content - basically just like Snippets but can they can be embedded directly in any field type by your content Editors!

Shortcodes - Plugin/Module defined tags that can be injected into the middle of content, such as a ProForm form or other piece of functionality. This works similarly to the WordPress Shortcode API.

Features

Macros defined by each user for their own use - each author could have the same macros defined with the same names, with different values that are dynamically replaced based on the assigned author of an Entry.

Macros defined by Super Admins for the entire site and usable in all content for each site (MSM compatible with separate sets of Macros for each site).

Macros and Shortcodes can be inserted manually in any fieldtype, or automatically through the included Rich Text Editor tool.

Simple Shortcode API that allows for any Plugin or Module to provide custom Shortcodes complete with automatically generated configuration dialogs

Existing plugins and modules can be converted to shortcodes with very little code. Assistance in the forum is available for anyone who wants to add support to their own add-ons.

Assistance writing glue code for existing plugins or modules is also available - just post a request for support for the plugin in the forum.

1
  • +1 because short codes are something that I was going to look into (and these seem lovingly similar to the ones in WordPress). But for this particular requirement I need something which scrapes the text of a channel entry and automatically substitute titles with links to relevant content.
    – Lea Hayes
    Dec 13, 2012 at 4:07
0

I don't think anything exactly like that currently exists. The closest you're going to get is Low Replace, but that will only replace strings where you pass the values to it in the template.

2
  • 1
    I have been searching and have come across the following, do you think that this could do the trick? devot-ee.com/add-ons/crosslinking I am not sure if this is the same thing or not
    – Lea Hayes
    Dec 13, 2012 at 3:06
  • This sounds exactly like what you want. First time seeing this addon. If you use it, answer your SE question with a link to the addon and accept your own answer.
    – Anna_MediaGirl
    Dec 13, 2012 at 4:16
0

Links to content by title can be automatically introduced using the Crosslinking add-on. This add-on also avoids adding the same link multiple times to avoid "black SEO".

Cross linking can be disabled for specific parts of content by encapsulating it within {no_crosslink}{/no_crosslink} tags.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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