0

EE 5.2.2

I have a site that I'm building for a client. It was my intention to have certain elements in the _html-wrapper layout be dynamic so they could change them as they desired (image, short description, hours of operation, etc). I created a homepage channel with a single entry to handle this content.

The section looks like this

{exp:channel:entries channel="homepage" limit="1"}
    <section class="w-4" style="min-width:15em;">
          <h1><a href="{homepage}"><img src="{header_icon}" /><b>{site_name}</b></a></h1>
    </section>
    <section class="w-5">
          <p class="description">{entry_description}</p>
    </section>
    <section class="w-4">
          <p>{address}</p>
    </section>
    <section class="w-2">
          <p>{hours_of_operation}</p>
    </section>
{/exp:channel:entries}

It's working just fine until I get into an entry page, at which time it does not render.

So example.com works, example.com/product works, but example.com/product/entry/entry-page does not work.

Is there some sort of conflict with channel entries from different channels rendering on entry pages?

Also, I'm working off of the example site (since I'm still new to EE).

Thanks a lot!

1 Answer 1

2

It is not so clear from what you say what actually you are trying to do, but at the simplest level, it seems that while example.com/product generates output when applied to the template fragment you provide, example.com/product/entry/entry-page does not.

Probably this down to a parameter dynamic="no" that is missing from your {exp:channel:entries} tag.

In the default state, EE will try and guess what channel entry to look up based on the URL slugs, which works fine in simple cases, but is less reliable with more complex ones.

When you add dynamic="no" parameter to the tag, you are telling EE to look up the entry based just on the information given within the tag parameters.

It might be a better solution for you to feed the {exp:channel:entries} tag with the parameters you want it to use. You can do this using the url_title parameter, and feeding it the segment of the URL that has the right url_title for the entry you want to look up in your {exp:channel:entries} call. Something like:

{exp:channel:entries channel="homepage" limit="1" url_title="{segment_1}" dynamic="no"}

...

{/exp:channel:entries}

The variable {segment_1} is a segment variable and returns the content of the first slug in the URL - so in your example case production. It will return this regardless of what follows the first segment (but these are available via {segment_2}... etc. if needed.

There are other ways to do these things, and I may have guessed wrong about what you are trying to do, but maybe this will be of some use.

HTH

1
  • That was it! Adding dynamic="no" was the solution. Excellent support, sir.
    – Shayne
    Commented Jun 5, 2019 at 15:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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