1

I am building a newsletter template that will display between 5 and 7 articles. My client will get to choose which articles will display by putting the entry_id's in the url (ex. http://site.com/newsletter/111/222/333/444/555/666). How can I do this? Also, I am using an older verion of EE (hence the use of 'weblog'). Below is my code, which only works if there's 1 article (ex. http://site.com/newsletter/111)

{if segment_1 != "" }

{exp:weblog:entries entry_id="{segment_1}" limit="1" dynamic="no" disable="member_data|pagination|categories"}

            <tr>
                <td valign="top" width="150">
                    {if image != ""}<a href="{url_title_path="/article"}" alt="{title}" title="{title}" target="_blank">{image}</a>{/if}
                </td>
                <td valign="top" width="14"></td>
                <td valign="top" width="380">
                            <a href="{url_title_path="/article"}" alt="View {title}" title="View {title}" target="_blank">{title}</a>
                            <br /><br />
                            {if alt_summary != ""}
                                {exp:strip_p}{alt_summary}{/exp:strip_p}
                            {if:else}
                                {exp:strip_p}{summary}{/exp:strip_p}
                            {/if}
                </td>
            </tr>
{/exp:weblog:entries}

{/if}

{if segment_2 != "" }

{exp:weblog:entries entry_id="{segment_2}" limit="1" dynamic="no" disable="member_data|pagination|categories"}

            <tr>
                <td valign="top" width="150">
                    {if image != ""}<a href="{url_title_path="/article"}" alt="{title}" title="{title}" target="_blank">{image}</a>{/if}
                </td>
                <td valign="top" width="14"></td>
                <td valign="top" width="380">
                            <a href="{url_title_path="/article"}" alt="View {title}" title="View {title}" target="_blank">{title}</a>
                            <br /><br />
                            {if alt_summary != ""}
                                {exp:strip_p}{alt_summary}{/exp:strip_p}
                            {if:else}
                                {exp:strip_p}{summary}{/exp:strip_p}
                            {/if}
                </td>
            </tr>

{/exp:weblog:entries}

{/if}
1
  • 1
    I forgot to mention that the above code is embedded, so it apeears on the page <table>(the code)</table>
    – Allison S
    Nov 13 '14 at 15:24
1

I never used EECMS 1, but I gonna try to help you.

There are some errors on your code.

  • The segment_1 is always newsletter. You never could use it on {exp:weblog:entries entry_id="{segment_1}" [...];

  • if your second conditional evaluates as true, both your conditionals will evaluate, because you need a segment_1 to have a segment_2;

  • if both codes are the same, you don't need two conditionals;

  • if you want to pass more than one id, you can't use the limit parameter;

  • EECMS 1 used on and off as parameter values; not yes and no;

  • trackbacks was also a possible value for the disable parameter on EECMS 1.

    Why not http://site.com/newsletter/111|222|333|444|555|666?

You could use:

{if segment_2 != "" }

    {exp:weblog:entries entry_id="{segment_2}" dynamic="off" disable="categories|custom_fields|member_data|pagination|trackbacks"}

        <tr>
            <td valign="top" width="150">
                {if image != ""}<a href="{url_title_path="/article"}" alt="{title}" title="{title}" target="_blank">{image}</a>{/if}
            </td>
            <td valign="top" width="14"></td>
            <td valign="top" width="380">
                        <a href="{url_title_path="/article"}" alt="View {title}" title="View {title}" target="_blank">{title}</a>
                        <br /><br />
                        {if alt_summary != ""}
                            {exp:strip_p}{alt_summary}{/exp:strip_p}
                        {if:else}
                            {exp:strip_p}{summary}{/exp:strip_p}
                        {/if}
            </td>
        </tr>
    {/exp:weblog:entries}

{/if}

Even better, you could put the conditional around the embed, to prevent its parsing:

{if segment_2 != "" }
    {embed="newsletter/articles"}
{/if}

I hope it helps.

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.