1

I have a SafeCracker form. In order to maximize code reused, I have broken the form into embeddable fieldsets, with each fieldset containing embedded fields. (Basically, I can just embed fields as I need them throughout the various forms I need.)

When I display the form, however, I don't think it has access to the Channel data. For example, here's my template for my gender field:

<div class="control-group">
    <div class="controls">
        {options:gender}
            <label class="radio" for="{option_value}">
                <input type="radio" name="gender" value="{option_value}" id="{option_value}">
                {option_value}
            </label>
        {/options:gender}
    </div>
</div>

The output is exactly the above. The {options*} stuff did not get parsed. Is embedding not allowed?

1

Are you considering ExpressionEngine's parse Order?
This is a quick quick summary:
http://loweblog.com/downloads/ee-parse-order.pdf

[...]
3. Parse simple conditionals: segment, embed, global variables
[...]
5. Parse module and plugin tags

Try Pre Embed (free plugin)
http://devot-ee.com/add-ons/pre-embed

| improve this answer | |
  • No, I was not. I was trying to do the same thing I do with Smarty. This logic works in Smarty. Will look into this. By the way, are embeds bad? Should I be using another technique to break apart my HTML? – ExpressionEngineNewbie Dec 16 '12 at 10:51
  • I think that embeds must be used carefully. Intensive use of embeds can degrade performance. – Filippo Salza Dec 16 '12 at 11:01
  • Try to use parse="inward" parameter in safecracker tag. – Filippo Salza Dec 16 '12 at 11:07
  • I've converted some of my embeds into snippets (e.g. my footer, etc.). I'm not entirely clear on the limitations of snippets, though. Are for my fields, they do require data from the parent template. I'm guessing parse="inward" will solve my problem? Will give it a try. Should I be looking at Stash also? – ExpressionEngineNewbie Dec 16 '12 at 11:22
  • parse="inward" did nothing. – ExpressionEngineNewbie Dec 16 '12 at 11:28

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.