Associate an image to a news

Posted by Community Admin on 03-Aug-2018 15:26

Associate an image to a news

All Replies

Posted by Community Admin on 25-Nov-2010 00:00

Hi,

I just can't figure out in Sitefinity 4.0 how you could associate an image to a news. the idea is to let content writers add news, specify comments / tags... and a specific image. Then having the possibility in the News list control to display the news title, summary,... AND image (or thumbnail).

Is that possible and how could I do that ?

thanks for your help

Francois

Posted by Community Admin on 25-Nov-2010 00:00

The option to upload/associate image to a news item is in the news editor. I believe right now there is no way to show just the image in news listing from vanilla Sitefinity.


However, the NewsRotator sample module come with the SDK does just that (with some work arounds).

Posted by Community Admin on 26-Nov-2010 00:00

Hello Francois,

Having thumbnails for news is in the tasks for implementation after official release (#100328).
This is an important feature and we consider it of importance.

In the meanwhile you can use a workaround for that:
1) upload your image in a section Images
2) in the Edit News page, insert a link to the image uploaded in step 1 in of the additional fields which you will not be using for something else (i.e."Source URL")
3) In section Design> Widget Templates, modify the News widget template to include the field from step 2.

Other custom implementations are possible as well (as mentioned in the previous post).

Hope that works for you until we are done with this feature.

Kind regards,
Kalina
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items

Posted by Community Admin on 26-Nov-2010 00:00

Thank you. Perfectly clear.

Posted by Community Admin on 20-Jan-2011 00:00

Hi Kalina,

I'm having the same problem - although the solution was more elegant in 3.7 in that I could create a meta field for the URL, then in the control template set it to pop up an image selector.  Is there any way of doing this in version 4?  I noticed you can add custom fields, so could you specify a path to the image selector in the same way?

Previously in 3.7 I added the meta field, then changed the Content Template for the NewsItemEdit.ascx file to open my field like so :

<asp:TextBox ID="Thumbnail" Text="" runat="server" MaxLength="250"></asp:TextBox>
                                    <sfLib:ButtonSelector WindowNavigateUrl="~/Sitefinity/UserControls/Dialogs/ImageDialog.aspx" AssociatedControls="Thumbnail" ItemTemplatePath="~/Sitefinity/Admin/ControlTemplates/News/Dialogs/ButtonSelector.ascx" runat="server" cssclass="pickerWrapper" ButtonText="<%$Resources:Select%>" />

Is there a way to replicate this same behaviour in 4?

(Apologies if this is on the SDK, but my broadband is slooow!).

Cheers,
Tony

Posted by Community Admin on 20-Jan-2011 00:00

Hi Francois,

You can try using the custom fields. We implemented them for the RC.

Currently you can add only a custom control ( there are issues when you use a user control). You need to create a custom control that inherits from CompositeFieldControl or completely custom control that implements IField interface.

sample

usingSystem;
 
usingTelerik.Sitefinity.Web.UI.Fields;
 
   
 
namespaceTelerik.Sitefinity.Samples
 
 
    classCompositeFieldControlCustom : CompositeFieldControl
 
    
 
        protectedoverrideSystem.Web.UI.WebControls.WebControl TitleControl
 
        
 
            get thrownewNotImplementedException();
 
        
 
   
 
        protectedoverrideSystem.Web.UI.WebControls.WebControl DescriptionControl
 
        
 
            get thrownewNotImplementedException();
 
        
 
   
 
        protectedoverrideSystem.Web.UI.WebControls.WebControl ExampleControl
 
        
 
            get thrownewNotImplementedException();
 
        
 
   
 
        protectedoverridevoidInitializeControls(Web.UI.GenericContainer container)
 
        
 
            thrownewNotImplementedException();
 
        
 
   
 
        protectedoverridestringLayoutTemplateName
 
        
 
            get thrownewNotImplementedException();
 
        
 
    
 

There is a built-in control PromptDialog that you can use. Inside the CustomTemplate you can add a control/s you want to see.

