0

i am using following code for display title of next and previous article in current article detail page

          {exp:channel:prev_entry}
            {exp:channel:entries channel="teaching_tips" dynamic="off" limit="1" sort="desc"}
            <p> &laquo; Previous Article: <a href="{url_title}">{title}</a></p>
            {/exp:channel:entries}
            {/exp:channel:prev_entry} 

            {exp:channel:next_entry}
            {exp:channel:entries channel="teaching_tips" dynamic="off" limit="1" sort="desc"}
            <p>Next Article: <a href="{url_title}">{title}</a> &raquo; </p>
            {/exp:channel:entries}       
            {/exp:channel:next_entry} 

now i want to display only title of next and previous article which have same channel ="teaching_tips" but this code is display another channel entries how to stop this ?

and i want to display next article link when i will open 1st entry and when i will open last entry i want to display only previous article link how this i can do this ?

Thank you.

2

You would want to remove the channel entries loops you have stuck within the next entry and previous entry tags - they themselves should contain the channel parameter:

{exp:channel:prev_entry channel="teaching_tips"}
   <p> &laquo; Previous Article: <a href="{url_title}">{title}</a></p>
{/exp:channel:prev_entry} 

{exp:channel:next_entry channel="teaching_tips"}
   <p>Next Article: <a href="{url_title}">{title}</a> &raquo; </p>
{/exp:channel:next_entry}

Like the entries loop itself, the pref_entry and next_entry tags, in absence of a channel parameter, will load from all channels.

0

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.