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.

Help trying to separate channel:entries tags into partials

February 11, 2011 12:38am

Subscribe [1]
  • #1 / Feb 11, 2011 12:38am

    bryantAXS

    50 posts

    So my overall goal is to keep my channel:entries tags inside my template files and to move the contents of the channel:entries tag into various partials.  What I’m trying to avoid is having duplicated markup for simple variations of the channel:entries tag, which varies with the uri segments.  I’ve tried to do this with conditionals wrapped around the entires tags and also using embed tags and this Homegrown Partials plugin , but none have done the trick.

    Here is a piece of code that illustrates what I’m trying to do.

    {if segment_2 == ""}
    
            {exp:channel:entries 
              channel="events" 
              disable="categories|category_fields|member_data|pagination|trackbacks" 
              dynamic="no" 
              show_future_entries="yes" 
              show_expired="no" 
              require_entry="yes" 
              limit="1"}
               
               {exp:partials:get name="main_event"}
    
          {if:else}
            
            {exp:channel:entries
             channel="events"
             disable="categories|category_fields|member_data|pagination|trackbacks"
             require_entry="yes"
             show_future_entries="yes"
             limit="1"}
             
             {exp:partials:get name="main_event"}
             
          {/if}

    Where

    {exp:partials:get name="main_event"}

    is the piece that renders the partial.  Whenever I try now the tags within the partial return as plain-text.  Again, I realize this code is technically incorrect, but I’m just using it to illustrate what my goal is.  Any help would be appreciated!

    Thanks!

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

ExpressionEngine News!

#eecms, #events, #releases