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.

Forcing the url to display the entry id

May 06, 2011 5:00pm

Subscribe [5]
  • #1 / May 06, 2011 5:00pm

    Nicolas Landry

    6 posts

    Hi there,

    This might be simple to fix, but I can’t figure out how to do it, and my forum/google searches yielded nothing.

    I have a SAEF set up to modify entries. So from the entry itself, I have a link that leads to the SAEF template, passing along the entry id from the url, using the {segment_3} variable.

    But when I access the template directly (http://www.mysite.com/index.php/group/template), the first entry is displayed, but I have no entry id to pass along to my SAEF.

    Can I force the url to display the entry id?

    Is there a better way to do this?

    Thanks in advance.

  • #2 / May 06, 2011 8:01pm

    Natetronn

    161 posts

  • #3 / May 06, 2011 8:02pm

    Natetronn

    161 posts

    Actually I am pretty positive that is what you are looking for 😉

  • #4 / May 08, 2011 3:05pm

    Greg Salt

    3988 posts

    Hi Nicolas,

    Welcome to the forums!

    Did Natetronn’s suggestion help you with this?

    Cheers

    Greg

    @Natetronn, thanks for the help.

  • #5 / May 09, 2011 10:07am

    Nicolas Landry

    6 posts

    Thanks for the reply Natetronn, exactly what I was looking for.

    But for some reason the tag is not being interpreted by ee.

    {path} works fine, but {entry_id_path} just shows up in my url with brackets and all.

    Pretty odd.

  • #6 / May 09, 2011 10:38am

    Mark Bowen

    12637 posts

    I think you’re going to need to show some code that you already have showing how you have the {entry_id_path} code in your template.

    If you want to have a list of entries and then on each one have a link which leads to a template with the entry_id appended to the end then the {entry_id_path="template_group/template_name"} variable should definitely do what you’re after.

    Therefore if you can show the code you currently have then this should enable everyone to help get this fixed for you.

    Best wishes,

    Mark

  • #7 / May 09, 2011 11:12am

    Nicolas Landry

    6 posts

    Hi Mark,

    Thanks for jumping in.

    Let’s say the entry is located at mysite.com/index.php/members/editorial/23

    I set up an Edit entry link like this:

    Edit entry

    which returns: mysite.com/index.php/saef/editorial/23

    This works great until I try to edit the latest entry of a channel, because not entry id is appended to the url.

    So i’m thinking <a href=”{entry_id_path='saef/{segment_2}’}”> will do the trick, but it returns

    mysite.com/index.php/members/editorial/{entry_id_path='saef/editorial'}

    I probably misunderstood something.

  • #8 / May 09, 2011 11:23am

    Cheif

    626 posts

    I think maybe you’re trying to achieve too much with one template. Generally you require 2 templates - A summary Template (listing the entries) and a Detail Template (view the actual entry).

    The URL structure provided means that if the user visits mysite.com/index.php/saef/editorial/ they will see the latest article not because you coded it so but because EE is looking for an Identifying something in the URL and in lieu of anything falls back to the latest - not ideal.

    I’d be inclined to rethink the editing strategy and pulling the “edit” buttons back to the Summary Template so you can target a real ID or use an {if segment_2 == empty} {redirect='/members'}{/if} to send them back to the Summary page.

  • #9 / May 09, 2011 11:31am

    Mark Bowen

    12637 posts

    I’m still a little confused as to what exactly it is that you’re trying to do here but you must make sure that the {entry_id_path} variable is inside a Channel Entries Tag in order for it to work.

    Perhaps check that first.

    Best wishes,

    Mark

  • #10 / May 09, 2011 11:48am

    Nicolas Landry

    6 posts

    Boom, Mark nailed it.

    I was outside the Channel Entries Tag.

    Thanks everyone for your input.

    Cheers- Nicolas.

  • #11 / May 09, 2011 11:53am

    Mark Bowen

    12637 posts

    Boom, Mark nailed it.

    I was outside the Channel Entries Tag.

    Thanks everyone for your input.

    Cheers- Nicolas.

    Excellent news. Glad that got it sorted for you.

    Hope everything else goes well for you.

    Best wishes,

    Mark

  • #12 / May 09, 2011 6:02pm

    Natetronn

    161 posts

    Mark usually nails it’s as he is the doozazzle for sure!

  • #13 / May 09, 2011 6:04pm

    Mark Bowen

    12637 posts

    Mark usually nails it’s as he is the doozazzle for sure!

    It was definitely a joint effort 😊

    Best wishes,

    Mark

  • #14 / May 10, 2011 5:51am

    John Henry Donovan

    12339 posts

    Thanks guys 😊 Closing this one out. Feel free to start a new thread if you have any more questions

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

ExpressionEngine News!

#eecms, #events, #releases