Hi, if I call umbraco.library:GetMember(id) in XSLT one of the attributes is @urlName.
I would like to use this to key the member in a macro, by writing my own extension function that returns the member matching the urlName. Trouble is, the Member object doesn't have a urlName property and I can't work out how to create it to match the search - any ideas?
Hi. It's true - the urlName of a member is in fact unavailable when using the Member class API. Perhaps you can use some sort of a hack - the source code reveals that this urlName is formed by removing all spaces from the member name and lowercasing it than.
Hmmm, I'd be happy with that - I don't have a copy of the source at the moment, I don't suppose you could post the code for creating the urlName so I can duplicate it exactly could you?
Hmmm, that won't work if the member name contains ampersands (the members are companies, in this instance); looks like that urlname thing is an old hangover no longer used, because the content one is cleverer than that. I think I'll just create my own URL friendly keying system.
The members for this site are company records; companies can log on and view various protected documents and things from their area, but they also appear in a directory that is visible to the public.
I am creating a macro to display details for a request company; I would like to be able to use it with a readable URL like /directory/my-company - so I need to be able to look up on the company name.
However, litterally as I was typing that you made me think; in order to absolutely guarantee uniqueness the easiest thing to do would be to append the member ID, like /directory/1011-my-company and I can use the URL rewrites to get the ID. Still a little bit ugly though.
If you have any better suggestions then please feel free :o)
urlName for members
Hi, if I call umbraco.library:GetMember(id) in XSLT one of the attributes is @urlName.
I would like to use this to key the member in a macro, by writing my own extension function that returns the member matching the urlName. Trouble is, the Member object doesn't have a urlName property and I can't work out how to create it to match the search - any ideas?
Hi. It's true - the urlName of a member is in fact unavailable when using the Member class API. Perhaps you can use some sort of a hack - the source code reveals that this urlName is formed by removing all spaces from the member name and lowercasing it than.
Hmmm, I'd be happy with that - I don't have a copy of the source at the moment, I don't suppose you could post the code for creating the urlName so I can duplicate it exactly could you?
This is exactly how umbraco does it:
(The "this" refers to an instance of the Content class which the Member class inherits).
Wow, I just assumed you were simplifying it, that looks like it could generate issues aplenty - duplicates? Odd characters?
Ah well thankyou!
Hmmm, that won't work if the member name contains ampersands (the members are companies, in this instance); looks like that urlname thing is an old hangover no longer used, because the content one is cleverer than that. I think I'll just create my own URL friendly keying system.
Well, may I ask you - how are you going to use this urlName?
The members for this site are company records; companies can log on and view various protected documents and things from their area, but they also appear in a directory that is visible to the public.
I am creating a macro to display details for a request company; I would like to be able to use it with a readable URL like /directory/my-company - so I need to be able to look up on the company name.
However, litterally as I was typing that you made me think; in order to absolutely guarantee uniqueness the easiest thing to do would be to append the member ID, like /directory/1011-my-company and I can use the URL rewrites to get the ID. Still a little bit ugly though.
If you have any better suggestions then please feel free :o)
is working on a reply...