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.

Session variable inside the custom field tag

September 20, 2012 7:00am

Subscribe [1]
  • #1 / Sep 20, 2012 7:00am

    Lyubov Berezina

    42 posts

    Hi everyone!
    I have a session variable that holds a selected city, for example:

    {exp:session_variables:set name=“session_city” value=“msk”}

    I also have a set of custom fields titled like this:
    2012_journal_issuu_id_msk
    2012_journal_issuu_id_kazan
    2012_journal_issuu_id_spb

    Where msk, kazan, spb are the possible values for a city.

    What I wish to do is something like this:

    {exp:session_variables:set name="session_city" value="msk"}
    {exp:channel:entries channel="2012_Autumn_Journal"}
     {2012_journal_issuu_id_{exp:session_variables:get name='session_city'}}
    {/exp:channel:entries}

    So I would like the page with this tag to show me the content of the corresponding field, so for the above example I need the content od the {2012_journal_issuu_id_msk} field.

    Is it possible?

    Thank you!

  • #2 / Sep 24, 2012 12:29am

    Kevin Smith

    4784 posts

    Hi Lyubov Berezina,

    It seems the parsing order would allow these, but I’m a bit fuzzy on the reason behind it. Could you enlighten me a bit about this? What’s the problem that this provides a solution for as opposed to just hard-coding the custom field variable? Also, have you tried this and does it work for you?

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

ExpressionEngine News!

#eecms, #events, #releases