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.

segments as variables in embedded templates?

August 26, 2010 7:31pm

Subscribe [2]
  • #1 / Aug 26, 2010 7:31pm

    jtree

    255 posts

    I’m having trouble getting the following to work.  Maybe I’m not understanding how this works? This is my calling code:

    {embed="global/_generic-body" the_weblog="interior" the_url_title="{segment_1}"}


    This is my embedded template:

    {exp:weblog:entries weblog="{embed:the_weblog}" url_title="{the_url_title}" dynamic="off" disable="categories|category_fields|member_data|pagination|trackbacks"}
    
    <h1>{title}</h1>
    
    <div id="interior-body">
        
    {body-text}
        
    </div>
    
    {/exp:weblog:entries}

    For the_url_title if I hard code the actual url_title in the variable it works, but I want it to be dynamic by using segments.  Can you not use segments as a variable?

  • #2 / Aug 27, 2010 11:04am

    Ingmar

    29245 posts

    If you are using variables passed down from the parent template, as it were, you need to prefix them with “embed”, like so {embed:the_url_title}.

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

ExpressionEngine News!

#eecms, #events, #releases