0

I have a need to place a few links into various templates to pages that might have their names changed as other individuals do SEO things that I do not agree with. I was thinking the easiest way to add a url in a header as a callout would be by the entry_id. I am not finding any way to get the URL from the entry_id other than writing my own plugin, which I did using the help of a stackoverflow answer that clued me into the url's being stored in the global array: https://stackoverflow.com/questions/8245405/expressionengine-how-to-get-the-path-of-a-page-given-its-entry-id-with-the-str

I suspect that this is a problem others have a better solution for already, but being so new to EE I just do not know of? Or maybe the need to change a pages url and title is not common enough for the need for a solution?

2
  • I'd like to help but I'm not sure I entirely understand what you are trying to do. Could you provide an example? – spacesuitdiver Jul 31 '13 at 16:48
  • An example is in my header I want to have a link to a signup form. The name and url of that signup form will change as CMS users change things, so I cannot reference it by any fields in EE they could change. There are other areas that they want to change urls for which require template group name changes, and channel name changes so things still make sense for them. – Jared Chmielecki Aug 1 '13 at 17:47
1

You can use {title_permalink} or {url_title_path} to output a link to a page with its current url title. Like:

{exp:channel:entries channel="some_channel" entry_id="12|43|55"}
    <a href="{title_permalink='your_template_group/your_template'}">{title}</a>
{/exp:channel:entries}
2
  • That is a lot of code, and an extra entries loop to accomplish a single url, and it still relies on hardcoding the templategroup and template! My solution is <a href="{exp:url_from_id id="2261"}" ... – Jared Chmielecki Aug 1 '13 at 17:43
  • My post was based on available info at the time. Hardcoding template group and template is par for the course in EE as that goes along with planning. Also, not sure why you'd want to accommodate template/channel name changes. To cache the above answer, you could use Stash and save the link(s) for a time without replacing, so it wouldn't run until time to refresh. – Romans-8---31-39 Aug 1 '13 at 18:14

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.