1-888-365-2779
+1-888-365-2779
Try Now
More in this section

Forums / General Discussions / Associate an image to a news

Associate an image to a news

17 posts, 1 answered
  1. Francois MARTIN
    Francois MARTIN avatar
    29 posts
    Registered:
    07 Aug 2005
    25 Nov 2010
    Link to this post
    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
  2. Bill Y
    Bill Y avatar
    22 posts
    Registered:
    04 Nov 2010
    25 Nov 2010
    Link to this post
    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).
  3. Kalina
    Kalina avatar
    176 posts
    Registered:
    27 Oct 2016
    26 Nov 2010
    Link to this post
    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
    Answered
  4. Francois MARTIN
    Francois MARTIN avatar
    29 posts
    Registered:
    07 Aug 2005
    26 Nov 2010
    Link to this post
    Thank you. Perfectly clear.
  5. Tony Bolton
    Tony Bolton avatar
    33 posts
    Registered:
    06 Oct 2009
    20 Jan 2011
    Link to this post
    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
  6. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    20 Jan 2011
    Link to this post
    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
  7. jocelyn payneau
    jocelyn payneau avatar
    51 posts
    Registered:
    07 Dec 2009
    24 Jan 2011
    Link to this post
    Hello,

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

    Thanks
  8. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    25 Jan 2011
    Link to this post
    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
  9. jocelyn payneau
    jocelyn payneau avatar
    51 posts
    Registered:
    07 Dec 2009
    25 Jan 2011
    Link to this post
    Hello Ivan,

    I was talking about the thumbnail in the news module.

    Jocelyn
  10. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    25 Jan 2011
    Link to this post
    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
  11. Cormac
    Cormac avatar
    11 posts
    Registered:
    02 Jun 2008
    17 Mar 2011
    Link to this post
    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.
  12. Taha
    Taha avatar
    6 posts
    Registered:
    02 Mar 2011
    21 Mar 2011
    Link to this post
    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
  13. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    21 Mar 2011
    Link to this post
    Hi,

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

    http://www.sitefinity.com/blogs/slavoingilizov/posts/11-02-11/creating_a_thumbnail_selector_for_news_items.aspx


    All the best,
    Ivan Dimitrov
    the Telerik team
  14. Taha
    Taha avatar
    6 posts
    Registered:
    02 Mar 2011
    21 Mar 2011
    Link to this post
    Thanks Ivan, 
    But then how to access the new field through the API ? 
    Thanks for the prompt response. 
  15. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    22 Mar 2011
    Link to this post
    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
  16. Taha
    Taha avatar
    6 posts
    Registered:
    02 Mar 2011
    22 Mar 2011
    Link to this post
    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;



  17. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    25 Mar 2011
    Link to this post
    Hello ,

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

    Kind regards,
    Ivan Dimitrov
    the Telerik team
17 posts, 1 answered