Copied to clipboard

Flag this post as spam?

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


  • John Torrin 2 posts 22 karma points
    Jul 11, 2011 @ 22:48
    John Torrin
    0

    Help with news/article system

    Hello All,

    I am trying to build a news/article system where within one website I have a few different news areas.  Basically one is the "main news" and all the others are "sub news".

    I want the "sub news" areas to all remain seperate, but I want the "main news" area to integrate with all the "sub news" areas.  Follow?

    In theory I would set-up the content like this...

    home
    - page
    - - MAIN news landing
    - - - main news article 1
    - - - main news article 2
    - page
    - page
    - - SUB news landing 1
    - - - sub news article 3
    - page
    - - SUB news landing 2
    - - - sub news article 4
    - - - sub news article 5
    etc, etc

    So if I go to "Sub news landing 1"  I would see "sub news article 3, main news article 1, and main news article 2"

    If I went to "Sub news landing 2"  I would see "sub news article 4, sub news article 5, main news article 1, and main news article 2" 

    Etc.

    Any idea on the best way to set this in motion?

    Any help would be appreciated.

  • MarkD 5 posts 26 karma points
    Jul 16, 2011 @ 14:02
    MarkD
    0

    Hi John,

    You could write your  Macro to display all sub nodes.

    So for example "Sub news landing 2"  I would see "sub news article 4, sub news article 5," (1 macro)

    Then create another Second News Template (so now you have 2 News Templates - 1 for Sub Nodes and 1 for Main News)

    Then to get your Main News to Display on the Sub News page, write the Macro to list throgh the whole structure and only write out information for Templates with a certain ID.  So, looking at the code below.  My News Template ID (which would be your Main News) template id (you can get the Tmeplate ID from hovering over a template and looking at the Javascript message in the Status bar) is "1223".  So the code below would display only code for all Main News nodes.    

        <xsl:sort select="newsDate" order="descending"/>
        <xsl:if test="position()&lt;= $maxItems">
       <xsl:if test="@template = 1223">
                   <li>
                   <a href="{umbraco.library:NiceUrl(@id)}"><xsl:value-of select="newsTitle"/></a>
                   </li>
             </xsl:if>
            </xsl:if>
                 <xsl:if test="count(./* [@isDoc and @level &lt;= $maxLevelForSitemap]) &gt; 0">
                   <xsl:call-template name="drawNodes">
                     <xsl:with-param name="parent" select="."/>
                   </xsl:call-template>
                 </xsl:if>
            </xsl:for-each>

    So on your Pages.  You can drop in two Macros.

    Hope this helps,

    Mark

  • Tony 11 posts 31 karma points
    Jul 19, 2011 @ 05:39
    Tony
    0

    John,

    Any luck with this? I am struggling with a very similar situation.  There has got to be an easy way to do this and I have been wrestling with it for a couple weeks now myself.

    Mark, I was looking at your solution and my first thought is... wouldn't this list out the articles seperately? So the main news wouldn't be integrated with the other news?  Maybe I misunderstood John and if so I apologize, but I am doing something similar where I need to integrate them together. 

    My most recent attempts were trying to dump them into a node-set and display them that way, then I could manipulate them as a set... I think I have the right idea, but the execution ain't happening :)

    Anyway, any further ideas would be cool... or John if you came up with a solution yourself, please share it.

    Thanks, Tony

  • Tony 11 posts 31 karma points
    Jul 19, 2011 @ 07:10
    Tony
    0

    Well finally found a solution to my problem, not sure if this totally will help you John but here goes...

    As I thought there was an easy way to do this, not saying it is the best way, but it works for me.  I made the "Main News" its own DocType called "MainArticle" while the other articles are DocTypes "Article".

    <xsl:variable name="articlePages" select="$currentPage/ancestor-or-self::root//MainArticle | $currentPage/LevelTwo/Article"/>

    So basically what this does is takes ALL the DocTypes listed as "MainArticle" and then also adds in the regular DocTypes of "Article" which are located down from the currentpage.  Then I just run my regular sorts and such to pull it all together.

    Any help?

    Tony

  • John Torrin 2 posts 22 karma points
    Jul 19, 2011 @ 20:11
    John Torrin
    0

    Hey Tony that is a great solution.  I have it working now.

    Thank you!

Please Sign in or register to post replies

Write your reply to:

Draft