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.

Let user add and order / reorder sidebars per page? FF Matrix or another approach?

October 15, 2009 2:38pm

Subscribe [4]
  • #1 / Oct 15, 2009 2:38pm

    mucha

    18 posts

    Using a custom field, I want to give the user the ability to add and arrange what sidebars (stored in the “sidebars” weblog) to display on a certain page.

    What I’ve tried so far was Brandon Kelly’s FF Matrix as the custom field type, since it supports drag/drop reordering out of the box. I tried to connect the two weblogs via url_title .. to where the url_title that appears in the FF Matrix drop-down list, matches the url_title of the sidebar. (see screenshot).

    I’m wondering if I should continue working down this path or if I’m overlooking a different or more native way of achieving this?

  • #2 / Oct 15, 2009 10:23pm

    bouch

    9 posts

    I’ve also been trying to find a way to do this. What you’ve proposed looks like a decent solution, of course, I’m still low on the learning curve. I’m curious to see what your solution is.

  • #3 / Oct 16, 2009 2:04am

    That’s an interesting approach to that sort of issue. Let us know what you come up with.

  • #4 / Oct 16, 2009 9:59am

    ender

    1644 posts

    how does your approach connect the sidebar preferences to individual users?

  • #5 / Oct 16, 2009 11:10am

    mucha

    18 posts

    how does your approach connect the sidebar preferences to individual users?

    Maybe I’m misunderstanding, but right now, the sidebars will be purely promotional in nature; small, art-directed nuggets that will be used just to highlight different topics that the client would want to draw attention to.

    My problem is that I can’t get the sidebars to display and display in the order specified by the FF Matrix field.

    If I put the following in manually for the url_title it works (except for order):

    sidebar-work|sidebar-test|sidebar-marcus|sidebar-cool

    But if I try to use the embed, which produces the identical code snippet as above, nothing displays.

    {exp:weblog:entries weblog="sidebar_content" dynamic="off" url_title="{embed='embeds/get_sidebars'}"}

    Perhaps it has to do with parsing order?

  • #6 / Oct 16, 2009 11:33am

    ender

    1644 posts

    ah I may have misunderstood what you meant by ‘user’.  This isn’t on a per-visitor basis so much as giving your client control over the display order, right?

  • #7 / Oct 16, 2009 11:39am

    mucha

    18 posts

    ah I may have misunderstood what you meant by ‘user’.  This isn’t on a per-visitor basis so much as giving your client control over the display order, right?

    Yes, that’s exactly right.

  • #8 / Oct 16, 2009 5:07pm

    Focus Lab Dev Team

    1129 posts

    I tried to connect the two weblogs via url_title .. to where the url_title that appears in the FF Matrix drop-down list, matches the url_title of the sidebar. (see screenshot).

    I’m wondering if I should continue working down this path or if I’m overlooking a different or more native way of achieving this?

    Are you manually typing in url_titles as FF Select options? If so you would probably be benefited more from making the FF Select field into a Relationship field that pulls from the Sidebar Weblog entries. Then you could just use the FF Matrix tag in your template and for each entry use the related entries tag pair.

  • #9 / Oct 16, 2009 5:10pm

    Focus Lab Dev Team

    1129 posts

    Can you post the template code you’re working with?

  • #10 / Oct 16, 2009 6:08pm

    mucha

    18 posts

    Erik, looks like I don’t have “Relationship” as an option for “Cell Type” within FF Matrix…  I wish it did, because that was the other side of my issue: how to dynamically populate the list of sidebars.

  • #11 / Oct 16, 2009 6:12pm

    Focus Lab Dev Team

    1129 posts

    Erik, looks like I don’t have “Relationship” as an option for “Cell Type” within FF Matrix…  I wish it did, because that was the other side of my issue: how to dynamically populate the list of sidebars.

    Ah bugger. I wasn’t thinking about the fact that you’re in a FF Matrix. The Relationship custom field type is something that is built in to EE out of the box.

    You could use Playa, but it’s commercial as you probably already know if you’re using FieldFrame

  • #12 / Oct 16, 2009 6:20pm

    mucha

    18 posts

    This is my “embeds/get_sidebars” template that gives me the url_titles to use. page_sidebars is my FF Matrix field:

    {exp:weblog:entries weblog="pages_content" backspace="1" dynamic="off"}{page_sidebars}{sidebars}|{/page_sidebars}{/exp:weblog:entries}

    the above outputs this:

    sidebar-work|sidebar-test|sidebar-marcus|sidebar-cool

    Here’s a snippet from my display page; pretty basic:

    {exp:weblog:entries weblog="sidebar_content" dynamic="off" url_title="{embed='embeds/get_sidebars'}"}
        <h4>{title}</h4>
    <p>    {body}<br />
    {/exp:weblog:entries}

  • #13 / Oct 16, 2009 6:25pm

    mucha

    18 posts

    @Erik - I was just hoping that someone out there in EE land had done this type of thing natively. (I’m sure I’m not the first one to try and give a client this functionality).

    I think that Playa is probably going to be the easiest route… and I don’t mind in the least supporting Brandon’s good work.

    All that being said, I’d still like to understand WHY my little embed trick doesn’t work.

    Like I said above, putting in the pipe-delimited list (like above) manually works (except for the order is wrong).... but when I try to use the embed, if just shows up as blank.

    Any ideas why?

  • #14 / Oct 16, 2009 9:26pm

    bouch

    9 posts

    Maybe try the template debugging option and see what errors your getting.

    Is it possible to output your get_sidebars into a variable? Then use that in the url_title?

    Not sure this will work:

    {assign_variable:sidebars="{exp:weblog:entries weblog="pages_content" backspace="1" dynamic="off"}{page_sidebars}{sidebars}|{/page_sidebars}{/exp:weblog:entries}"}

    Then use {sidebars} as your url_title.

    If not that then check out Fresh Variables.

  • #15 / Oct 17, 2009 1:10am

    mucha

    18 posts

    bouch, thanks for the variables idea. I’ll give that a shot and post back with the results.

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

ExpressionEngine News!

#eecms, #events, #releases