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 a channel entries Variable outside the channel entries tag, How?

September 14, 2012 11:07pm

Subscribe [2]
  • #1 / Sep 14, 2012 11:07pm

    Jan Paul

    74 posts

    Hi i want to use channel_short_name in a section of a template that’s not encompassed by the channel entries tags (and it shouldn’t be).

    Is there a way or me to still get the value of channel_short_name there in an elegant way?

    Right now im using…

    {exp:channel:entries url_title="{segment_1}" disable="categories|category_fields|custom_fields|member_data|pagination"}{channel_short_name}{/exp:channel:entries}

    Just to get that one value from channel entries, which is a bit overkill…

     

  • #2 / Sep 15, 2012 6:52am

    k2zs

    114 posts

    Isn’t segment_1 the same as the channel_short_name? Why not just use that…

  • #3 / Sep 15, 2012 7:11am

    Jan Paul

    74 posts

    No, I have a setup that doesn’t have the channel name in the url at all, so I can’t use that.

  • #4 / Sep 18, 2012 11:15am

    Shane Eckert

    7174 posts

    Hey Jan,

    Can you give stash a try and let me know if it works for you?

    Thank you,

  • #5 / Sep 26, 2012 8:31am

    Jan Paul

    74 posts

    Gave it a try…

    {exp:channel:entries limit="1" disable="member_data|pagination|categories"}
      {exp:stash:set name="title"}{title}{/exp:stash:set}
    {/exp:channel:entries}

    {!--Now you can access like this in an embedded template or later in the parse order of the same template:--}
    {exp:stash:get name="title"}

    That doesn’t work outside of the exp:channel:entries tag for me

    I also tried the string plugin but not working for this also

  • #6 / Sep 27, 2012 11:23am

    Lisa Wess

    20502 posts

    Hi, Jan -

    As shane said, the Stash or String plugins are the ways to handle this.  If you’re having trouble getting one of those to work, I would recommend contacting the author of the add-on for assistance.

    The other option here would be straight PHP, as it is not an EE feature at this time.

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

ExpressionEngine News!

#eecms, #events, #releases