2

I have a specific entry I want to display when a user navigates to that particular section of the website. To clarify, I have an "about us" section of a church website where, when the user clicks on "about us" it takes them to the a url "pastors-welcome". From there there are listings in the sidebar for other entries in that channel. I am wondering if the way I have coded this is the most efficient method? I'm new to EE and as with anything new, you just don't know what you don't know. looking to you guys n' gals for the wisdom that comes from experience.

{if segment_2 == ""}
        {exp:channel:entries channel="content" limit="1"     disable="categories|member_data|pagination" url_title_path="pastors-welcome"}


            <h1 class="section-header">{title}</h1>
            <p><img class="body-image-left" src="{image:small}" alt="{image_description}" title="{image_description}"/>{page_content}</p>

        {/exp:channel:entries}
    {/if}

    {if segment_2 != ""}

        {exp:channel:entries channel="content" disable="categories|member_data|pagination"}
        <h1 class="section-header">{title}</h1>

        <p>
        {if image != ""}<img class="body-image-left" src="{image:small}" alt="{image_description}" title="{image_description}"/>{/if}

        {page_content}

        </p>

        {/exp:channel:entries}
    {/if}
2

I've built quite a few church websites with EE over the years.

I'd now use Structure but I did build my first church website similarly to how you did where I had an 'about' template group.

In terms of your channel entries, there's no need for your segment conditional or setting the url_title parameter. If you're linking to /about/pastors-welcome - by default, EE will look at segment_2 and load the corresponding entry. Here's a good explanation by Mr Boyink.

{exp:channel:entries channel="content" limit="1" {gv_param_disable_default}}

<h1 class="section-header">{title}</h1>
        <p><img class="body-image-left" src="{image:small}" alt="{image_description}" title="{image_description}"/>{page_content}</p>

    {/exp:channel:entries}

Then in my sidebar I'd have another channel entries tag disabling everything other than the title for that channel and link items via the url_title_path variable.

| improve this answer | |
  • ok, that's awesome, and TOTALLY helps. My next question is in regards to the last part of your statement. I didn't post the code, but my sidebar is all crazy conditionals as well. Can you elaborate on your comment: "Then in my sidebar I'd have another channel entries tag disabling everything other than the title for that channel and link items via the url_title_path variable." – hyphen81 Jan 8 '13 at 3:02
  • also, I have watched boyink's video on the dynamic property, and I thought it made sense, but now I'm second guessing it. In my side bar, I have dynamic="no" on channel entry tags, which I thought would prevent them from displaying a link in the list to the current channel entry. – hyphen81 Jan 8 '13 at 3:05
  • Sure - so with the sidebar you could go for something like {exp:channel:entries channel="content" dynamic="no" url_title="not {segment_2}" {gv_param_disable_all}} <a href="/about/{url_title}">{title}</a> {/exp:channel:entries} that said, I wouldn't normally exclude the current entry on the nav, I'd simply add an active class to the current entry. – Steven Grant Jan 8 '13 at 3:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.