2

I'm trying to output an image of the next post within my template like so...

{exp:channel:next_entry}
   <img src="{testimony_story_background}"/>
{/exp:channel:next_entry}

It doesn't work. What is the correct way to do this using a custom field that has been set up? I have tried using the query module but that that only seems to work outputting simple text fields. Here is an example...

{exp:query sql="SELECT field_id_16 FROM exp_channel_data WHERE entry_id = '{entry_id}'"}
   {field_id_16}
{/exp:query}

Any help would be wonderful!

1

Its not working because you aren't specifying a channel.

{exp:channel:next_entry channel="testimony"}
   <img src="{testimony_story_background}"/>
{/exp:channel:next_entry}

Couple things to keep in mind:

1.)These links can only be used on pages displaying a single entry, such as a “comment” page, since they are designed to provide navigation from one entry to another.

2.) These tags cannot be placed inside your main Channel Entries Tag. They must be placed outside of the Channel Entries tag in order to work correctly.

3.) If you are viewing the most recent entry in your channel, then the “next_entry” tag’s contents will not be shown (since there is no “next entry”). Likewise, when you are viewing the oldest/first entry in the channel the “previous_entry” content will not be shown.

0

You'll likely need to embed another channel entries tag inside the next_entry pair like this.

Main template

{exp:channel:next_entry}
   {embed="includes/_next_image" entry_id="{entry_id}"}
{/exp:channel:next_entry}

Embedded Template

{exp:channel:entries entry_id="{embed:entry_id}" limit="1"}
    <img src="{testimony_story_background}"/>
{/exp:channel:entries}
0

I managed to do the following with the queries module and using a parse file path plugin:

 {exp:query sql="SELECT field_id_28 AS file FROM exp_channel_data WHERE entry_id = '{entry_id}'"}
                    {exp:parse_file_paths}
                        {file}
                    {/exp:parse_file_paths}
                    {/exp:query} 

Plugin: https://github.com/rsanchez/parse_file_paths

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.