1

I have come across this issue and I cannot figure out what I am doing wrong.

I have this code in an include file:

<!-- .site-title -->
          <hgroup>
          {exp:channel:entries channel="site_image" limit="1"}
            <h1 class="site-title"><a href="{site_url}" title="title here" rel="home"><img src="{site_image}" alt="{title}"></a></h1>
            {/exp:channel:entries}
            {if segment_1 == ""}{site_intro}{/if}
          </hgroup>
          <!-- .site-title -->

This all seems fine and works on all the pages of the site it is embedded into, except static pages created with the 'Pages Module'. On those pages I get this output from the browser:

<!-- .site-title -->
          <hgroup>


          </hgroup>
          <!-- .site-title -->

Nothing at all appears between the tag pair. Any help would be greatly appreciated.

2
  • The first thing to check would be to make sure the URL you are accessing matches the Pages URI that you set in the pages control panel. To make absolutely super-duper sure, add url_title="{segment_1}" and dynamic="no" to your {exp:channel:entries} tag.
    – kmgdev
    Apr 17, 2013 at 20:58
  • May thanks for your input, much appreciated. Apr 18, 2013 at 9:46

1 Answer 1

1

Sounds like a classic dynamic="no" situation. Add this to your exp:channel:entries tag:

{exp:channel:entries channel="site_image" limit="1" dynamic="no"}
2
  • Many thanks to all. Yes this worked fine. Would you be able to explain why that worked? Apr 18, 2013 at 9:45
  • dynamic="no" basically lets the exp:channel:entries tag ignore any information that might be present in the url. It's a classic EE quirk that trips up even experienced devs. Full documentation here: ellislab.com/expressionengine/user-guide/modules/channel/… Apr 18, 2013 at 23:21

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.