Posts

Umbraco - XSLT - Replace String, Replace String in Selection from DropDownList Mulitiple

The following code highlights the string replacement function in umbraco: The example below places a space after each comma (basically to help with the formatting) from values selected from a multiple drop down list ("placementHospital"). The important bit is highlighted. <?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:E...
C# .Net - Set and Clear text in a Text Box using Javascript onfocus and on blur < asp : TextBox ID ="SearchBox" Text ="Search here..." runat ="server" class ="SearchBoxFP" onfocus ="javascript: if(this.value == 'Search here...'){ this.value = ''; }" onblur ="javascript: if(this.value == ''){ this.value = 'Search here...'; }"></ asp : TextBox >

Umbraco, XSLT, Display a Linked Email, Mailto in a Template from a Field in a DocType

The example below shows you how to display a linked/mailto email address in an Umbraco Template using insertTextBefore and insertTextAfter.   <p><strong>Email Address:</strong>    <umbraco:Item field="emailAddess" insertTextBefore="&lt;a href=&quot;mailto:" insertTextAfter="&quot;&gt;" runat="server"></umbraco:Item>   <umbraco:Item field="emailAddess" insertTextBefore="" insertTextAfter="&lt;/a&gt;" runat="server"></umbraco:Item>   </p>

Umbraco = XSLT - Site Map - Exclude Certain Doctypes from Site Map

The example XSLT below shows you how to exclude certain nodes, based on their document type.  The important bit is highlighted. This is done by modifying the built in XSLT Site Map that comes with Umbraco, just replace the DocType numbers in the highlighted section to get this to work. <?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....

Umbraco - XSLT - List Sub Pages from a Specific Node, by Node Id

The following Umbraco XSLT list all sub pages from a specific Node using node ID.  The important bit is Highlighted.   1)   umbraco.library:GetXmlNodeById(1062) <-- list all sub pages of nodeId 62. 2) You could replace this line above with something like this:  umbraco.library:GetXmlNodeById($currentPage/chooseSubPagesToList) and in your DocType, there would be a contentPicker called 'chooseSubPagesToList. <?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.ExsltRegu...

Umbraco: Enable Blockquotes in Tinymc Richtext Editor

Here is how to enable Blockquotes in Umbraco Tynymce Rich Text Editor: 1) In the folder "config" there is a file called "tinyMceConfig.config". Add the following lines in the <command> section: <command> <umbracoAlias>Blockquote</umbracoAlias> <icon>images/editor/quote.gif</icon> <tinyMceCommand value="" userInterface="false" frontendCommand="blockquote">blockquote</tinyMceCommand> <priority>45</priority> </command> Note: the line highlighted   points to an image that the user will see.  In my install this was a stop sign!  You may want to overwrite the file with something more appropriate (such as a quote). 2) In Umbraco, goto --> Developer --> Data Types --> RichtextEditor and tick the tick box for the Blockquotes. The end user should now have blockquote functionality in there richtext editor.

Umbraco .NET C# Usercontrol Permenant Redirect to Parent Node

This is the Code behind file to permanantly redirect to a parent node in Umbraco. There is no need to have any controls on the .asxp page. Step 1: Create a .Net User Control called: " RedirectToPARENTnode.aspx " Step 2: Paste the code in to the code behind file (.cs): ( important bits highlighted in yellow ) using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using umbraco; using umbraco.presentation.nodeFactory; namespace MyUserControls.Usercontrols {     public partial class RedirectToPARENTnode : System.Web.UI.UserControl     {         protected void Page_Load(object sender, EventArgs e)         {               //MD 06/08/2012                  ...

Umbraco - Macro -XSLT - Flash Audio Player

Umbraco - Macro -XSLT - Flash Audio Player To create a Flash based Audio Player for Umbraco, that will allow users to choose their own audio file, is easily done in 3 steps: Step 1). Find a Flash Audio Player you like. I used this one: http://flash-mp3-player.net/players/mini/generator/  , it is clean and simple and is used in the code below.  There are a lot of others that are easily    integrated with the code below: http://savedelete.com/top-25-best-free-online-music-players-for-your-websites-or-blogs.html Step 2). Upload the Audio Player to your site Upload the Audio Player to your folder structure. In the XSLT below the file is being referenced in a folder called "audioplayer". Step 3) Create a XSLT file with a relate Macro. A: Paste in this code: <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE xsl:Stylesheet [ <!ENTITY nbsp "&#x00A0;"> ]> <xsl:stylesheet     version="1.0"     xml...

Umbraco - C# - Redirect a Umbraco Page to an external web site.

Umbraco - C# - How to Redirect a Umbraco Page to an external web site. Two create a redirect from a Umbraco page to an exteral site you need to:   (this is very simple)  Step 1) Add the page to Umbraco that you want to rediect. (You may want to Hide this page from navigation)  Step 2) Create a new Web Form in C# Visual Studio      (this web form will be placed in the route of the site)  Step 3) Update the Web Config to include the new file mentioned in step 2      (or you will get a Server error in appliaction)  Step 4) Add a Url redirect to the UrlRewriting.config,  from the Umbraco page (created in step 1), to the web form (created in step 2). Step 2: Here is the C# Code (my-redirect-example.aspx) form for step 2: (it is basically a blank form) <%@ Page Language="C#" AutoEventWireup="true" CodeFile="my-redirect-example.aspx.cs" Inherits="my_redirect_example" %> <!DOCTYPE html PUBLIC "-//W3C//DTD X...

Umbrcao - Macro - .Net - c# - Create a one time Pop Up in Umbraco using c# to display a message about cookies

Umbrcao - Macro - .Net - c# - Create a one time Pop Up in Umbraco using c# to display a message about cookies Two create a One time pop up in umbraco to display a message, For example to warn that your site uses cookies, you need to. 1) Create a .Net user Control. 2) Add the .Net user Control to Umbraco Macros 3) Add the Macro to your Main Page Template, so that it displays on ever page. Here are two methods for doing the one time pop up.   The first method displays on every page until the user clicks "Click here to remove this message".  Clicking on "More information about cookies" will take them to the a page displaying your Privacy section, but will not remove the message. The Second method displayed once and the user does not have to click anything. The message will appear on any page the user first lands on and then not be shown again. Method 1 For Creating a One time Pop up warning about Cookies being used: 1) Create a user control called...