I want to insert links to media on a page, with publish dates and removal dates. What is the best way to accomplish this? I see this functionality exists out of the box for content nodes, is there some way to leverage that? Thanks for any guidance on this issue.
Not out of the box. When you say inert links do you mean in rich text editor? If NOT in rich text editor and they are properties eg media picker or multi node tree picker and you then you are writing out the links using a macro then you could put publish and remove date properties on media items and test for those dates in your macros when writing out the links.
If in Richtext edit you could do something similar but it would be more work and you would need to write a http handler to do it.
Ismail, thank you for the reply. To make sure I follow, I can add a couple properties to the media like "startDate" and "endDate" and write out the files with a macro? I will post back here with what I come up with in case it helps someone else.
That is correct. Like i said earlier this will only work if your writing out the images in a template or macro if the image is in via rich text edit field then this wont work you would need to write a httpmodule that uses those dates but it would be messy.
Thanks for your help so far. I can't figure out how to access my custom media properties. I created two custom properties, their aliases are StartDate and EndDate.
I want to add an If condition to only display those media items with a StartDate greater than or equal to today, or EndDate less than today, but I can't figure out how to access the properties. Here's my macro so far, which displays all the media items in the folder where I put them.
@using umbraco.MacroEngines;
@using umbraco.cms.businesslogic.media;
@inherits Umbraco.Web.Macros.PartialViewMacroPage
@{
var mediaFolder = Umbraco.Media(1853);
foreach(var jobPost in mediaFolder.Children())
{
<a href="@jobPost.umbracoFile">@jobPost.Name</a>
}
}
Is there a way to order the media items? Currently it's displaying the oldest item at the top. I'd like to order by my property "StartDate" descending.
publish date and remove date for media
I want to insert links to media on a page, with publish dates and removal dates. What is the best way to accomplish this? I see this functionality exists out of the box for content nodes, is there some way to leverage that? Thanks for any guidance on this issue.
Steve,
Not out of the box. When you say inert links do you mean in rich text editor? If NOT in rich text editor and they are properties eg media picker or multi node tree picker and you then you are writing out the links using a macro then you could put publish and remove date properties on media items and test for those dates in your macros when writing out the links.
If in Richtext edit you could do something similar but it would be more work and you would need to write a http handler to do it.
Regards
Ismail
Ismail, thank you for the reply. To make sure I follow, I can add a couple properties to the media like "startDate" and "endDate" and write out the files with a macro? I will post back here with what I come up with in case it helps someone else.
Steve,
That is correct. Like i said earlier this will only work if your writing out the images in a template or macro if the image is in via rich text edit field then this wont work you would need to write a httpmodule that uses those dates but it would be messy.
Regards
Ismail
Thanks for your help so far. I can't figure out how to access my custom media properties. I created two custom properties, their aliases are StartDate and EndDate.
I want to add an If condition to only display those media items with a StartDate greater than or equal to today, or EndDate less than today, but I can't figure out how to access the properties. Here's my macro so far, which displays all the media items in the folder where I put them.
Steve,
Try GetPropertyValue("StartDate") also i think do GetPropertyValue
Regards
Ismail
Excellent, that worked perfect! Thanks again for all your help.
Is there a way to order the media items? Currently it's displaying the oldest item at the top. I'd like to order by my property "StartDate" descending.
nevermind I figured it out. here is the line I had to change, in case it helps anyone
is working on a reply...