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.

Trouble grasping how EE works.

March 24, 2011 11:05am

Subscribe [2]
  • #1 / Mar 24, 2011 11:05am

    CelebrationWeb

    38 posts

    I am really having some trouble grasping how this works. I spent all night reading the user guides and I still can’t figure out how to make a simple change to the main navigation of a site. Hopefully someone can help walk me through this and EE will start making sense to me.

    Here is part of the main navigation;

    Vegetables
      - Broccoli
      - Tomato
    Fruit
    Lemon
      - Fruit
      - Banana
      - Grape

    Currently, when I click on Fruit I get the content of Fruit but Lemon highlights as though it was clicked. What I need to do is get it to be this;

    Vegetables
      - Broccoli
      - Tomato
    Fruit
      - Banana
      - Grape
      - Lemon

    So far everything that I have tried just resulted in a mess. I do understand PHP and MySql so I know the general concept of what’s going on. I’m just having a hard time figuring out exactly where in the control panel I need to be to change this and then what to do.

    Moved to CodeShare Corner by Moderator

  • #2 / Mar 24, 2011 2:50pm

    brianhoffman

    16 posts

    EE does have a different paradigm that you have to wrap your mind around. Once you do that, it’s great. To me, some of the important things to realize were how the URLs generally work:

    {domain}/channel/template/content-item

    Which means that you really aren’t arranging your site in a traditional hierarchy and I have no idea how you create a site more than a few levels deep. Channels are one organization tool and categories are another. Usually you have to use these in combination. And templates are, of course, how you display things.

    So in your case, it might be how you have things arranged. There are probably other and maybe even better ways to do this, but given what you provided, this is how I would do it at this point.

    Make Vegetables and Fruit channels. All of your produce become content items to which you assign the categories vegetables or fruit. In the case of tomatoes, you can assign them both to make sure people find them. You then create a template in each channel that displays the list of items that have the category vegetable in the vegetable channel and fruit in the fruit channel. You could use a tag like:

    {exp:channel:entries channel="vegetables" category="1"}

    where the category id of the vegetables category is 1.

    Now if, for example, you want to display various varieties of apples under apple, then you’ll need to add a subcategory for each apple variety.

    And when you create your nav, just create a conditional that looks at the appropriate URL segment (such as segment_1) and display it as a hyperlink if it isn’t a match and as plain text if it is.

    Does that help at all?

    Brian

  • #3 / Mar 24, 2011 3:19pm

    CelebrationWeb

    38 posts

    Thanks Brian, that gives me a pretty good idea. When I was first asked to work on this site a went the their website and looked at the source code and and thought this would be so easy. Then when I got the passwords and saw that none of the pages that I was looking at even existed I freaked!

    Your explanation makes this sound much clearer now.

  • #4 / Mar 24, 2011 4:04pm

    CelebrationWeb

    38 posts

    I was able to get the top level of the menu like I wanted it, but now when I click ‘Fruit’ none of my sub-menu items show up, although I can see them all assigned to have ‘Fruit’ as their parent. Any idea why they may not be showing up?

  • #5 / Mar 24, 2011 4:07pm

    brianhoffman

    16 posts

    How are you creating your menus and sub-menus?

  • #6 / Mar 24, 2011 4:18pm

    CelebrationWeb

    38 posts

    Under ‘Publish’ they have a channel? called Static Content. Under that I went to Categories-Edit Categories and was able to move items around to where they are supposed to be.

    Now when I go to Templates a see a group named ‘Apple’ that has all of the content that I want appearing under ‘Fruit’ but I don’t see how to move it.

    OK, now I figured out how to copy the templates into my group but that still doesn’t get them to show up as a sidebar item.

  • #7 / Mar 24, 2011 4:41pm

    brianhoffman

    16 posts

    First, let me correct something I said earlier. It’s not

    {domain}/channel/template/content-item

    it’s

    {domain}/template-group/template/content-item

    Sorry about that. Our template group names and channels are very similar.

    Is this a pre-existing site or one you created? And what version of EE are you using? If you’re using anything prior to 2.0, the terminology is different, among other things. If this is a pre-existing site, it sounds like it was set up in a way that doesn’t take advantage of EE. I’m guessing that under the template group Apple there are what amount to static pages for each type of apple. Less than ideal. If this is the case, then the nav is probably hard coded too. Can you post some code snippets?

  • #8 / Mar 24, 2011 4:51pm

    CelebrationWeb

    38 posts

    It’s ver 1.6.4

    Yes this is an existing site at celebration.org. That messages menu item is what I’m trying to populate with some menu items in the side bar.

    This is the code that the old menu item had for index;

    {begin_document}
    
    {embed="includes/.html-head"}
    
    {begin_body}
    
    {embed="includes/.header"}
    
    {begin_content_with_sidebar}
    
    {embed="includes/.content"}
    
    {begin_sidebar}
    
    {embed="includes/.navigation-sub"}
    
    {end_content_with_sidebar}
    
    {embed="includes/.footer"}
    
    {end_document}


    and here is the code for an item that I moved into Messages;

    {begin_document}
    
    {embed="includes/.html-head"}
    
    {begin_body}
    
    {embed="includes/.header"}
    
    {begin_content_with_sidebar}
    
    <h3>Celebration Sisterhood</h3>
    
    <p>{exp:weblog:entries weblog="messages" category="107" limit="5" orderby="messages_date" paginate="both" disable="member_data|trackbacks" search:messages_audio="not IS_EMPTY"}

  • #9 / Mar 24, 2011 5:07pm

    brianhoffman

    16 posts

    Can you post the source code for “includes/.navigation-sub”?

  • #10 / Mar 24, 2011 5:11pm

    CelebrationWeb

    38 posts

    If you look at the Resource tab that is what I am trying to remove and put all of it’s children under Messages. Now I just added Resources back to the menu and moved Podcasts back to Resources. Now it appears as a child under both???

  • #11 / Mar 24, 2011 5:12pm

    CelebrationWeb

    38 posts

    <ul class="list-link">
        {!-- atran:  get the sub navigation items by using the URL structure.  since the URL structure is based off of category URL titles, we can grab the template_group (parent category) and get its children.  those children are our navigation links. --}
        {exp:query sql="SELECT c2.cat_name AS cat_name, c2.cat_url_title AS cat_url_title FROM exp_categories c1 INNER JOIN exp_categories c2 ON c1.cat_id = c2.parent_id WHERE c1.cat_url_title = '{segment_1}' AND c2.parent_id = c1.cat_id ORDER BY c2.cat_order ASC"}
            <li><a{if cat_url_title == segment_2} class="current"{/if} href="{path="{segment_1}/{cat_url_title}"}">{cat_name}</a></li>
        {/exp:query}
    </ul>
    
    {if segment_1 == "giving"}
    <div class="gutter">
        "...for God loves a cheerful giver. And God is able to make all grace abound to you, so that in all things at all times, having all that you need, you will abound in every good work." <strong>2 Corinthians 9:7b-8</strong>
    </div>
    {/if}
  • #12 / Mar 24, 2011 5:21pm

    brianhoffman

    16 posts

    The first and third chunks of code you posted look generic enough that you probably don’t need to change them to add a new section. Can you post the code for “includes/.content”?

  • #13 / Mar 24, 2011 5:24pm

    CelebrationWeb

    38 posts

    {!-- atran: get the category id from the URL so that we can display the right content.  the SQL statement works because our template groups/templates are named according to the category URL titles.  one interesting case is when the visitor is on the index of a template group.  /template_group/index or just /template_group/.  This case is handled by everything after the OR in the SQL.  --}
    
    {exp:query sql="SELECT cat_id, cat_name FROM exp_categories WHERE cat_url_title = '{segment_2}' OR cat_url_title = '{segment_1}' ORDER BY parent_id DESC LIMIT 1"}
    
    {!-- atran: in the rare case our SQL doesn't produce any results, we don't want to output anything.  without this check, all entries in the weblog would be displayed.  not what i would call ideal.  --}
    
    {if cat_id}
    {exp:scripturizer}
    {exp:weblog:entries weblog="static_content" dynamic="off" category="{cat_id}" disable="categories|member_data|pagination|trackbacks" orderby="static_order"}
    
    <h3>{title}</h3>
    
    <p>{if static_image != ''}<br />
    {static_image}<br />
    {/if}</p>
    
    <p>{static_content}</p>
    
    <p>{/exp:weblog:entries}<br />
    {/exp:scripturizer}<br />
    {/if}</p>
    
    <p>{/exp:query}

  • #14 / Mar 24, 2011 5:34pm

    brianhoffman

    16 posts

    So most of the site actually is dynamic and not static like I thought earlier. So the keys are most likely to make sure all of your URLs are correct, since the SQL queries use them and to make sure all your categories are set up properly. If you made any changes to the templates, you might want to change them back.

    The URL for the Messages tab appears messed up. While the URLs for most of the other main tabs only have a segment_1, that one has a segment_1 and a segment_2, which probably isn’t right. Are those URLs hard coded in includes/.header? Start there and let’s see what happens.

  • #15 / Mar 24, 2011 5:43pm

    CelebrationWeb

    38 posts

    Nope, the only thing in there is for those few items above the nav bar. I think I’ll just try to re-populate the Resource tab, then move Messages under resources and rename Resources to Messages. I don’t know why but they want it to be a child of itself.

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

ExpressionEngine News!

#eecms, #events, #releases