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.

Passing global variables to embedded templates, no filtering happening.

November 06, 2008 8:33am

Subscribe [2]
  • #1 / Nov 06, 2008 8:33am

    Following a tutorial to pass global variables to embedded templates - succeeded for one install of EE. Attempting the same procedure for another website - cannot get the weblog to filter based on selected category. Any ideas where the difference could be - what am I leaving out?

    On weblog index template, assigning the variables:

    {assign_variable:my_weblog="weblog"}
    {assign_variable:my_template_group="weblog"}
    {assign_variable:my_embedded_template_group="embeds"}
    {assign_variable:my_index_template=""}
    {assign_variable:my_comments_template="comments"}
    {embed="{my_embedded_template_group}/html_header" my_page_title="Weblog"}

    and passing to embedded templates:

    {embed="{my_embedded_template_group}/weblog_categories" the_index_template="{my_index_template}" the_template_group="{my_template_group}" the_weblog="{my_weblog}"}
    
    {embed="{my_embedded_template_group}/monthly_archives" the_index_template="{my_index_template}" the_template_group="{my_template_group}" the_weblog="{my_weblog}"}

    From embedded template:

    {exp:weblog:categories weblog="{embed:the_weblog}" style="linear"}
    <li <a href="http://{homepage}/{embed:the_template_group}/category/{category_url_title}/">{category_name}</a></li>
    {/exp:weblog:categories}
  • #2 / Nov 06, 2008 10:04am

    Robin Sowell

    13255 posts

    Nothing’s jumping out at me, but to get a better feel for what EE’s seeing, try turning template debugging on (Admin- System Prefs- Output and Debug).  We can see the full tags as they’re parsed and spot what’s up.  How does that categories tag look when you look at the debug output?

  • #3 / Nov 06, 2008 11:26am

    Thank you for the response. Turned on Debugging, as far as I can see - all appears to be processing fine.


    On a separate but related note: Never used debugging, so attempted to compare the output to the site where passing global variables to embedded templates is working but debugging would not show on the other site - so I was not able to compare/learn. Found this thread - http://ellislab.com/forums/viewthread/74218/ - but was not successful/did not understand enough what to do (tried a few changes, none were apparently correct ...can see that the control panel url is without www).

  • #4 / Nov 06, 2008 1:23pm

    Sue Crocker

    26054 posts

    internet endeavor, are you actually logged into the second site when you’re attempting to show the debugging output?

    It could just be the difference between being logged into the non-www version of the site and not the www version.

  • #5 / Nov 06, 2008 2:11pm

    Yes, I am logged in.

  • #6 / Nov 06, 2008 4:23pm

    The site which is not filtering the global variables passed to embedded templates was just updated from a very early version - is it possible that something was corrupted in the process that could be affecting this? I have written and rewritten, checked and double-checked everything 10 times with no success.

  • #7 / Nov 06, 2008 9:56pm

    If I may, what should I conclude by the no response?

  • #8 / Nov 06, 2008 10:28pm

    Greg Aker

    6022 posts

    Nothing is really jumping out at me either.  Hummm…What version/build are you using?  You can find the values in the footer of your control panel. 

    -greg

  • #9 / Nov 06, 2008 10:50pm

    Version 1.6.5, Build:  20081031

    A couple of days ago I updated from a very early version - version 1.4 (or something close to that).

  • #10 / Nov 06, 2008 11:13pm

    Greg Aker

    6022 posts

    okay cool.

    Let’s step way back and try to figure out where your embed issues are borking, we can get to the debugging issue later.

    first, on the embedded template, can you go in and hard code all of the embeds? Let’s ignore all of the assigned variables and embedded values for now.

    Thanks,

    -greg

  • #11 / Nov 07, 2008 1:22pm

    I attempted hard coding the embeds. I have recreated the blog, field groups and category groups. I have now pasted the exact same code that is working on another site and the result is it still won’t filter the categories.

  • #12 / Nov 07, 2008 1:26pm

    Greg Aker

    6022 posts

    Can you please show the code you are using here?

    Thanks,

    -greg

  • #13 / Nov 07, 2008 2:16pm

    {assign_variable:my_weblog="weblog"}
    {assign_variable:my_template_group="weblog"}
    {assign_variable:my_embedded_template_group="embeds"}
    {assign_variable:my_index_template=""}
    {assign_variable:my_comments_template="comments"}
    {embed="{my_embedded_template_group}/html_header" my_page_title="Weblog"}
    <body>
    <div id="content">
    {embed="{my_embedded_template_group}/logo_title"}
    {embed="{my_embedded_template_group}/main_nav" my_location="weblog"}
    {embed="{my_embedded_template_group}/search_section_intros" the_url_title="weblog"}
    
    <div id="maincontent">
    <div id="right_side">
    
    {embed="{my_embedded_template_group}/weblog_categories" the_index_template="{my_index_template}" the_template_group="{my_template_group}" the_weblog="{my_weblog}"}
    
    {embed="{my_embedded_template_group}/monthly_archives" the_index_template="{my_index_template}" the_template_group="{my_template_group}" the_weblog="{my_weblog}"}
    {embed="{my_embedded_template_group}/syndicate_block" the_template_group="{my_template_group}"}
    </div><!-- close right_side -->
    <div id="left_side">
    {exp:weblog:category_heading weblog="{my_weblog}"}
    <h3>Category: {category_name}</h3>
    <p>{if category_description}<br />
    {category_description}<br />
    {/if}<br />
    <div class="horizontal_rule"></div><br />
    {/exp:weblog:category_heading}<br />
    {exp:weblog:entries weblog="{my_weblog}" orderby="date" sort="desc" limit="15" disable="trackbacks"}<br />
    <div class="entry"></p><h3><a href="http://{homepage}/{my_template_group}/{my_comments_template}/{url_title}">{title}</a></h3>
    <p>{summary}<br />
    {body}<br />
    {if extended}<a href="http://{homepage}/{my_template_group}/{my_comments_template}/{url_title}">Read More…</a>{/if}<br />
    <div class="posted"><br />
    Posted by {author} on {entry_date format='%m/%d'} at {entry_date format='%h:%i %A'} in<br />
    {categories}<br />
    <a href="http://{path={my_template_group}/{my_index_template}}">{category_name}</a> •<br />
    {/categories}</p>
    
    <p>{if allow_comments}<br />
    ({comment_total}) <a href="http://{homepage}/{my_template_group}/{my_comments_template}/{url_title}#comments">Comments</a> •<br />
    {/if}<br />
    <a href="http://{homepage}/{my_template_group}/{my_comments_template}/{url_title}">Permalink</a><br />
    </div><br />
    {paginate}<br />
    <div class="paginate"><br />
    <span class="pagecount">Page {current_page} of {total_pages} pages</span>  {pagination_links}<br />
    </div><br />
    {/paginate}<br />
    </div><br />
    {/exp:weblog:entries}</p>
    
    <p></div><!-- close left side div --><br />
    </div><!-- close main content div --><br />
    {embed="{my_embedded_template_group}/footer"}<br />
    </div>    <!-- close content div --><br />
    </body><br />
    </html>

    <h3>Weblog Categories</h3>
    <p><div class="lcontent"><br />
        <ul><br />
             {!-- Conditional on the list item applies an active class to the currently viewed category. --}<br />
            {exp:weblog:categories weblog="{embed:the_weblog}" style="linear"}<br />
                <li {if segment_3==category_url_title}class="active_cat"{/if}><br />
                    <a href="http://{homepage}/{embed:the_template_group}/category/{category_url_title}/">{category_name}</a><br />
                </li><br />
            {/exp:weblog:categories}</p>
    
    <p>         {!-- This conditional will only show when a category has been selected, and allows a user to return to the default of showing all posts on the weblog --}<br />
            {if segment_2=="category"}    <br />
                <li><a href="http://{homepage}/{embed:the_template_group}/">All News Items</a></li><br />
            {/if}<br />
        </ul><br />
    </div>

  • #14 / Nov 07, 2008 2:41pm

    Greg Aker

    6022 posts

    okay…let’s go even further back.

    make a new template group and paste only the weblog categories tags from your embedded template in there to make it work.  Hard code all of the variables, no assigning or embedding.  No html/body/head tags are needed.  just the {exp:weblog:categories} tag pair.

    give that a whirl, and let’s see what’s going on.  If that filters as you want it, we can start adding things back in until we find the problem.

    -greg

  • #15 / Nov 07, 2008 6:08pm

    Using only the weblog categories tag, I have it filtering. Please walk me through from here - I’m not sure how to go about adding back one thing at a time ...as I attempt, one seems dependent on all the others.

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

ExpressionEngine News!

#eecms, #events, #releases