Posts

XSLT Umbraco - Get and Display an Image and Text from the Current Node

XSLT Umbraco - Get and Display an Image and Text from the Current Node <?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"  exclude-result-prefixes="msxml umbraco.library Exslt.ExsltCommon Exslt.ExsltDatesAndTimes Exslt.ExsltMath Exslt.ExsltRegularExpressions Exslt.ExsltStrings Exslt.ExsltSets...

Create a .NET Contact Form that Gets the Last Url Visited in C# Can also be Used in Umbraco

This is a Simple Contact From done in C# .Net and also can be used in Umbraco.  Paste the code in to Visual Web Developer for a better view. The important bits are coment in the second file.  One of the Commented out lines highlights how to get the mailto address from an Umbraco field. The code Below includes the myContactForm.ascx.cs codebehind file and the myContactForm.ascx file. 1) The myContactForm.ascx file:  <%@ Control Language="C#" AutoEventWireup="true" CodeFile="ContactFormforPublications.ascx.cs" Inherits="usercontrols_ContactFormPublications" %> <div class="contact-form" id="contactForm" runat="server">     <h3>Request a Publication</h3>     <div class='int'>         <form runat="server">         <asp:Panel DefaultButton="contactFormSubmit" runat="server">      ...

Umbraco Macro - Only Write content Out if some content exists.

In the example below, the Macro will only write the content out if there is some content to write out.  For example if there is any content in the "CaseStudy" field write out the content in a DIV.  If not, do not display the DIV <?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"  exclude...

DISABLE OUTPUTING - Use this when HTML Code is Showing rather than the Content when writing a Macro

Issue:  I am trying to write out an Image and some text from Content in a Macro, but hte HTML is showing DO THIS: <xsl:variable name="getimg" select="$currentPage/caseStudyImage"/>   <div id="casestudyimg1">    <xsl:value-of select="$getimg" disable-output-escaping="yes"/ >   </div> INSTEAD OF THIS: <xsl:variable name="getimg" select="$currentPage/caseStudyImage"/>   <div id="casestudyimg1">    <xsl:value-of select="$getimg" / >   </div>

Remove Unwanted Characters from Umbraco Nice URL

The simple way to remove unwanted characters from your URL is to change the rules umbraco uses when it generates the NiceUrl. Edit the config/umbracoSettings.config add a rule to remove all apostrophes from NiceUrls like so: <urlReplacing>       ...      <char org = "'" ></char>     <!-- replace ' with nothing -->       ...  </urlReplacing>   Note: The contents of the "org" attribute is replaced with the contents of the element, here's another example: <char org = "+" > plus </char> <!-- replace + with the word plus -->  

Umbraco Email Notifications - File Location and Default Email Address for Notifications

A) WHERE Does the 'to' email address go? 1) There is a setting in the config/umbracosettings.config         <notifications>             <!-- the email that should be used as from mail when umbraco sends a notification -->             <email>your@email.here</email>         </notifications> B) Where to change the Content of the Email: 1 ) en.xml file: (umbraco\config\lang):

Complex XSLT Macro for embedding an I frame - using Paramaters

 (http://forum.umbraco.org/yaf_postst4641_cant-embed-html-in-page.aspx) Create a new macro and in it create 3 parameters "location", "width" and "height". Check the "Use in editor" checkbox. Now create a xslt that looks something like this: <?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"     exclude-result-prefixes="msxml umbraco.library"> <xsl:output method="xml" omit-xml-declaration="yes"/> <xsl:param name="currentPage"/> <xsl:variable name="location" select="/macro/location"/> <xsl:variable name="width" select=...

Simple XSLT Macro for embedding an I frame:

Simple XSLT Macro for embedding an I frame:   1) Create a New "Clean" xslt - ensure Create Macro is Ticked. 2) Where the XSLT reads: <!-- start writing XSLT --> - just paste in your IFRAME (highlighted below) 3) Go to the new Macro and tick "Use in Editor", this will allow it in the user drop down.       <?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.ExsltStrin...

Umbraco - Using GetPreValueAsString to Return the String of a Field and not its value

If you have a field in Umbraco that is getting returned as a number instead of the name, see the highlighted text below.  1 - In a Macro . 2 - In a Template. 1.  IN A XSLT MACRO : <?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-r...

XLST: Display an Image from a node reference and write it out if Tickbox is selected

<?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"  exclude-result-prefixes="msxml umbraco.library Exslt.ExsltCommon Exslt.ExsltDatesAndTimes Exslt.ExsltMath Exslt.ExsltRegularExpressions Exslt.ExsltStrings Exslt.ExsltSets "> <xsl:output method="xml" omit-xml-declaration=...