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

Forums / Developing with Sitefinity / Displaying just the news title

Displaying just the news title

8 posts, 0 answered
  1. Samir
    Samir avatar
    14 posts
    Registered:
    12 May 2008
    20 Mar 2009
    Link to this post
    Hello,

    I'm currently working with the "news view" module for my site and there's a small issue I encountered.
    I have two pages where I want to display the news. One in the Home page where only the "Title" (may be the author) of the news will be displayed. And once the users click on the heading, they're redirected to a new page which will have the full description and the news itself.
    Currently, I've set it up such that it works the way I want except for one part in the display of the news title in the home page. Basically if you edit the settings of the "news view" template in the home page such that you set it to not display extra pieces of info such as Author, data, etc, it creates blank "<p>" tags for those info. So if I have 3 latest news headline displaying in the home page, the spaces between the three news are significantly large. I used "firebug", a firefox plugin, to determine what was going on. here's a snapshot of the code firebug displayed:

    <ul class="sf_newsList">
    -<li>
    -<h2 class="sf_newsTitle">
    <a id="ctl00_BodyContent_NewsView1_ctl00_repeater_ctl01_fullContent1" href="news/press_release/09-03-20/Testing_News.aspx"> Testing News </a>
    </h2>
    <p class="sf_newsDate"> </p>
    <p> </p>
    <p class="sf_readMore"> </p>
    <p class="sf_newsAuthor"> </p>
    <p> </p>
    <p class="sf_postCategory"> </p>
    <p class="sf_postTags"> </p>
    </li>

    The blank <p> tags are creating unnecessary spaces. Any solutions to this? Or am is there're an another way to display just the Title of the news in home page and display the details of the news in the other?
    By the way, i'm using sitefinity 3.6 version.

    Thanks in advance.

  2. Georgi
    Georgi avatar
    3583 posts
    Registered:
    28 Oct 2016
    23 Mar 2009
    Link to this post
    Hello,

    You could edit the file Sitefinity\ControlTemplates\News\ListPageMaster.ascx, since the paragraph tags are defined there. First, you should map the NewsView control and its child views:
    <viewSettings hostType="Telerik.News.WebControls.NewsView"
          <additionalTemplates> 
            <!--Provides user interface for displaying a list of news items in the NewsView control for the News module.--> 
            <add key="ItemListTemplatePath" layoutTemplatePath="~/Sitefinity/ControlTemplates/News/ListPageMaster.ascx" /> 
            <!--Provides user interface for displaying a single news item in the NewsView control of the News module.--> 
            <add key="SingleItemTemplatePath" layoutTemplatePath="~/Sitefinity/ControlTemplates/News/ListPageDetails.ascx" /> 
          </additionalTemplates> 
        </viewSettings> 

    Since ListPageMaster.ascx will be used by all NewsView controls working in Master mode, I suggest you to make a copy of it, (let say ListPageMaster_NoPTags.ascx) and use it instead of the original one.

    Don't hesitate to contact us if you have other questions.

    All the best,
    Georgi
    the Telerik team

    Check out Telerik Trainer , the state of the art learning tool for Telerik products.
  3. Samir
    Samir avatar
    14 posts
    Registered:
    12 May 2008
    24 Mar 2009
    Link to this post
    Hi Georgi,

    The path for the file: "Sitefinity\ControlTemplates\News\ListPageMaster.ascx", is this suppose to be "Sitefinity\ControlTemplates\News\Modes\ListPageMaster.ascx? I'm assuming it is. Anyways, I did try editing the original "ListPageMaster.ascx" and clearing off all the <p> tags. But there seems to be no change in the output.
    Also, you said to make a copy of the original "ListPageMaster.ascx" and name it differently, say: "homepageListPageMaster.ascx" and map the newsView control and its child view. Where do I map it? What I mean is, which file do I enter the code that you provided? I can't seem to find the ".ascx" file for newsView control.
    This is how my "ListPageMaster.ascx" file looks like right now:

    <asp:HyperLink ID="backLink" runat="server" Text="<%$Resources:GoBack %>"></asp:HyperLink> 
    <asp:Repeater ID="repeater" runat="server"
        <HeaderTemplate> 
            <ul class="sf_newsList"
        </HeaderTemplate> 
        <ItemTemplate> 
            <li> 
                <h2 class="sf_newsTitle"
                    <asp:HyperLink ID="fullContent1" runat="server"
                        <asp:Literal ID="Title" runat="server"></asp:Literal> 
                    </asp:HyperLink> 
                </h2> 
                 
            </li> 
        </ItemTemplate> 
        <FooterTemplate> 
            </ul> 
        </FooterTemplate> 
    </asp:Repeater> 
    <sf:Pager ID="pager1" runat="server"
        <LayoutTemplate> 
            <asp:Repeater ID="PageRepeaterLinkButton" runat="server"
                <HeaderTemplate> 
                    <ol class="sf_pager"
                    <li><asp:LinkButton ID="PreviousPage" runat="server" Text="<%$Resources:PreviousPage %>"></asp:LinkButton></li
                </HeaderTemplate> 
                <ItemTemplate> 
                    <li> 
                        <asp:LinkButton ID="SingleItem" runat="server" /> 
                    </li> 
                </ItemTemplate> 
                <FooterTemplate> 
                    <li><asp:LinkButton ID="NextPage" runat="server" Text="<%$Resources:NextPage %>"></asp:LinkButton></li
                    </ol> 
                </FooterTemplate> 
            </asp:Repeater> 
            <asp:Repeater ID="PageRepeaterHyperLink" runat="server"
                <HeaderTemplate> 
                    <ol class="sf_pager"
                    <li><asp:HyperLink ID="PreviousPage" runat="server" Text="<%$Resources:PreviousPage %>"></asp:HyperLink></li
                </HeaderTemplate> 
                <ItemTemplate> 
                    <li> 
                        <asp:HyperLink ID="SingleItem" runat="server" /> 
                    </li> 
                </ItemTemplate> 
                <FooterTemplate> 
                    <li><asp:HyperLink ID="NextPage" runat="server" Text="<%$Resources:NextPage %>"></asp:HyperLink></li
                    </ol> 
                </FooterTemplate> 
            </asp:Repeater> 
        </LayoutTemplate> 
    </sf:Pager> 

    I deleted all the "<p>" tags after "</h2>".

    Another thing that I came across was this: when i go into edit mode of the newsView control in the "edit page" mode, the "advance settings>misc" of the control says this: "ItemListTemplateName: Telerik.News.Resources.ControlTemplates.Frontend.Modes.ListPageMaster.ascx"

    Is this a assymbly it is using to control the userControl? If it is then how can changing the file"ListMasterPage.ascx" have a effect on the precompiled file? Do I restart the application?
    Sorry if these are unnecessary information but just thought it might be helpful.
    Any help is appriciated. Thanks.


  4. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    16 Jun 2017
    25 Mar 2009
    Link to this post
    Hello Developer,

    By default we use embedded templates - this is the reason why you see Telerik.News.Resources.ControlTemplates.Frontend.Modes.ListPageMaster.ascx - this is the embedded template loaded by the control form Telerik.News assemble.

    If you want to hide paragraphs you should modify your template as you have already done. Then map it as Goro's suggestion. As for the additionalTemplates you could chech the following blog post where everything is described in details Mapping multiple templates of control. However, you could map your templates and set a different one for each control you have - altering ItemListTemplatePath and SingleItemTemplatePath properties under Advanced >> Appereneance.
    Generally speaking there are some priorities of settiing templates - Inline template, then path in control Designer >> Advanced mode.

    Best wishes,
    Ivan Dimitrov
    the Telerik team

    Check out Telerik Trainer , the state of the art learning tool for Telerik products.
  5. Joel
    Joel avatar
    28 posts
    Registered:
    18 Jun 2008
    26 Mar 2009
    Link to this post

    I am using 3.2

    Using the NewsV

    I have Summary checked in the NewsList view but it isn't showing up.


    Viewing the source renders:

     <h2 class="sf_newsTitle">
    		        <a id="ctl00_MainContent_NewsView1_ctl00_ctl00_repeater_ctl01_fullContent1" href="/company/news2/09-03-17/Force_3_Inks_Deal_with_Washington_Nationals.aspx">Force 3 Inks Deal with Washington Nationals </a>
                </h2>
                <p class="sf_newsDate">
                    
                </p>
                <p>
    
                    The summary I entered here.       </p>
                <p class="sf_readMore">
    


    So, the summary I have entered is in the source, but it isn't rendering. I think this because it doesn't have a class associated to it or some other bug.

    How can I resolve this?

    Thanks.
  6. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    16 Jun 2017
    27 Mar 2009
    Link to this post
    Hi Joel,

    You could try to expose the control summary. My suggestion is upgrade to 3.2 hotfix 1616 where a lot of poblems are sorted out. If you would like you could try a step to 3.6 hotfix.

    Greetings,
    Ivan Dimitrov
    the Telerik team

    Check out Telerik Trainer , the state of the art learning tool for Telerik products.
  7. martin
    martin avatar
    43 posts
    Registered:
    10 Feb 2009
    20 May 2009
    Link to this post
    Hello,

    I have been trying to figure out "mapping" for controls within Sitefinity. I've lost track of the numerous support threads and ticket responses I've read where people just state "You need to map blah-blah" - without explaining how to do any mapping.

    I have now found this article:

    http://www.sitefinity.com/support/knowledge-base/kb-article/b1154K-bcge-b1154T-cgb.aspx

    which supplies a blow-by-blow account of the need (in 3.6) to create a new "Configuration" directory, a new "Telerik.Sitefinity.Configuration.ControlsConfig.xml" file within it and then restarting the app to have Sitefinity use our new ascx template files, rather than it's own embedded and uneditable default files.

    Suddenly I can see why amending "ListPageDetails.ascx" alone makes no changes... as I need to perform the above mentioned tasks to get Sitefinity to look at my file(s) rather than it's own.

    Regards,
    m.
  8. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    16 Jun 2017
    20 May 2009
    Link to this post
    Hello martin,

    Thank you for using our services.

    You can map presentation mode templates directly through ContentView based control  Advanced>> Appereance >> SingleItemTemplatePath or ItemListTemplatePath properties.

    Here is an useful article that describes another approach of mapping presentation modes.
    Mapping ContentViewDesigners and working with Presentation Modes

    Best wishes,
    Ivan Dimitrov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
Register for webinar
8 posts, 0 answered