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"
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.
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.
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".
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.
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.
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()<= $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 <= $maxLevelForSitemap]) > 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
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
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
Hey Tony that is a great solution. I have it working now.
Thank you!
is working on a reply...