Copied to clipboard

Flag this post as spam?

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


  • Ghyselings Felicien 22 posts 42 karma points
    Jan 21, 2011 @ 09:24
    Ghyselings Felicien
    0

    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

  • Bogdan 250 posts 427 karma points
    Jan 21, 2011 @ 09:50
    Bogdan
    0

    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.

  • Ghyselings Felicien 22 posts 42 karma points
    Jan 21, 2011 @ 10:02
    Ghyselings Felicien
    0

    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

  • Bogdan 250 posts 427 karma points
    Jan 21, 2011 @ 11:20
    Bogdan
    0

    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!

  • Ghyselings Felicien 22 posts 42 karma points
    Jan 21, 2011 @ 11:24
    Ghyselings Felicien
    0

    yeah :) I'm going to try it ! 

    Thanks a lot for the help

  • Ghyselings Felicien 22 posts 42 karma points
    Jan 21, 2011 @ 13:04
    Ghyselings Felicien
    0

    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 




  • Bogdan 250 posts 427 karma points
    Jan 21, 2011 @ 13:22
    Bogdan
    0

    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.

  • Ghyselings Felicien 22 posts 42 karma points
    Jan 21, 2011 @ 15:17
    Ghyselings Felicien
    0

    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 ?

     

  • Ghyselings Felicien 22 posts 42 karma points
    Jan 24, 2011 @ 09:43
    Ghyselings Felicien
    0

    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

  • Bogdan 250 posts 427 karma points
    Jan 24, 2011 @ 09:50
    Bogdan
    0

    What do you mean by "data type related links"?

  • Ghyselings Felicien 22 posts 42 karma points
    Jan 24, 2011 @ 10:00
    Ghyselings Felicien
    0

    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

  • Bogdan 250 posts 427 karma points
    Jan 24, 2011 @ 10:33
    Bogdan
    0

    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.

  • Bogdan 250 posts 427 karma points
    Jan 24, 2011 @ 10:42
    Bogdan
    0

    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.

  • Ghyselings Felicien 22 posts 42 karma points
    Jan 24, 2011 @ 10:49
    Ghyselings Felicien
    0

    Thx ,good to know. it would be usefull

  • Ghyselings Felicien 22 posts 42 karma points
    Jan 24, 2011 @ 11:02
    Ghyselings Felicien
    0

    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...

  • Bogdan 250 posts 427 karma points
    Jan 24, 2011 @ 11:12
    Bogdan
    0

    Sure it is, this is what xslt is used for. You just have to explain a bit what you try to do.

  • Ghyselings Felicien 22 posts 42 karma points
    Jan 24, 2011 @ 11:19
    Ghyselings Felicien
    0

    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 ? 


  • Bogdan 250 posts 427 karma points
    Jan 24, 2011 @ 11:51
    Bogdan
    0

    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?

  • Ghyselings Felicien 22 posts 42 karma points
    Jan 24, 2011 @ 11:53
    Ghyselings Felicien
    0

    yes, it is what I want

  • Bogdan 250 posts 427 karma points
    Jan 24, 2011 @ 12:01
    Bogdan
    0

    Then you want only text, why not use a Simple Editor, or Textbox Multiline for your property instead of the Richtext Editor?

  • Ghyselings Felicien 22 posts 42 karma points
    Jan 24, 2011 @ 12:19
    Ghyselings Felicien
    0

    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 ? 

     

  • Bogdan 250 posts 427 karma points
    Jan 24, 2011 @ 12:32
    Bogdan
    0

    Oh, maybe you just have to add the disable-output-escaping="yes" tag where you output the property in the xslt?

  • Ghyselings Felicien 22 posts 42 karma points
    Jan 24, 2011 @ 12:56
    Ghyselings Felicien
    0

    Yeah just what I want.
    High five !

    Thanks, really !

  • Ghyselings Felicien 22 posts 42 karma points
    Jan 24, 2011 @ 14:31
    Ghyselings Felicien
    0

    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 ? 

  • Ghyselings Felicien 22 posts 42 karma points
    Jan 24, 2011 @ 17:21
    Ghyselings Felicien
    0

    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>

  • Ghyselings Felicien 22 posts 42 karma points
    Feb 02, 2011 @ 09:09
    Ghyselings Felicien
    0

    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

  • Bogdan 250 posts 427 karma points
    Feb 02, 2011 @ 10:29
    Bogdan
    0

    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.

  • Ghyselings Felicien 22 posts 42 karma points
    Feb 02, 2011 @ 10:43
    Ghyselings Felicien
    0

    Thanks again bfi !  That clarifies me a lot !

Please Sign in or register to post replies

Write your reply to:

Draft