0

I'm trying to create a Prev / Next navigation system using thumbnail images. The images for each entry are held in a four column matrix field (field_id = 8). I just want the first image held in the first column (col_id_38).

I'm using R.Sanchez's {exp:parse_file_paths} plugin to pull the image data without resorting to more embed or stashed lists.

Since {exp:channel:prev_entry} has to parsed outside of the {exp:channel:entries} tag, my current detail page template looks like this:

{exp:channel:entries channel="{segment_1}" disable="member_data|pagination" url_title="{segment_2}"}
    {title}
    {body}
    {stash:embed name="snippets:page-villanav" process="start" parse_depth="2"}
{/exp:channel:entries}

The stash:embed which looks like this:

{exp:channel:next_entry channel="{segment_1}" entry_id='{exp:transcribe:entry_ids channel="villa"}' parse="inward"}
    <div class="gallery">
       <a href="{path={segment_1}}">
       {title} // This is showing the correct Next entry title
       {exp:query sql="SELECT * FROM exp_matrix_data WHERE field_id = '8' && entry_id = '{entry_id}'"}
            {entry_id}          // This is showing the correct "Next" entry_id
            {exp:parse_file_paths}
                {background_image} 
                    {image_01}  // This is showing the current entry's image filepath. Not the "Next" entry's first image filepath.
                {/background_image}
            {/exp:parse_file_paths}
        {/exp:query}
       </a>
    </div>
{/exp:channel:next_entry}

The problem is that, despite the query displaying the "Next" entry_id, {exp:parse_file_paths} is pulling the first image from the matrix field for the "current" entry.

Any clues?

1 Answer 1

0

Solved it:

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

Your Answer

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

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