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.

Embed Variables are not parsing correctly

March 21, 2011 11:17am

Subscribe [4]
  • #1 / Mar 21, 2011 11:17am

    Milo Creative

    20 posts

    Here’s something which is quite puzzling (as it used to work well until a few days ago and then it stopped, although no site/server/db migration or upgrade have been done as far as I know)

    A simple exp:weblog:entries which is generating a list of ids, and then an embedded template to show more data about these entries.

    {exp:weblog:entries 
        weblog="video" 
        dynamic="off" 
        search:video_type="=finished"
        orderby="view_count_one" 
        sort="desc" 
        limit="5"
        cache='yes' refresh='5' disable='categories|member_data|trackbacks'
    }
    
            entry_id: {entry_id}
        {embed="films/_film" entry_id="{entry_id}"}
    
    {/exp:weblog:entries}

    ..and the content of the films/_film template (stripped to the bare minimum for testing):

    | embed:entry_id: {embed:entry_id}

    This is what I get:

    entry_id: 312 | embed:entry_id: 312
    entry_id: 2504 | embed:entry_id: 312
    entry_id: 1271 | embed:entry_id: 312
    entry_id: 2111 | embed:entry_id: 312
    entry_id: 2118 | embed:entry_id: 312

    Please let me know if you need more information to figure out what may be causing this problem.

  • #2 / Mar 22, 2011 4:51am

    John Henry Donovan

    12339 posts

    Milo Creative,

    What happens if you clear your cache?
    And then temporarily remove cache=‘yes’ refresh=‘5’

  • #3 / Mar 22, 2011 9:11am

    Milo Creative

    20 posts

    John,

    thanks for your hint. I tried that and it didn’t make a difference.

    I turned “Smart” Static Parsing off and did some logging on core.template.php.. here’s what came out:

    (0.272071)    Processing Sub Template: films/_film
    (0.272086)    Retrieving Template
    (0.272100)    Retrieving Template from Database: films/_film
    (0.276081)    Template Found
    (0.277624)    Retrieving Template from File
    (0.279381)    Template Type: webpage
    (0.279445)    Embed Variables (Keys): entry_id
    (0.279455)    Embed Variables (Values): 312
    (0.279465)    ** Parsing entry_id -> 312
    (0.279475)    ** BEFORE template -> | embed:entry_id: {embed:entry_id}
    (0.279486)    ** AFTER template -> | embed:entry_id: 312
    ...
    (0.279619)    - Beginning Tag Processing -
    (0.279629)    - End Tag Processing -
    (0.286151)    Processing Sub Template: films/_film
    (0.286166)    Retrieving Template
    (0.286179)    Retrieving Template from Database: films/_film
    (0.288915)    Template Found
    (0.292806)    Template Type: webpage
    (0.292868)    Embed Variables (Keys): entry_id
    (0.292877)    Embed Variables (Values): 2504
    (0.292887)    ** Parsing entry_id -> 2504
    (0.292897)    ** BEFORE template -> | embed:entry_id: 312
    (0.292906)    ** AFTER template -> | embed:entry_id: 312
    ...
    (0.293111)    Processing Sub Template: films/_film
    (0.293124)    Retrieving Template
    (0.293136)    Retrieving Template from Database: films/_film
    (0.295930)    Template Found
    (0.300439)    Template Type: webpage
    (0.300499)    Embed Variables (Keys): entry_id
    (0.300509)    Embed Variables (Values): 1271
    (0.300523)    ** Parsing entry_id -> 1271
    (0.300533)    ** BEFORE template -> | embed:entry_id: 312
    (0.300543)    ** AFTER template -> | embed:entry_id: 312

    So EE is replacing the {embed:entry_id} the first time, as it retrieves the template from a file.
    The second (and third, fourth etc) time it grabs the template somewhere else (cache?) and it doesn’t find a tag to replace..

    I’m running ExpressionEngine 1.6.8 (build 20091002)

    Cheers,
    Matteo

  • #4 / Mar 22, 2011 4:59pm

    Sue Crocker

    26054 posts

    Hi, Milo. If you turn off any sort of template caching, including the embed template, and delete the cache, does the problem still happen?

  • #5 / Mar 23, 2011 8:07am

    Milo Creative

    20 posts

    What do you mean exactly by turning off any template caching? In the templates managing page of the CP? Or where? Apologies, am a bit confused between EE1 and EE2 these days 😊

    Thanks,
    Matteo

  • #6 / Mar 23, 2011 4:32pm

    Brandon Jones

    5500 posts

    Hi Matteo,

    Yes, in Template Preferences disable caching on the main and embed template. Then please clear all caches. Does that have any effect?

  • #7 / Mar 24, 2011 8:24am

    Milo Creative

    20 posts

    Thanks Brandon,

    that actually solved the problem!
    Dunno who turned template caching on, but I suspect someone had a go at “performance optimisation” lately..

    Matteo

  • #8 / Mar 24, 2011 4:39pm

    Sue Crocker

    26054 posts

    Glad Brandon was able to help. Don’t hesitate to post again as needed.

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

ExpressionEngine News!

#eecms, #events, #releases