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.

Is there a way to pass variables into a weblog?

February 28, 2009 10:20pm

Subscribe [2]
  • #1 / Feb 28, 2009 10:20pm

    Optimizing Guru

    14 posts

    Hello Everyone:

    I’m hard at work trying to finish up a site and have come to a point where I am looking for some suggestions.  I have searched long and hard for a way to pass a variable from parent weblog into a child weblog. 

    {exp:weblog:entries
      weblog="portfolio"
      category="1"
      disable="member_data | pigination | trackbacks"
      orderby="random"
      limit="1"
      }        
        {if portfolio-thumbnail }
          {exp:weblog:entries
            weblog="portfolio"
        category="1"
        disable="member_data | pignation | trackbacks"
        orderby="random"
        }
          {if portfolio-image }
            <a href="http://{portfolio-image}">" title="Samples"]_        {portfolio-thumbnail}_        </a>
          {/exp:weblog:entries}
        {/if}
    {/exp:weblog:entries}

    Please let me know your thoughts.  Thanks.

    Joe

  • #2 / Feb 28, 2009 10:24pm

    Lisa Wess

    20502 posts

    Joe, nesting weblog entries isn’t possible like that, you can embed to pass the variables but that would be pretty hard-hitting.

    Instead, have you considered relationships?

  • #3 / Feb 28, 2009 11:16pm

    Optimizing Guru

    14 posts

    Lisa,

    Can you point me in the direction of where I can find information about relationships? 

    Thanks,
    Joe

  • #4 / Feb 28, 2009 11:56pm

    julie p

    282 posts

    can you simply state what you need to do? It looks like you have just one weblog named “portfolio” and are wanting to show a thumbnail and image, if they exist in the weblog. Is that correct?

    Relationships are simply ways to tie one weblog entry to another weblog entry. For instance, if you have multiple portfolios, each with some number of entries, you can have a “portfolios” weblog, and an “photos” weblog (as an example). In the “photos” weblog, you would create a custom entry field that is a “relationship” type of field, and set the relationship to the “portfolios” weblog. This way, whenever you add a new photo to a collection, you simply select the portfolio it is to be in (on the publishing page, the portfolios in the portfolio weblog will automagically come in as a select field). If you need specifics, you can search for “relationship” in the user guide and it will show you examples.

    If you just have one portfolio and want to add artwork to it, relationship fields may not be right for you. If you can explain, I can help you narrow it down…

  • #5 / Mar 01, 2009 12:32am

    Lisa Wess

    20502 posts

    You can read about relationships at the bottom of this page.  There are relationships and reverse relationships, and you’ll find both links there.

  • #6 / Mar 03, 2009 9:12pm

    Optimizing Guru

    14 posts

    Idea Behind the below code:

    {exp:weblog:entries
      weblog="portfolio"
      category="1"
      disable="member_data | pigination | trackbacks"
      orderby="random"
      limit="1"
      }        
        {if portfolio-thumbnail }
          {exp:weblog:entries
            weblog="portfolio"
        category="1"
        disable="member_data | pignation | trackbacks"
        orderby="random"
        }
          {if portfolio-image }
            <a href="http://{portfolio-image}">" title="Samples"]_        {portfolio-thumbnail}_        </a>
          {/exp:weblog:entries}
        {/if}
    {/exp:weblog:entries}

    Is to have a weblog that has the following fields:
      1. Title (required)
      2. Portfolio Thumbnail
      3. Portfolio Image (required)

    The weblog also has the following categories associated with it:
      1. Brochures
      2. Menus
      3. Stationery
      4. Postcards

    The above code is attempting to call the portfolio weblog.  It will randomly pick an entry that has the portfolio thumbnail field filled.  This may only be filled on a copy of the entries as this may not change as much as the Portfolio images will.  Once it’s determined that portfolio-thumbnail field is not empty it will attach a lightbox recursion element that pull all the portfolio-image fields and putting them into a multiply lightbox. 

    The code will display a thumbnail on the website with the associated portfolio images being pulled into a lightbox that a user can view the images in a given portfolio category. 

    If you have any questions please let me know. 

    Thanks,
    Joe

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

ExpressionEngine News!

#eecms, #events, #releases