Skip to main content

Posts

Showing posts from November, 2011

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">
        <fieldset>
            <div class='element name-…

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-resul…

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>      ...      <charorg="'"></char><!-- replace ' with nothing -->      ...  </urlReplacing>Note: The contents of the "org" attribute is replaced with the contents of the element, here's another example:
<charorg="+">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):