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.

weblog:entries loop, passing vars & best way to add recent entries?

February 13, 2010 10:45pm

Subscribe [1]
  • #1 / Feb 13, 2010 10:45pm

    mahalie

    60 posts

    I’m having some brain grid-lock…probably I should come back to this in the morning. But have to finish…

    I have a weblog and the entry page is pretty typical, displays entry fields, categories, etc. Then in the footer I display the 3 most recent entries posted and below that, more articles in the same category. To do that I pass the entry_id and categories to the footer embed, as follows:

    {embed="includes/footer" entry="{entry_id}" categories="{categories backspace="1"}{category_id}|{/categories}"}

    So in the footer embed I grab related entries needed, so for recent entries:

    {exp:weblog:entries weblog="articles" status="Open" limit="3" {if embed:entry}entry_id="not {embed:entry}"{/if} dynamic="off"}

    The problem I’m having now is that I need to add comments to my entry pages, and want to end the weblog:entries tag before the footer embed. My brain is locking.

    Should I be passing the entry_id and categories to the footer at all? Or using the url to create the footer queries? If I could pass the entry_id and categories to local variables that could live outside the weblog:entries tag that would solve this. So should I do that, and if so how?

  • #2 / Feb 15, 2010 2:21pm

    mahalie

    60 posts

    Ok, so a night of sleep does help.

    One obvious way to pass entry_id, etc. outside the weblog:entries tag is to simply wrap the footer include in another weblog:entries tag pair. I was hoping to avoid unnecessary DB calls and would still appreciate any input on best practices for this.

    I know I could also pass the entry_id, etc. to a php var by allowing PHP in the template but I’m a little unclear as to what would be more efficient resource-wise and need to find some examples as I’m still newb/hacker level in PHP.

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

ExpressionEngine News!

#eecms, #events, #releases