<sf:ResourceLinksid="resourcesLinks"runat="server"Theme="Default"UseEmbeddedThemes="true">
    <sf:ResourceFileJavaScriptLibrary="JQuery"/>
    <sitefinity:ResourceFileName="Skins/PromptDialog.css"/>
</sf:ResourceLinks>
  
  
<sitefinity:PromptDialogrunat="server"id="promptDialog"Width="150"Height="150"Mode="Custom"AllowCloseButton="true"ShowOnLoad="false"Title="just a test">
    <CustomTemplate>
       <asp:Literalrunat="server"  ID="test1"  Text="Hello there"/>
    </CustomTemplate>
    <Commands>
        <sf:CommandToolboxItemText="Done"CommandName="ok"CommandType="CreateButton"WrapperTagName="LI"></sf:CommandToolboxItem>
        <sf:CommandToolboxItemText="Cancel"CommandName="cancel"CommandType="CancelButton"WrapperTagName="LI"></sf:CommandToolboxItem>
    </Commands>
</sitefinity:PromptDialog>
  
<asp:LinkButtonrunat="server"ID="testbutton"OnClientClick="showPropmpt();return false;"  Text="call function"/>
  
<scripttype="text/javascript">
    function showPropmpt()
        var propmptDialog = $find('<%=promptDialog.ClientID%>');
        propmptDialog.show_prompt();
    
  
</script>


Kind regards,
Ivan Dimitrov
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items

Posted by Community Admin on 24-Jan-2011 00:00

Hello,

When this feature will be included in Sitefinity? I really need this feature.

Thanks

Posted by Community Admin on 25-Jan-2011 00:00

Hello jocelyn,

Could you tell me for which feature you are asking, so I could see whether we will have it shortly.

Kind regards,
Ivan Dimitrov
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items

Posted by Community Admin on 25-Jan-2011 00:00

Hello Ivan,

I was talking about the thumbnail in the news module.

Jocelyn

Posted by Community Admin on 25-Jan-2011 00:00

Hello,

This is a new implementation and we will need some more time to schedule it and implement it. Currently we have not set time frame for it. The Id of your request is 105788

Regards,
Ivan Dimitrov
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items

Posted by Community Admin on 17-Mar-2011 00:00

Hi Ivan,

It would really help having a rough timeline on this so we can weigh up using some custom controls.
I'm not sure why you consider it a 'new item'... does this effect the speed that its applied?
It was on previous versions and would be an expected feature for news.

Posted by Community Admin on 21-Mar-2011 00:00

Hi, 
Is this feature now in your product? 
Am in the process of evaluating Sitefinity to use for my company's websites.  I was trying to implement a small mockup of pulling news items through Sitefinity API and wasn't sure how to get news thumbnails in the newslist. 

Thanks

Posted by Community Admin on 21-Mar-2011 00:00

Hi,

We created a blog post and provided the code needed to get the content - image/thumbnail relation working

www.sitefinity.com/.../creating_a_thumbnail_selector_for_news_items.aspx


All the best,
Ivan Dimitrov
the Telerik team

Posted by Community Admin on 21-Mar-2011 00:00

Thanks Ivan, 
But then how to access the new field through the API ? 
Thanks for the prompt response. 

Posted by Community Admin on 22-Mar-2011 00:00

Hi ,

The Content object has an extension method - GetValue which you can use to get the value set for your key. You should have a reference to Telerik.Sitefinity.Model in your class to use the extension methods.

All the best,
Ivan Dimitrov
the Telerik team

Posted by Community Admin on 22-Mar-2011 00:00

Sorry, but which content object?  I only find a string property in NewsItem named content, and that ofcourse dose not have GetValue .
could you perhaps point me to a documentation/ sample . Thanks

Am using SF4  and I did include :
using Telerik.Sitefinity.GenericContent.Model;
using Telerik.Sitefinity.Modules.News;
using Telerik.Sitefinity.Modules;
using Telerik.Sitefinity.News.Model;
using Telerik.Sitefinity.Model;
using Telerik.Sitefinity;



Posted by Community Admin on 25-Mar-2011 00:00

Hello ,

The NewsItem is a content object. It inherits from Content.

Kind regards,
Ivan Dimitrov
the Telerik team

This thread is closed