Our website has a carousel of images (Home Carousel Items), and all of these can only link to an internal node on the same domain. I'm trying to get one to link to an external site, and I'm trying to add a new property to the Home Carousel Item in the Settings tab. But I can't find an option for adding a property that will allow me to link to an external site. Any ideas?
One solution could be to use some of the packages there is to Umbraco. For your issue one package you could try is the uCompoents URL picker, with this you should be able to link external. The documentation for the URL picker can be found here: http://ucomponents.codeplex.com/wikipage?title=UrlPicker.
I mustmentionthat I havenĀ“t triedthe URL picker myself, buthave seen itsuggestedseveral times, when you have to create a external link.
Hi guys. Thanks for this. Fuji, I'm not at all familiar with .NET, very much a noob, and so far I've only used the Umbraco backend without diving into the source files. I'm not sure what Razor is - is it a package? If you could elaborate on where I might include that code snippet I'd be grateful.
Dennis, I think that could be a good option, only our install of Umbraco is 4.0.4.2 - quite old - but my company doesn't want to upgrade at this stage. I tried to install Contour recently (a legacy version, as the current version wasn't compatible with our version of Umbraco), and it busted the whole site; apparently it dumped a .dll file somehwere that conflicted with a file Google Analytics installed somehwere, and the result was a disaster! It's frustrating using an old version of Umbraco but I'm too scared to try installing another plugin....
Thanks Fuji. I'll read up on those links, and then next week get back to you with more info on the Carousel and how it integrates into our backend (it's Friday afternoon now, and home time!)
I was looking at your code to check for the property "externalUrlAlias". I have a "URL" property on externalLink doctype, so how might I implement your code with my current doctype?
I've gotten this to work, but if I look at the href url for the externalUrl in the HTML generated, it shows it as the umbraco page, even though it does correctly go to the url that was assigned to it in the property. Whats up with that?
Sorry for the extra post, but I wanted to expain. "ExternalLink" is a doctype and "url" is a property of that doctype that accepts a text string. So, it should be pulling the text string for the "url" not the item.Url. What do you think is happening? How can I fix it?
Unfortunately, that is not the problem. Even with a different property it is showing the full url for the page plus whatever the property holds at the end. So, it has to be something about what is in the variable "item".
Solved. Stupid typo. Apparently if you don't use a valid url when entering it in the text field for the property, umbraco adds the url of the page to the begining of the text string in the property and outputs that. Thanks for all your help Fuji!!
Add new property to external link
Hi
Our website has a carousel of images (Home Carousel Items), and all of these can only link to an internal node on the same domain. I'm trying to get one to link to an external site, and I'm trying to add a new property to the Home Carousel Item in the Settings tab. But I can't find an option for adding a property that will allow me to link to an external site. Any ideas?
Hi Tom,
You could simply make use of a textString where you will add the Url of the external link.
If you are planning to use razor then you have to do something like this
hope this helps
//fuji
Hi Tom.
One solution could be to use some of the packages there is to Umbraco. For your issue one package you could try is the uCompoents URL picker, with this you should be able to link external. The documentation for the URL picker can be found here: http://ucomponents.codeplex.com/wikipage?title=UrlPicker.
I must mention that I havenĀ“t tried the URL picker myself, but have seen it suggested several times, when you have to create a external link.
I Hope this could be a solution to you.
/Dennis
Hi guys. Thanks for this. Fuji, I'm not at all familiar with .NET, very much a noob, and so far I've only used the Umbraco backend without diving into the source files. I'm not sure what Razor is - is it a package? If you could elaborate on where I might include that code snippet I'd be grateful.
Dennis, I think that could be a good option, only our install of Umbraco is 4.0.4.2 - quite old - but my company doesn't want to upgrade at this stage. I tried to install Contour recently (a legacy version, as the current version wasn't compatible with our version of Umbraco), and it busted the whole site; apparently it dumped a .dll file somehwere that conflicted with a file Google Analytics installed somehwere, and the result was a disaster! It's frustrating using an old version of Umbraco but I'm too scared to try installing another plugin....
Hi Tom,
Can you tell us more on your project and how you are using umbraco to make your carousel ?
Razor is a so called "View engine" for ASP.NET MVC...and can work with ASP.NET web forms
Basically it's another option you can use to fetch data.
You can read some post here about razor and umbraco :
http://weblogs.asp.net/scottgu/archive/2010/07/02/introducing-razor.aspx
http://www.cultiv.nl/blog/2011/2/16/how-to-use-razor-in-umbraco
Thanks Fuji. I'll read up on those links, and then next week get back to you with more info on the Carousel and how it integrates into our backend (it's Friday afternoon now, and home time!)
Cheers for all your help...
Fugi,
I was looking at your code to check for the property "externalUrlAlias". I have a "URL" property on externalLink doctype, so how might I implement your code with my current doctype?
Hi Steve,
What do you mean by how to implement with your current docType? Can you show your current code ?
Sorry Fuji, here is my code.
Try this instead, remember to at a target=blank if you want an external url
I've gotten this to work, but if I look at the href url for the externalUrl in the HTML generated, it shows it as the umbraco page, even though it does correctly go to the url that was assigned to it in the property. Whats up with that?
Sorry for the extra post, but I wanted to expain. "ExternalLink" is a doctype and "url" is a property of that doctype that accepts a text string. So, it should be pulling the text string for the "url" not the item.Url. What do you think is happening? How can I fix it?
Hi Steve,
I would rather change the property from Url to extUrl. Url is already a helper in razor umbraco.
So this should work
var targetUrl = item.extUrl ? "target=_blank" : "";
var link = item.HasValue("extUrl")? item.extUrl : item.Url;
<li @childActive ><a href='@link' @targetUrl>@item.Name</a></li>
Unfortunately, that is not the problem. Even with a different property it is showing the full url for the page plus whatever the property holds at the end. So, it has to be something about what is in the variable "item".
Solved. Stupid typo. Apparently if you don't use a valid url when entering it in the text field for the property, umbraco adds the url of the page to the begining of the text string in the property and outputs that. Thanks for all your help Fuji!!
is working on a reply...