Copied to clipboard

Flag this post as spam?

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


  • Stephen 204 posts 246 karma points
    Aug 21, 2011 @ 21:43
    Stephen
    0

    expanding the contact form

    Hey there, loving the CWS stuff really helped me get a grip umbraco and how it works.

    I'm creating a booking form which is based on your contact form, I'm writing a control in .net but part of my form will need a drop down list, which i want the user to be able to manage themselves from Umbraco, can this be done?

    Many thanks,

    S

  • Fuji Kusaka 2203 posts 4220 karma points
    Aug 22, 2011 @ 05:10
    Fuji Kusaka
    0

    Hi Stephen 

    If you are only making a booking form just like you would do with a contact form then you could also used one of the packages from  cultiv http://our.umbraco.org/projects/website-utilities/cultiv-razor-contact-form or Contour http://our.umbraco.org/projects/umbraco-pro/contour.

     


  • Warren Buckley 2106 posts 4836 karma points MVP 7x admin c-trib
    Aug 22, 2011 @ 09:25
    Warren Buckley
    0

    HI Stephen, as Guji suggests it is probably best to use our Umbraco form builder addon Contour.
    Which will allow users of your Umbraco installation to build & create forms (with dropdown options which you are after) all with an easy to use interface.

    You could probably code it yourself, however for the low cost of Contour it will be alot cheaper than the time it would take you to build & develop what you want.

    http://umbraco.com/products/more-add-ons/contour

     

     

  • Stephen 204 posts 246 karma points
    Aug 22, 2011 @ 10:11
    Stephen
    0

    thank you both for your input, so will contour allow me to build a drop down list which in turn the client can edit?

    Can i also sneak in another question whilst i can! On my home page design's i like to display content (character limited) from other pages and a "find out more..." link taking them to the actual page is there a way to do this in umbraco and i guess is there a way to let the client chose from the pages they have created below the home page to display on the home page?

    The attached below shows my home page and the red panels would could shortened text and a link the "about me" and "lessons" page.

     

     

     

  • Fuji Kusaka 2203 posts 4220 karma points
    Aug 22, 2011 @ 10:26
    Fuji Kusaka
    0

    Hi Stephen,

    Yes you can add give the client access to add new items in the drop down list by using the edit items in Contour. The other great feature of Contour is the Prevalue Sources where you can make a connection with your sql db and so get the list of items from your db inside contour and edit the item list instead of inserting items one by one.

    For the second point what you are looking for is totally possible you just need to make use of the umbraco library (TrunCate) inside your XSLT

      <xsl:value-of select="umbraco.library:TruncateString(yourAlias, 100, '...')"/>

    //fuji

     

  • Stephen 204 posts 246 karma points
    Aug 22, 2011 @ 11:07
    Stephen
    0

    thanks all, appreciate the time.

  • Stephen 204 posts 246 karma points
    Aug 22, 2011 @ 13:35
    Stephen
    0

    So just to confirm the 2nd point above Fiji, in XLST i need to reference the page (using page name?) and then the alias within that page (i.e bodyText) if so is there an example of how this is done on any of the sample websites...sorry my XSLT skills are nowhere at the moment.

  • Fuji Kusaka 2203 posts 4220 karma points
    Aug 22, 2011 @ 14:22
    Fuji Kusaka
    0

    Hey Stephen,

    Can you show us your XSLT code or how your content structure looks like?

    (yourAlias here is the document Alias type you created in your document Type, 100 is the maximum numbre of characters to display)

    <xsl:value-ofselect="umbraco.library:TruncateString(yourAlias, 100, '...')"/>

    //fuji

     

     

  • Stephen 204 posts 246 karma points
    Aug 22, 2011 @ 15:30
    Stephen
    0

    If i understand this right

    <xsl:for-each select="$currentPage/ancestor-or-self::* [@isDoc]/tmTextPage/* [@isDoc]">

    the tmTextPage is referring to a document type, but can i refer to an actual page rather than a document type as that document type is used by several pages...i'm guessing @isDoc would change...

  • Fuji Kusaka 2203 posts 4220 karma points
    Aug 22, 2011 @ 19:51
    Fuji Kusaka
    0

    Hi again, sorry am really not sure what you are asking here. 

    From your previous post i kind remember that there was a news section under which you wanted to truncate your content right?

    You can do this by using the following in your XSLT

      <xsl:for-each select="$currentPage/ancestor-or-self::* [@isDoc and string(umbracoNaviHide) != '1']">      
    <xsl:value-of select="umbraco.library:TruncateString(tmTextPage, 100, '...')"/>
    </xsl:for-each>
  • Warren Buckley 2106 posts 4836 karma points MVP 7x admin c-trib
    Aug 22, 2011 @ 20:00
    Warren Buckley
    0

    Hello Stephen,
    The best way to add specific tmTextPage documents to the homepage is to add a new property that is a true/false (boolean) to your tmTextPage document type.
    Give it the alias of showOnHomepage for example and then your Xpath in your xslt will look like this: 

    select="$currentPage/ancestor-or-self::homeNodeAliasHere[@isDoc]" />

    <
    xsl:for-eachselect="$homeNode//tmTextPage[@isDoc and string(umbracoNaviHide) != '1' and showOnHomepage = '1']">      
    <xsl:value-ofselect="umbraco.library:TruncateString(bodyText, 100, '...')"/>
    xsl:for-each>

    Without seeing your site structure I am not 100% sure I am selecting the correct documents in the location, but this should help you out.
    The for each here is saying find me tmTextPage document nodes no matter how deep (//) under the homepage node where it is a document and the property umbracoNaviHide is not true/yes and our property showOnHompege is true/yes.

    Then for each tmTextPage that matches that critera we output the property value of bodyText and truncate it to 100characters and append ... to it.

    Hopefully this answers your question though.

    Cheers,
    Warren 

  • Stephen 204 posts 246 karma points
    Aug 23, 2011 @ 10:06
    Stephen
    0

    Hi Warren yes that does make sense...i have shown an image of my structure below.  The key for me is that i have several pages (this might be my first mistake) that use a tmTextPage document type however i want to target the "about us page". Should i really have a specific document type for the about us page or can I, in XSLT reference the page alias rather than document type?

  • Warren Buckley 2106 posts 4836 karma points MVP 7x admin c-trib
    Aug 23, 2011 @ 12:39
    Warren Buckley
    0

    Hi Stephen,
    Yes you can target the about us node with xPath.

    You can do something like so:

    <xsl:variable name="aboutNode" select="$currentPage/ancestor-or-self::tmTextPage[@nodeName = 'About us']" /> 

    The problem is that if you change the name of the node to somethign else, which the content editor could do, it will obviously break this logic, but you can try something that may be a bit better by targeting the specific nodeID of the about page (found on the properties tab of a node)

    Again this is not ideal, as the content editor could delete the node by mistake, but this may not be a problem for you.

    <xsl:variable name="aboutNode" select="$currentPage/ancestor-or-self::tmTextPage[@id='1234']" />

    If you tell me what you are trying to achieve specifically then I may able to offer some advice on an xPath selector that is maybe more bullet proof.

    Cheers,
    Warren 

  • Stephen 204 posts 246 karma points
    Aug 23, 2011 @ 13:17
    Stephen
    0

    thanks Warren, i can see that referencing a page by name is dangerous, i have no control what the client could rename this to, or even delete by mistake and then recreate which would break both node and nodeID methods you describe, which by the way was exactly what i was after!  although maybe not now. :-\

    Effectively i want to have two feature panels on my home page.  I want these feature panels to be automatically populated with content from pages below the home page by the user selecting which pages to feature (which is a change to my original idea which clearly will cause problems).  If they selected the about us page to feature on the home page then if should take the about us "Title" and "BodyText" copy and display it in the panel with a link to view that page in full.

    Does that makes sense?

    S

     

  • Warren Buckley 2106 posts 4836 karma points MVP 7x admin c-trib
    Aug 23, 2011 @ 15:48
    Warren Buckley
    0

    Hey Stephen,
    THe best thing is to do what I suggested and add a new Yes/No (boolean) property to your tmTextPage docType. Then you can say get all nodes of tmTextPage only where the boolean property is set to true.

    So the user can control any child pages of the homepage that are tmTextPage with the property being in the carousel or on the homepage.
    Let me know if you need a hand with the XSLT, for this.

    Warren

  • Stephen 204 posts 246 karma points
    Aug 24, 2011 @ 10:22
    Stephen
    0

    thanks for all your help Warren, i'm going to give the XSLT a go this morning and see how i get on...can you recommend any XSLT or even Umbraco books...I'll be signing up for the TV sub this week but I think a book might be better for XSLT.

    Stephen

  • Stephen 204 posts 246 karma points
    Aug 30, 2011 @ 16:51
    Stephen
    0

    Hey warren, I have this working the way i want it..using the code below. I'm trying expand this further by NOT showing the content if I'm on the page which i'm highlighting in the code below? Could i simply add a choice statement?

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE xsl:stylesheet [ <!ENTITY nbsp "&#x00A0;"> ]>
    <xsl:stylesheet
      version="1.0"
      xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
      xmlns:msxml="urn:schemas-microsoft-com:xslt"
      xmlns:umbraco.library="urn:umbraco.library" xmlns:Exslt.ExsltCommon="urn:Exslt.ExsltCommon" xmlns:Exslt.ExsltDatesAndTimes="urn:Exslt.ExsltDatesAndTimes" xmlns:Exslt.ExsltMath="urn:Exslt.ExsltMath" xmlns:Exslt.ExsltRegularExpressions="urn:Exslt.ExsltRegularExpressions" xmlns:Exslt.ExsltStrings="urn:Exslt.ExsltStrings" xmlns:Exslt.ExsltSets="urn:Exslt.ExsltSets" xmlns:PS.XSLTsearch="urn:PS.XSLTsearch"
      exclude-result-prefixes="msxml umbraco.library Exslt.ExsltCommon Exslt.ExsltDatesAndTimes Exslt.ExsltMath Exslt.ExsltRegularExpressions Exslt.ExsltStrings Exslt.ExsltSets PS.XSLTsearch ">


    <xsl:output method="xml" omit-xml-declaration="yes"/>

    <xsl:param name="currentPage"/>
    <xsl:param name="MaxNoChars" select="100" />
    <xsl:template match="/">

      

      <xsl:for-each select="$currentPage//ancestor-or-self::* [@level = '1']//* [name() = 'tmTextPage' and showOnHomepage = '1']">     
       <h2><xsl:value-of select="@nodeName" /></h2>
        <p><xsl:value-of select="umbraco.library:TruncateString(umbraco.library:StripHtml(current()/bodyText), $MaxNoChars, '...')" /><a href="{umbraco.library:NiceUrl(@id)}"> Read more </a></p>
      </xsl:for-each>

    </xsl:template>

    </xsl:stylesheet>

  • Warren Buckley 2106 posts 4836 karma points MVP 7x admin c-trib
    Aug 31, 2011 @ 09:53
    Warren Buckley
    0

    Hi Stephen,
    One easy way you could do is to add an xsl:if inside the for-each loop.

    ....  
    <xsl:if test="current()/@id != $currentPage/@id">
    <h2>....</h2>
    .....
    </xsl:if>
    </xsl:for-each>

    However you could update the xPath in the xsl:for-each but the if inside the loop is much easier to begin with.

    Cheers,
    Warren 

  • Stephen 204 posts 246 karma points
    Aug 31, 2011 @ 11:03
    Stephen
    0

    easy works for me Warren, at least until my XSLT book arrives!

    thanks again.

    S

Please Sign in or register to post replies

Write your reply to:

Draft