Yes, I know and it's for that I'm a bit lost... Don't know what to use. I wanna make a new news module... In outline, I want to be able to add some news to the same page and put a date at the news
For that you don't need to extend umbraco with a module, you can do that out-of-the box. Later you can put everything together in a package for easy deployment if you want. So, first you have to create some templates. A Master template, that will hold your main markup, and an <asp:ContentPlaceHolder Id="childContent" runat="server"></asp:ContentPlaceHolder> where your news content will be, a news page template, that will show the list of news items, and a news item template. The news and news item contain a <asp:content ContentPlaceHolderId="cc" runat="server"> put html here </asp:content> and are the children of the Master template. Then create Document types for the news and news item pages. Here you can create properties, like title, body text etc and for the news doc type, under the Structure tab, check the news item so you can create news items under news. You can then go to the content section and create the news page. In it put news items, fill in properties. To list the items in the news page you have to create an xslt macro (there's a lot of info on that arround, but let me know if you need help). To show the content on the news item page you can put umbraco page fields in the news item template (there's a button for this where you edit the template). You can save a package with all this (the templates, doc types, macro) - go to the Developer section, Packages for this - that you will be able to install on another umbraco instalation.
Well when you create the xslt there's a checkbox "Create Macro" and it will create the macro automatically. Then go to the template and there's a button for inserting the macro in the page, in the news template. Now about the xslt. What it must do is list the children of the page. So you can start by adding
<xsl:for-each select="$currentPage/* [@isDoc and string(umbracoNaviHide) != '1']"> <xsl:value-of select="current()/@nodeName"/> xsl:for-each>
inside <xsl:template match="/"> and see if you get a list of the news items. In the xslt you can put html tags, so you could for example surround the value-of with <li></li> To output a property you created for the news item document type you can write <xsl:value-of select="current()/propertyName"/>
The $currentPage var holds the xml representing the current page.
For the related links data type you need a small xslt to render. When you create the xslt there's a template under "Choose a template:" exactly for that, i think it's called exactly "Related Links". Then insert the macro in the template, not directly the property.
Just a tip, you can always check the xml you're formatting with xslt by opening the umbraco.config file from the App_Data folder. That's the umbraco cache. You can search in it for your related links property to see how its xml looks, I think it contains <links> nodes.
Yes, it's possible. You can create a user control, put the .ascx in /usercontrols and the .dll in /bin, then create a macro (right click macros, Create and point to the .ascx file for "or .NET User Control"). Now to work with data you can use the node factory api. In the usercontrol you can create a Node node = new Node() and that will be the current page's node. You can get a property by using node.GetProperty("propertyAlias").Value. You can go through the page's children with node.Children etc. To list the related links I think you can use an XmlDocument:
XmlDocument myXmlDoc = new XmlDocument(); myXmlDoc.LoadXml(node.GetProperty("relatedLinksAlias").Value.ToString()); XmlNodeList nodeList = myXmlDoc.SelectNodes("/links/link");
I don't know if the above code actually works, i just typed it here :)
EDIT: in the usercontrol you'll have to reference some umbraco dlls. I usually add businesslogic, cms, umbraco.dll.
The steps to create a module
Hi , I'm new in umbraco
I'm a student and my job is to create a new module for umbraco. I watched the video for developer with usercontrol, etc...
But I don't know how I have to start. Can you tell me the different step I have to do ?
Thanks,
Félicien
It depends a bit on what you want to achieve. It can be a custom section, a datatype, macro, xslt extension etc. Umbraco can be extended in many ways.
thanks for the answer :)
Yes, I know and it's for that I'm a bit lost... Don't know what to use. I wanna make a new news module... In outline, I want to be able to add some news to the same page and put a date at the news
For that you don't need to extend umbraco with a module, you can do that out-of-the box. Later you can put everything together in a package for easy deployment if you want. So, first you have to create some templates. A Master template, that will hold your main markup, and an <asp:ContentPlaceHolder Id="childContent" runat="server"></asp:ContentPlaceHolder> where your news content will be, a news page template, that will show the list of news items, and a news item template. The news and news item contain a <asp:content ContentPlaceHolderId="cc" runat="server"> put html here </asp:content> and are the children of the Master template. Then create Document types for the news and news item pages. Here you can create properties, like title, body text etc and for the news doc type, under the Structure tab, check the news item so you can create news items under news. You can then go to the content section and create the news page. In it put news items, fill in properties. To list the items in the news page you have to create an xslt macro (there's a lot of info on that arround, but let me know if you need help). To show the content on the news item page you can put umbraco page fields in the news item template (there's a button for this where you edit the template). You can save a package with all this (the templates, doc types, macro) - go to the Developer section, Packages for this - that you will be able to install on another umbraco instalation.
Hope this helps!
yeah :) I'm going to try it !
Thanks a lot for the help
Hey, it's me (again, I know...)
The documents type and templates are made.
Now I have to create the macro but I don't know the xslt langage... And I never created macro...
I've watched this videos : http://umbraco.org/help-and-support/video-tutorials/introduction-to-umbraco/sitebuilder-introduction/creating-your-first-xslt-macro
But he doesn't create the macro , it already exists...
Can I create it easily ?
Or I have to learn the language ?
Thanks again,
Felicien
Well when you create the xslt there's a checkbox "Create Macro" and it will create the macro automatically. Then go to the template and there's a button for inserting the macro in the page, in the news template. Now about the xslt. What it must do is list the children of the page. So you can start by adding
<xsl:for-each select="$currentPage/* [@isDoc and string(umbracoNaviHide) != '1']">
<xsl:value-of select="current()/@nodeName"/>
xsl:for-each>
inside <xsl:template match="/"> and see if you get a list of the news items. In the xslt you can put html tags, so you could for example surround the value-of with <li></li> To output a property you created for the news item document type you can write <xsl:value-of select="current()/propertyName"/>
The $currentPage var holds the xml representing the current page.
Ah- ha , it works, awesome ! Thx
Just a last question... In my XSLT file I have
My propertyName is a richText editor.. When I publish and preview my page... I have tags <p > </p >
Can I remove these tags ?
I have another problem... My data Type related links doesn't work... Why ? Is it a special way to run it ?
Anyone for my problems ?
Tkanks
What do you mean by "data type related links"?
I want to add to my document Type a new Property with a Type related links. I added it and also in my template...
But the links don't appear on my page when I publish it
For the related links data type you need a small xslt to render. When you create the xslt there's a template under "Choose a template:" exactly for that, i think it's called exactly "Related Links". Then insert the macro in the template, not directly the property.
Just a tip, you can always check the xml you're formatting with xslt by opening the umbraco.config file from the App_Data folder. That's the umbraco cache. You can search in it for your related links property to see how its xml looks, I think it contains <links> nodes.
Thx ,good to know. it would be usefull
Is there a way to transform xml into html in my macro xslt file ?
I don't know if it's understandable what I wanna mean...
Sure it is, this is what xslt is used for. You just have to explain a bit what you try to do.
Now, in my "news Item" page.. I have links , paragraphs,...(it works, i don't wanna change it)
But in my "news" page , it gives me that :
[" New news
<p> the forum umbraco is very usefull for the newbie in Umbraco" </p>
<link title="To know more about " link="http://our.umbraco.org" type="external" newwindow="1" />
" ]
I want to remove the HTML tags, is it possible ?
I'm sorry but I'm stil not following. Does the text between [ ] come from a richtext editor? And you want to remove the <p> and <link> tags?
yes, it is what I want
Then you want only text, why not use a Simple Editor, or Textbox Multiline for your property instead of the Richtext Editor?
it 's a solution,
But what I would like is :
A user who can add a color text, bold text , links, maybe images, etc... in my news item Page (it's already possible with a rich text editor)
With my XSLT macro I wanna the same in my news page... Instead, I just have the Html tags...
In outline, I don't just want the content but also the design...
Is it possible ?
Oh, maybe you just have to add the disable-output-escaping="yes" tag where you output the property in the xslt?
Yeah just what I want.
High five !
Thanks, really !
Another question... I hope it's the last
The xslt macro "links" works and I have in umbraco.config file from the App_Data folder :
<news><![CDATA[
<p>umbraco is cool </p>
]]></news>
<links>
<links>
<link title="To know more about this " link="http://our.umbraco.org" type="external" newwindow="1" />
</links>
</links>
</news>
So , for my news page , in my xslt macro, I try to take back the link...
<xsl:template match="/">
<xsl:for-each select="$currentPage/* [@isDoc and string(umbracoNaviHide) != '1']">
<xsl:value-of disable-output-escaping="yes" select="current()/news"/>
<xsl:value-of select="current()/links/links/link"/>
</xsl:for-each>
</xsl:template>
This instruction doesn't work..
Can you tell me what is the correct instruction I have to write ?
It's okay , I found it
<a>
<xsl:attribute name="href"><xsl:value-of select="current()/links/links/link/@link" /></xsl:attribute>
<xsl:value-of select="current()/links/links/link/@title"/>
</a>
Hi bfi...
I want to know if it's possible to make the same in C sharp or the way is completely different ?
Félicien
Yes, it's possible. You can create a user control, put the .ascx in /usercontrols and the .dll in /bin, then create a macro (right click macros, Create and point to the .ascx file for "or .NET User Control"). Now to work with data you can use the node factory api. In the usercontrol you can create a Node node = new Node() and that will be the current page's node. You can get a property by using node.GetProperty("propertyAlias").Value. You can go through the page's children with node.Children etc. To list the related links I think you can use an XmlDocument:
I don't know if the above code actually works, i just typed it here :)
EDIT: in the usercontrol you'll have to reference some umbraco dlls. I usually add businesslogic, cms, umbraco.dll.
Thanks again bfi ! That clarifies me a lot !
is working on a reply...