On the current project I'm working on, I need to replace a telephone number, depending on whether a cookie has been set. So the way I'm thinking at the minute, was that in the content, i'd put the number in as {TELEPHONE} and then intercept the content before it's rendered and replace as necesary.
I've been trying to think of a way to do it in XSLT and using my own extensions, but it's a bit messy. Is there a way that I could do it from c# and extending Umbraco itself?
Intercept content and dynamically replace
On the current project I'm working on, I need to replace a telephone number, depending on whether a cookie has been set. So the way I'm thinking at the minute, was that in the content, i'd put the number in as {TELEPHONE} and then intercept the content before it's rendered and replace as necesary.
I've been trying to think of a way to do it in XSLT and using my own extensions, but it's a bit messy. Is there a way that I could do it from c# and extending Umbraco itself?
Many thanks in advance for any help.
Mark
I think you can do something like this. Too
<%@ Master Language="C#" MasterPageFile="/admin/masterpages/default.master" AutoEventWireup="true" %> <script runat="server"> protected void Page_Load(object sender, EventArgs e) { string telephone = umbraco.presentation.nodeFactory.Node.GetCurrent().GetProperty("telephone").Value; if (Session.Cookie.Isset) //Not sure about the code here. { telephone = ""; lblTelephone.Text = telephone; } else { telephone = ""; } </script> <asp:Content ContentPlaceHolderID="ContentPlaceHolderDefault" runat="server"> <asp:Label id="lblTelephone" runat="server"></asp:Label> </asp:Content>is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.