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.

Dynamic channel name in exp:stats

December 14, 2011 10:20am

Subscribe [2]
  • #1 / Dec 14, 2011 10:20am

    cliffdangler

    7 posts

    Hi,

    Is it possible to dynamically pass the channel name to the below (indicated in red)?

    {exp:stats channel="{DYNAMIC}”}{last_entry_date format="{DATE_W3C}”}{/exp:stats}

    I’ve even tried an embedded template, but to no avail:
    {exp:stats channel="{embed='includes/.test'}”}{last_entry_date format="{DATE_W3C}”}{/exp:stats}

  • #2 / Dec 15, 2011 2:32pm

    Dan Decker

    7338 posts

    Hi cliffdangler,

    You could use Segment variables to set the channel in this fashion:

    {exp:stats channel=”{segment_2}”}{last_entry_date format=”{DATE_W3C}”}{/exp:stats}

    If you had a URL similar to this:

    <a href="http://your.domain.com/template-group/news">http://your.domain.com/template-group/news</a>

    The word “news” would be assigned to the {segment_2} variable and then the stats tag would use that to pull the stats for the “news” channel.

    In your second example, you simply can’t use embeds as part of a parameter. They are intended to embed other *templates*, does that make sense?

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

ExpressionEngine News!

#eecms, #events, #releases