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.

Content layout variations — best practice?

October 08, 2010 7:43am

Subscribe [3]
  • #16 / Nov 27, 2010 6:40pm

    vacquah

    355 posts

    Yes- this code needs to be inside an entries tag - otherwise you have no access to the values in you custom fields n

    Mainly the same idea as a text field. Ive used this approach elsewhere so it will work- might just have to finess the code a bit.

    ok - 2 points:

    - means we are wrapping the entire template code within the body tag with a channels entries tag - but the wrapped template code itself has a channels entries tag too for the single entry.  is this optimal?

    - if this is the same as using a text field, then what is the advantage of going this route - extra channel to hold template names to be used in a dropdown field?


    I have setup the whole thing now, but haven’t wrapped it in the channels entries tag because of my concerns with the first point above ...
    i.e.

  • #17 / Nov 27, 2010 8:16pm

    Boyink!

    5011 posts

    No-optimal would be a a standard design where the HTML & CSS would be cacheable. You didn’t seem to be after that..😊

    Give it a try—see if it works first then analyize it for performance.

    The only advantage of the drop-down is not having to type it in. I thought there were clients mentioned at one point. If not, then use a textbox.

  • #18 / Nov 28, 2010 11:24am

    vacquah

    355 posts

    No-optimal would be a a standard design where the HTML & CSS would be cacheable. You didn’t seem to be after that..😊

    Give it a try—see if it works first then analyize it for performance.

    The only advantage of the drop-down is not having to type it in. I thought there were clients mentioned at one point. If not, then use a textbox.

    It works!  - using a custom drop down field to select entries from another channel with the template names. So I got a bit more adventurous and decided to duplicate the same functionality with the “Template and Snippet” plugin.  It essentially just provides a drop down list of templates and snippets on the entry page. the methodology afterwards is the same.  Perhaps the advantage of this plugin is that it eliminates the extra clutter of channel entries for template names.

    regarding my first question about embedding a channel entries tag within another, I was looking to clarify if that is generally o.k - for instance, won’t this impact the placement of the pagination code? ( thought it was optimal to place the prev and next tags outside of the channel entries tag. - this sort of places it inside.). I do care about optimizing the code!  😊

    My ultimate goal was to be able to execute the code below without placing it in an entries tag.  maybe, not inherently possible with ee.

    <body id="stories_main" class="page">
        {embed="custom_templates/{template_name}"}
     </body>
  • #19 / Nov 28, 2010 12:05pm

    Boyink!

    5011 posts

    EE’s pagination tags have to be inside the channel:entries loop - see the docs:

    http://ellislab.com/expressionengine/user-guide/modules/channel/pagination_page.html

    If you are storing something in an entry and need it back at the template level there is no other way to retrieve it than using a channel entries loop.  Make sure to use the disable parameter to turn off as much as you can.

    I still wonder though - why not store your design HTML with the entry?  Why use another snippet/template at all?

  • #20 / Nov 28, 2010 12:23pm

    vacquah

    355 posts

    I still wonder though - why not store your design HTML with the entry?  Why use another snippet/template at all?

    Are you referring to using just one template and shifting things around with css and ee conditionals?

  • #21 / Nov 28, 2010 12:26pm

    Boyink!

    5011 posts

    Yes-just one parent / envelope template pulling html from a set of fields and content from another set of fields.

  • #22 / Nov 28, 2010 12:29pm

    vacquah

    355 posts

    Yes-just one parent / envelope template pulling html from a set of fields and content from another set of fields.

    Would love to see a great tut / walk through on that - like the Greg Woods one you mentioned. I get it conceptually, but not how to implement something like that. Wondering if you can achieve a totally different layout by using the same underlying template?  Sounds like a lot of conditionals.

  • #23 / Nov 28, 2010 1:28pm

    Boyink!

    5011 posts

    Don’t overthink it. HTML is just text. EE stores text. Create fields for your markup and return it as needed in the template.

  • #24 / Nov 28, 2010 6:34pm

    vacquah

    355 posts

    Don’t overthink it. HTML is just text. EE stores text. Create fields for your markup and return it as needed in the template.

    I will keep experimenting - thanks for the insights!

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

ExpressionEngine News!

#eecms, #events, #releases