ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

load entries based off of URL

April 02, 2012 12:01pm

Subscribe [1]
  • #1 / Apr 02, 2012 12:01pm

    This is for a pdf generator, so I have to send a specific url that in turn loads in entries based off of that url. I used to load in entries off of a segment like:
    site.com/template/entries/14|15|16

    But since Google killed the pipe character in url addresses, I have to find a workaround. Now the same address from above would be:
    site.com/template/entries/14|15|16

    I can still pull the last segment and replace | with | in a preload variable, but I can’t find a way to use that preload variable to then get EE to pull the entries.

    Here’s my preload:
    {preload_replace:url_segment="{exp:low_replace find='|' replace='|'}{segment_3}{/exp:low_replace}”}

    it generates 14|15|16

    Here’s my channel call:
    {exp:channel:entries channel="channel" entry_id="{url_segment}”}
    {title}
    {/exp:channel:entries}

    If I just type in the entry string (14|15|16) in the preload, instead of using the url segment, it works.

    Does anyone out there have a solution?

  • #2 / Apr 03, 2012 10:09am

    glenndavisgroup

    436 posts

    Hi Marketing Alliance, Inc.,

    Try the following:

    {exp:channel:entries channel=“channel” entry_id=”{exp:low_replace find=’|’ replace=’|’}{segment_3}{/exp:low_replace}”}
    {title}
    {/exp:channel:entries}

    I hope that helps.

    Mike

  • #3 / Apr 03, 2012 10:12am

    glenndavisgroup

    436 posts

    I think the URL encoded characters you posted got converted to | pipe. Please change the find=”” to that pipe encoded character before using the code I posted so it will work for you.

    Mike

  • #4 / Apr 03, 2012 3:33pm

    Thanks Mike,

    I scrapped the replace plugin and opted for a php solution to do my url conversion. It meant turning on php on input, but it was only for one template.

    <?
    $this->EE =& get_instance();
    $seg3 = $this->EE->uri->segment(3);
    $seg3 = str_replace('%*7C','|',$seg3);
    ?>
    
          {exp:channel:entries channel="channel" entry_id="<? echo $seg3; ?>" dynamic="no" show_future_entries="yes"}

    And yes, it’s rendering the pipe character in this post, so take the * out of %*7C in the code above to get this to work.

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases