Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • hetaurhet 245 posts 267 karma points
    Feb 22, 2012 @ 13:54
    hetaurhet
    0

    want image in rss feed

    Hello all

    we want to call rss feed on home page of our website but not just title but with thumb image.

    So, is it possible? If yes, then guide me further.

  • Anthony Dang 1404 posts 2558 karma points MVP 3x c-trib
    Feb 24, 2012 @ 17:36
    Anthony Dang
    0

    Do you want a list of articles on a home page or do you want an rss feed?

    Do you have an example?

     

  • hetaurhet 245 posts 267 karma points
    Feb 25, 2012 @ 05:13
    hetaurhet
    0

    rss feed... ...

     

    but basically my requirement is that last 3 to 4 posts should be displayed. This blog is specifically for updates say new wallpaper, new magazine updated etc...

    If you have any other way you can tell.

  • Anthony Dang 1404 posts 2558 karma points MVP 3x c-trib
    Feb 25, 2012 @ 20:34
    Anthony Dang
    0

    So you want to render a post title and a thumbnail image in the xml rss feed when you hit the site with mydomain.com/rss ? 

    Well I have never needed to do such a thing do this, but if you wanted to, you should do it with CDATA likes this:

    <![CDATA[<img src="@imagePath">]]>

    I would add a media picker property to the post doctype. I suggest using http://our.umbraco.org/projects/backoffice-extensions/digibiz-advanced-media-picker

     

     


  • hetaurhet 245 posts 267 karma points
    Feb 27, 2012 @ 05:14
    hetaurhet
    0

    where to add this line?  <![CDATA[<img src="@imagePath">]]>

  • Anthony Dang 1404 posts 2558 karma points MVP 3x c-trib
    Feb 27, 2012 @ 11:13
    Anthony Dang
    0

    You'll have to add it to uBlogsyRss.cshtml

    I think you can slide it in the begining of <description>

     

  • hetaurhet 245 posts 267 karma points
    Feb 27, 2012 @ 11:38
    hetaurhet
    0

    ok.. will chk and let u know

  • hetaurhet 245 posts 267 karma points
    Mar 04, 2012 @ 16:30
    hetaurhet
    0

    instead of showing rss..  I now decided to use uBlogsyListPosts.cshtml on my home page... I modified it a little as below.. as wanted to give different css class (style) and supplied node id (see below .. its 1772) of blog.

    @using System.Linq
    @using System.Xml.Linq
    @using umbraco.MacroEngines
    @using uBlogsy.Common.Extensions
    @using uBlogsy.Common.Helpers
    @using uBlogsy.BusinessLogic
    @{
        const int ITEMS_PER_PAGE = 20; // for testing
       
        // get item count
        int count = int.Parse(@Parameter.ItemCount);

        IEnumerable<DynamicNode> nodes;

        if (@Parameter.Small == "1")
        {
            var posts = PostService.Instance.GetPosts(1772);
            nodes = ((IEnumerable<DynamicNode>)posts).Take(count);
           
           
            <div class="what-new">
            <div class="new-top"><h1>What's New</h1></div><!-- end wel-top -->
           
              
                <div class="new-mid">
                <div class="sp" id="sps0" style="display:inline;">

                    @foreach (DynamicNode n in nodes)
                    {
                       
                        <div class="updates-item">
                            <a href="@n.Url" title="@n.GetProperty("uBlogsyContentTitle").Value" class="updates-text" target="_blank">
                                <span>@n.GetProperty("uBlogsyContentTitle").Value</span>
                            </a>
                           @* - <span>@n.GetProperty("uBlogsyPostDate").Value.FormatDateTimeOrdinal("d MMMM yyyy")</span>*@       
                        </div>
                     
                    }
                </div>
                </div>
            
            </div>
        }
        else
        {
            // get tag, category, or author from query string
            var tag = Request.QueryString["tag"];
            var category = Request.QueryString["category"];
            var author = Request.QueryString["author"];
            var searchTerm = Request.QueryString["search"];
            var commenter = Request.QueryString["commenter"];
            int page = int.TryParse(Request.QueryString["page"], out page) ? page : 1;

            var posts = PostService.Instance.GetPosts(Model.Id, tag, category, author, searchTerm, commenter, page-1, count);
            nodes = ((IEnumerable<DynamicNode>)posts).Take(count).ToList();

            int postCount = PostService.Instance.GetPosts(Model.Id, tag, category, author, searchTerm, commenter, 0, int.MaxValue).Count;
           
            // pagination
            @RenderPagination(page, postCount, count)
                   
            // render search result count when this script is displaying search results
            if (!string.IsNullOrEmpty(searchTerm))
            {
                <script type="text/javascript">
                    $(document).ready(function () {
                        $('.uBlogsy_content_body').hide();
                    });
                </script>
                <h3>@nodes.Count() Results: </h3>
            }
           
            // show each post
            foreach (DynamicNode n in nodes)
            {
                @RenderPage("/macroScripts/uBlogsy/uBlogsyShowPost.cshtml", n.Id)
            }
        }
     }




    @helper RenderPagination(int page, int postCount, int itemsPerPage)
    {
        int pages = (int)Math.Ceiling((double)postCount / (double)itemsPerPage);
            
        string url = Request.Url.ToString();
        string querystring = Request.Url.Query;
       
        <ul id="uBlogsy_pagination">

            @* render prev link *@
            <li class="uBlogsy_page_prev">
                @if (page > 1)
                {
                    url = url.ReplaceQueryStringItem("page", (page - 1).ToString());
                    <a href="@url" >Prev</a>
                }else{
                    <span>Prev</span>
                }
            </li>

            @* render page links *@
            @for (int i = 1; i < pages+1; i++)
            {
                url = url.ReplaceQueryStringItem("page", i.ToString());
                string liClass = i == page ? "uBlogsy_current" : string.Empty;
               
                <li class="uBlogsy_page_item @liClass">
                    @if(page == i){
                        <span>@i</span>
                    }else{
                        <a href="@url">@i</a>
                    }
                </li>
            }
          
            @* render next link *@
            <li class="uBlogsy_page_next">
                @if (page < Math.Ceiling((double)postCount/itemsPerPage))
                {
                    url = url.ReplaceQueryStringItem("page", (page + 1).ToString());
                    <a href="@url" >Next</a>
                }
                else
                {
                    <span>Next</span>
                }
            </li>
        </ul>
    }

    Error loading MacroEngine script (file: /uBlogsy/uBlogsyListPostsHome.cshtml). What is going wrong?

  • hetaurhet 245 posts 267 karma points
    Mar 04, 2012 @ 16:54
    hetaurhet
    0

    solved problem...

  • Anthony Dang 1404 posts 2558 karma points MVP 3x c-trib
    Mar 04, 2012 @ 21:49
    Anthony Dang
    0

    I'm not sure what you were tring to do.

    What was your problem?

     

  • hetaurhet 245 posts 267 karma points
    Mar 05, 2012 @ 05:02
    hetaurhet
    0

    I wanted latest posts on home page.. and blog is not child not of my root web site node.. so supplied node id. my problem was I created another macro as I needed different css style on home page.. and in that forgot to create parameters.. so it was throwing error.

Please Sign in or register to post replies

Write your reply to:

Draft