Is it at all possible to have a text input or area field in which we could enter EE code to be processed by the template.

For example, if we could have a text area called "Advanced Functionality" and within this write things like


Right in the channel entry, and then in our template call...


then that could be valuable in some instances.

Is this too far down the parse order to happen? Or does anybody know of a solution?

  • To clarify: You want a user to be able to submit EE tags and have the parse-engine parse that as if its a template? – fideloper Nov 26 '12 at 22:16
  • That's correct. – Mutual Nov 26 '12 at 22:16

You could do this combining Stash and the allow_eecode plugin. http://www.tyssendesign.com.au/articles/cms/more-stash-examples/ has a great example of the functionality you're trying to achieve (example 1 wp shortcode).

For stash see https://github.com/croxton/Stash, allow_eecode http://devot-ee.com/add-ons/allow-ee-code

  • Perfect. Alow EE Code is just what I had in mind. Thanks @erwinheiser – Mutual Nov 26 '12 at 22:24
  • no need for Allow EE Code plugin - you can get Stash to parse the snippet as in my example – James Smith Nov 26 '12 at 22:27
  • I feel that Allow EE Code is very unsafe unless you know for a fact that only you will ever be entering content. If you are building a site for an end-client you should never use this, as it would allow whoever they give access to the control panel to do basically whatever they want to your site and database through the use of malicious template code. – Isaac Raway Nov 26 '12 at 22:27
  • Good points well made. Unaccepted this answer (sorry!) because of the points raised. – Mutual Nov 26 '12 at 22:29
  • I think this is a really cool option, it's just too dangerous to use on sites that are edited by end-users. – Isaac Raway Nov 26 '12 at 22:30

Stash, yet again(!), is the answer:

    {exp:stash:parse process="end"}

... this does the trick for parsing snippets

Then if you want to get more creative with custom shortcodes instead of snippets, you'd use stash:set first like this:

{exp:stash:set name="shortcode_inside_field" type="snippet"}
    <p>Hi there! It's important to set type="snippet" so that {shortcode_inside_field} will get automatically replaced with this sentence by the stash:parse tag later on.</p>
    ... now run all kinds of complicated EE tags here to generate the content of the shortcode (be sure to add parse_tags="yes") ....

    {exp:stash:parse process="end"}
  • We did this extensively in one of the sites that I worked on, it's a good method if you only have a handful of tags that need to be inserted and they do not need to take parameters. Otherwise, see my Shortcode answer. – Isaac Raway Nov 26 '12 at 22:27
  • Could you give me a quick overview about what this is doing? In the first portion you seem to be setting the stash partial, and 'getting' it further on. What is the reason for this? Shouldn't this just be part of {advanced_functionality}? – Mutual Nov 26 '12 at 22:31
  • Sorry my first response was a little premature... (I've spent over a year doing it this way using the old String plugin, which has an :output method that makes this easy)... However the latest (dev) branch of Stash includes the parse method which means (since it's a snippet) you can do it as shown. – James Smith Nov 26 '12 at 23:21

I have a new module called Shortcode coming out soon which enables this type of thing. It is a bit more restrictive in that it only allows tags that have been setup for it to be parsed since it'd be very unsafe to allow for open ended template code to be entered as content. That said, it's trivial to add new Shortcodes to the module with just a few lines of code.

For instance, you could easily insert a ProForm form using this tag:

[form form_name="application_form"]

Let me know if you'd like a demo by posting in the Shortcode forum.

  • Sounds great. I marked @erwinheiser's as the accepted answer as it can be used today by anybody looking at this question but I'll definitely check out Shortcode when I get a few. – Mutual Nov 26 '12 at 22:28
  • Yep with the caveats I just posted on the other answers, they are both pretty good options that you can use now. Let me know if you want a demo of Shortcode, I'll send it over. – Isaac Raway Nov 26 '12 at 22:28
  • cool, was unaware of this add-on. Keeping an eye on it! – erwinheiser Nov 26 '12 at 22:30

Hmm, good question. I dont think this would be possible with snippets, as they are always parsed too early.

By the sounds of things this is basically what the Shortcodes addon will offer - though that isn't publicly available yet - maybe @IsaacRaway can chip in and let us know?

  • Yep, posted an answer for Shortcode. If anyone wants a demo copy they can post in the forum for the module and I'll send it over. – Isaac Raway Nov 26 '12 at 22:34
  • Damn, you beat me to it :) – Tom Davies Nov 26 '12 at 22:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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