All Low add-ons are now owned by EEHarbor. Read the blog post.

Support archive

Looking to grab url_title for selected entry

QB Marketing 12 Jun 2012 11:51 question, complete

Hi Low:

I know that the intention with the selected entries variable type is to grab the ID of the entry, but is there a way to parse its url title as well? In this particular case, I've got a footer link for "privacy policy" but this needs to link dynamically to a given entry in the client's "policies" channel and so rather than link by ID, I want to be able to have the path, including the url_title of the privacy policy page, as the link in the footer. Is this possible? Or I am going to need a combination of the ID as stored in the variable type and a query to look up the URL title for that entry?

Replies

  1. Low 12 Jun 2012 12:43

    Yeah, best way to do this now is to use the Query module or a stripped down version of the channel:entries tag.

  2. LutzH 20 Jun 2015 23:57

    Wow, three years ago... ;) Just had a similar problem. A customer want to have 4 fixed positions for featured content on his homepage. Admins have to select entries with status "featured", but want to set a different title, a different teaser text, upload a special featured image or embed a video--and want to edit all fields for these positions in one place.

    My setup is to create 4 Low Variables groups with all the variables needed for editing. To avoid using four more DB queries, I was looking for a way to use the Select Entries variable type to save the url titles, to get them (instead oy the entry IDs) as variable values. What I did was to clone low_select_entries.

    In the function display_input I added t.url_title to the Get entries query and changed line 350 to:
    $entries = low_flatten_results($query->result_array(), 'title', 'url_title', 'entry_id');

    That works so far, but I'm in a hurry and unsure if I could have missed something here, which could lead to errors.