This site has been archived and you can no longer log in or post new messages. For up-to-date community resources please visit ezplatform.com

eZ Community » Forums » General » Linking to objects using their alias...
expandshrink

Linking to objects using their alias in ezoe GUI

Linking to objects using their alias in ezoe GUI

Wednesday 15 September 2010 12:34:35 am - 5 replies

Hi all,

When using ezoe's link-create/edit GUI, I'd like to be able to have a link created that uses an object's custom URL alias.

Currently in ezoe, you can link to a node_id, object_id, http, https etc but there's no way to choose which virtual URL will be used for the link.

Here's an example of what I mean:

Say I have an article content-object: node_id = 7116, short_title = 'my page'. It normally exists at: 2/183/7116 (Main/Folder1/my-page).

I then add an additional location to the object: eZ generates a new node_id and the clone's location is at: 2/184/7117 (Main/Folder2/my-page).

Now I create a custom alias for Main/Folder2/my-page: Main/Folder2/your-page, and would like to link to this object but using the alias as the url.

At the moment when I save/preview the article, the link has actually been created using the original object's short_title not the clone's alias.

Is there a way for ezoe to check if an alias exists for an object being linked-to in the popup dialogue, and prompt the user for which URL they would like to be used?

I hope this makes sense, or there might be an alternative solution that I haven't seen yet. At the moment, the only use for additional aliases is when linking in template overrides, but not for standard linking from ezoe, without needing to write any code.

Thanks a lot.
Russ

Wednesday 15 September 2010 1:32:39 am

Why not just use Main/Folder2/your-page as the link?

I havent tried this, but maybe you could edit templates/content/datatype/view/ezxmltags/link.tpl and do:

$node = fetch(content, node, hash( node_path, $href ));

If a node matches, then find a way of getting its url aliases and use one that was created manually. If no node matches, just leave $href as the link. To find a node's url aliases you can make a template operator that searches the ezurlalias table.

Wednesday 15 September 2010 3:54:06 am

>Why not just use Main/Folder2/your-page as the link?

That's exactly it - you can't. You can link to the node_id or object_id etc but the generated path is the original auto-generated alias, not one of the custom aliases - hence my wondering how one might modify ezoe to ask the user which custom alias she would like to use (if one exists).

Thanks for taking the time to reply Gabriel but I was wondering wether this was do-able from the ezoe GUI without writing code - it seems to me otherwise that the custom URL alias's are only of limited use if they cannot be utilised at the GUI level.

I thought of the template override method as well, but cannot seem to retrieve a node using this kind of fetch (no error message) - thanks a lot regardless

Russ

Wednesday 15 September 2010 4:09:44 am

I have added this as enhancement 17284.

Cheers all,
Russ

Wednesday 15 September 2010 6:47:42 pm

Why not just use Main/Folder2/your-page as the link?

What I mean is, why not just put "/Main/Folder2/your-page" as a regular link instead of an eznode link? Letting you choose which url alias you want to use is almost the same as typing the url yourself in the href input.

Wednesday 15 September 2010 11:01:58 pm

Why not just use Main/Folder2/your-page as the link?

What I mean is, why not just put "/Main/Folder2/your-page" as a regular link instead of an eznode link? Letting you choose which url alias you want to use is almost the same as typing the url yourself in the href input.

Ah I see. I trued the full path (inc hostname) but that didn't work in my scenario (Static deployment) but using the URI (the pathname) did! I'd never bothered to look at using the 'other' field - but that works.

I maintain that some functionality in ezoe that prompts for an existing alias selection would be idea, but this will do me for now.

Thank you so much for your perseverance Gabriel! happy.gif Emoticon

Have a good one!
Russ

expandshrink

You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu

Proudly Developed with from