ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

How to use allow_eecode?

July 01, 2011 2:33am

Subscribe [4]
  • #1 / Jul 01, 2011 2:33am

    liaorui

    5 posts

    I tried allow_eecode, but couldn’t get it work. For example, I put the following code into an entry field, and when the template shows the entry field, it still just output the code itself directly, nothing gets parsed as expected. Please help!

    {exp:allow_eecode}
    {exp:channel:entries channel="news_articles" limit="1" disable="pagination" status="Featured Top Story" }
    img/news-article-image.png
    <h4>{title}</h4>
    <h5><span class="by">By </span> {author}</h5>
    <p>{/exp:channel:entries}<br />
    {/exp:allow_eecode}

  • #2 / Jul 01, 2011 12:49pm

    liaorui

    5 posts

    Can anyone from EE give us technical support? As we have purchased the product.

  • #3 / Jul 01, 2011 1:04pm

    Kevin Smith

    4784 posts

    Hi liaorui,

    Welcome to the ExpressionEngine community! Glad to have you here. Our support forums are a great place to get official support for ExpressioneEngine, and we always strive to answer every forum request within 1 business day.

    It looks like you put the code above into an entry field and submitted that as a channel entry, correct? Those tags you have in your code are template tags, so rather than using them in your entries themselves, you’ll want to use them in your templates in order to display entries. Take a look at an introduction to templates in EE here.

    Does that help?

  • #4 / Jul 01, 2011 2:32pm

    Boyink!

    5011 posts

    Bigger question - what are you trying to do?

    Needing the allow EE code plugin is often an indicator to me that the site’s backend architecture isn’t being setup in an ideal manner.

    Entries should hold content.  Templates should hold EE code. Putting EE code in entries will bite you down the road..😉

  • #5 / Jul 01, 2011 6:24pm

    Sue Crocker

    26054 posts

    Thanks for the assist, Mike.

    liaorui - did the information from Kevin and Mike help?

  • #6 / Jul 05, 2011 4:56am

    liaorui

    5 posts

    I know that entrie hold content, and EE code goes to template. But since we have “allow_eecode” plug-in, which said: Allows ExpressionEngine code to be used in entries and then parsed in the template. So I want to do something more than just using template to pull entris out and display them.

    I want to add one layer in between, which allows me to pull those entries out first, and then give me some kind of flexibility to manipulate those enties, e.g. changing the tiltle of an entry. Or in other words, I want the ability to parse EE template in backend, not just during the time of receiving viewers’ http requests.

    Thanks!

  • #7 / Jul 07, 2011 4:51pm

    Brandon Jones

    5500 posts

    Hi liaorui,

    I might be misunderstanding here, but I don’t think the plugin will do what you want in that case. The plugin still works only on the front-end, not the control panel, as the template parser only works on the front-end. If you’re looking to customize the control panel theme, that is possible, but I’m not sure it’s going to do what you want. Can you tell us more about the scenario you envision?

  • #8 / Jul 07, 2011 4:57pm

    Kevin Smith

    4784 posts

    Just to add to what Brandon said, I have to agree with Mike’s intuition here, liaorui. It sounds like this isn’t a good way to set up your site. Just because it’s possible doesn’t mean it’s a good idea. If for nothing else, I couldn’t recommend using the allow_eecode plugin just because of the major security risk that it opens up. Make sure you read the plugin notes here.

    In fact, though I don’t quite understand the end goal you’re trying to achieve, it doesn’t sound like this would allow you to achieve it. I’m not sure how including EE code in an entry itself would actually help you do what you want to do because, like Brandon said, EE code is only parsed on the front-end when pages are called. If you want to change the title of an entry as it’s being submitted (or after the fact, for that matter), you’ll want to write an extension to do that. Check out the developers docs for information on how to get started there.

    Perhaps if you could go into more detail about the workflow you want to achieve and how you think EE code in the entries would help you achieve that, we’ll try to steer you in the right direction.

  • #9 / Jul 10, 2011 10:24am

    liaorui

    5 posts

    Thank you for the support. Now I know that it’s not possible to parse EE code on the back-end, and allow_eecode is useless even though I didn’t get it to work.

    What I try to achieve is quite simple, and I described last time clearly. The workflow of EE is: 1) input the entry through EE CP, 2) the templates decide what to show and how to show the entries “automatically”. Now the workflow I want is: 1) input the entry through EE CP, 2) the editor look at what is going to be shown on the website and decide what to show and how to show the entries, 3) the templates show the entries. For example, part of a webpage will show the top 5 entries’ title as a list, if using the EE way, we can write a template to do this quite simple, however, the logic is fixed once the template is done; if using my way, say we have 8 top stories one day, then the editor can look a list with 8 entries first (by certain tool or interface), and he can choose which 5 of them to show and may change the entries title if he want. Surely, we can use the existing EE CP function to edit those entries title or status one by one, however, this is back to editing-time work. It’s like programming, there are compile-time and run-time. Usually a program’s behavior is defined at compile-time. If we can change a program’s behavior at run-time, this is considered more dynamic. The same thing we wanted here for EE.

    Anyway, we have developed a module to do this in EE, so never mind. Still missing the capability to parse EE code at back-end, If that is possible, it could save us time to develop our module.

    Thanks!

  • #10 / Jul 11, 2011 5:27pm

    Brandon Jones

    5500 posts

    Hi liaorui,

    Thanks for clarifying. That’s an interesting idea, and you’re right that EE isn’t setup for that kind of workflow out of the box. A module is definitely the right way to go here. Don’t hesitate to post again if you have any other questions!

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases