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.

Question about a sidebar

October 30, 2012 10:15am

Subscribe [3]
  • #1 / Oct 30, 2012 10:15am

    Stephen O'Connor

    24 posts

    Hi,

    I am have built 4 sites now with ExpressionEngine but still consider myself to be a novice.

    I have a question about a sidebar. In the site I am currently developing I want to give my client as much control over the site as possible and I would like to offer her the choice of displaying certain sidebar components on a per page basis. So lets say the full site has 4 sidebar components: latest news, testimonials, buy gift vouchers and social media share. Is it possible to allow the client to choose to display (for example) the latest news component, testimonials and gift vouchers on one page but then on a different page choose gift vouchers and social media share? And if so can someone point me in the right direction on how to go about this.

    Thanks.
    Stephen.

  • #2 / Oct 30, 2012 10:51am

    I would create a new channel that holds a simple matrix field with 2 columns.

    In column 1 you create a dropdown list that holds all your pages.
    in column 2 you create a group of checkboxes with all your sidebar components.


    Now the client can easily decide on which page he wants to display the components.
    f.ex:

    - home :  component1
    - about : component2 & component3
    - contact: component3

    etc. etc.


    In your ouput, just cycle through your matrix rows until you find the one corresponding the page your on and see which components you want to display.

  • #3 / Oct 31, 2012 2:37pm

    Shane Eckert

    7174 posts

    Hey Stephen O’Connor,

    Thank you for posting your question.

    Jan mentioned Matrix which is not included in ExpressionEngine and will cost you an additional $55. While his solution is nice, I would like to offer one that does not require additional fees. This is really close to what Jan has offered, but no Matrix. You will want to use another channel for sidebars or you can just add a field to a channel, that way you can specify side bar per channel entry. (use entry_id= for that)

    Off we go!

    You could create a embed for each case.

    option_1 = all 4 items
    option_2 = 2 items
    option_3 = 3 items

    Then create a channel field that has a select in the channel you desire. See screen shot here: http://cl.ly/image/153m1C1d1Q2f

    Next select the option you want in the publish entries tab. See screenshot here: http://cl.ly/image/230z0i2q0t3I

    Then mimic this in your template, edit to fit your needs.

    {exp:channel:entries channel="sidebar" disable="member_data" limit="1" dynamic="no"}
    <div class="sidebar_grid">
    {embed="include/{side_bar_options}"}
    </div>
    {/exp:channel:entries}

    That should do it for you. Then just instruct your client to use the publish tab and select the sidebar they want. In the description field for the select, you can lay out which option == to which items.

    Does that make sense? Do you think you can take the example and make it work?

    Cheers,

  • #4 / Nov 16, 2012 4:27am

    Stephen O'Connor

    24 posts

    Thanks Jan & Shane for your replies, sorry it’s taken me so long to get back to you!

    I am buying matrix for the client as we plan to have galleries on the site so the solutions you guys have offered give me a couple of options. I will try both and see how I get on, and if I get stuck I’ll come back and ask again 😊

    Shane, I appreciate the detailed explanation you have given me.

    Thanks again.
    Stephen.

  • #5 / Nov 16, 2012 2:30pm

    Shane Eckert

    7174 posts

    Hey Stephen O’Connor,

    Awesome! Let us know if you need anything else by opening a new thread.

    Cheers,

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

ExpressionEngine News!

#eecms, #events, #releases