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.

Call a specific entry from within a text area?

November 06, 2012 10:52am

Subscribe [1]
  • #1 / Nov 06, 2012 10:52am

    binocle

    68 posts

    Hi,

    I am on a new project, and I am a bit confused about the best/easiest method to achieve what I need: multiples images galleries in a long article.

    I would like to have several images galleries (fancybox or likewise) inserted along a single entry. The trouble is, the number of galleries is different for each entry, and each gallery must be inserted in the main entry text field, at different places, so I can’t decide this in the template…

    The end publisher should be able to write his text, and insert one, or many, images galleries where he wants between paragraphs to illustrate his article.

    My thoughts/intuitions so far:

    - create a channel with a Channel Images field, and make a separate entry for each gallery
    - create a channel for the articles, and use Playa to allocate the right galleries to the right article
    - use Stash or Transplant in the template to stock the galleries bits of code
    - use allow_EE to put these bits in the right place in the textarea field

    I don’t even know if it would work, and it seems a bit messy… and I guess the final goal is “just” to call a specific entry from within a different entry’s textarea field.

    How would you achieve such a thing?

    Thanks in advance for your thoughts and your time.

  • #2 / Nov 28, 2012 6:18am

    binocle

    68 posts

    So, it’s been a while… and I finally succeeded, so I am back with my solution, in case someone else is in the same situation.

    My intuition was quite correct, but I struggled a bit with various add-ons to get it right.

    The winning combo is Channel Images + Playa + Allow EEcode + Transplant.


    Bits of template:

    {exp:channel:entries
      channel="questions"
      disable="member_data|pagination|trackbacks"
      limit="1"
        }
         
        {exp:nsm_transplant:body}
        {exp:playa:children field="galeries"}
           
            {exp:nsm_transplant:content id="galerie-{count}"} 
            {exp:channel_images:images entry_id="{entry_id}"}
                (…messy stuff for the gallery…)
            {/exp:channel_images:images}
            {/exp:nsm_transplant:content}
               
        {/exp:playa:children}
                 
         {exp:allow_eecode}
         {reponse}
         {/exp:allow_eecode}
         
         {/exp:nsm_transplant:body}
      
        {/exp:channel:entries}

    And then I can call the various galleries where I want inside the published entries text areas with {galerie-X} where X is the number of the gallery entry in the playa field.

    It might be messy and there is perhaps a more elegant solution, but it works… Hope it will help somebody else.

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

ExpressionEngine News!

#eecms, #events, #releases