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.

using variable as parameter in weblog:entries tag

November 27, 2007 10:25pm

Subscribe [2]
  • #1 / Nov 27, 2007 10:25pm

    44sunsets

    42 posts

    I’m trying to extract the {url_title} of the current page (I’m using the official Static Pages module) and then assigning that to a variable, {blogname}.

    However, it seems it doesn’t work? Is it possible to take a {url_title} value and assign that to a variable, so I can pass that variable as the “weblog” name in a {exp:weblog:entries} tag?

    {assign_variable:blogname="{exp:weblog:entries weblog="static_pages" show_pages="yes" rdf="off" disable="trackbacks"}{url_title}{/exp:weblog:entries}"}
    
    {exp:weblog:entries weblog="{blogname}" sort="asc" dynamic="off"}
    ...blah blah
    {/exp:weblog:entries}

    I’m still trying to wrap my head around variables in EE, it’s all very confusing to me. Help and/or clarification would be much appreciated!

  • #2 / Nov 27, 2007 10:47pm

    Sue Crocker

    26054 posts

    44sunsets, url_title is the title of an entry. EE “knows” what to do with it.

    When you assign an entry to a “page” you can have a single entry page that already has the weblog=“whatever” tag in it.

    But more importantly, how many weblogs are you using, and how are you using the Pages module?

  • #3 / Nov 28, 2007 12:29am

    44sunsets

    42 posts

    Basically I’m using this code on a template for an image slideshow page.

    I’ll be creating a lot more weblogs—basically, for each new slideshow page I’ll be creating a weblog with the same name as that page’s {url_title}.

    For example, the current page might be called “Family Vacation Slideshow” and have a {url_title} of “familyvacation”, so I’ll create a weblog with short name of “familyvacation” and all my individual images for the slideshow are stored as posts within that weblog.

    I’m using the official Pages Module in a normal capacity… i.e. certain pages will be designated slideshow pages, so they will use the slideshow template instead of my normal static content template. A slideshow page will still display normal Pages Module static content, but it also displays a JavaScript slideshow directly after the content.

    Not sure if that makes sense—if it’s still unclear, please let me know!

  • #4 / Nov 28, 2007 11:03am

    Robin Sowell

    13255 posts

    I think parse order will jam you up with that one.  Er- can you make the url_title match a specific segment of the static url- then just pull that segment out a la:

    exp:weblog:entries weblog="{segment_1}" sort="asc" dynamic="off"}

    That’s likely how I’d handle it.

  • #5 / Dec 31, 2007 8:34pm

    44sunsets

    42 posts

    That’s very much for your help, Sue and Robin. I ended up using URL segment variables to do the trick. Still learning the ropes, but I’ve been able to get things working quite smoothly so I’m very pleased 😊

  • #6 / Jan 02, 2008 10:54am

    Robin Sowell

    13255 posts

    Woot!  Glad you got it squared away.

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

ExpressionEngine News!

#eecms, #events, #releases