Jeremy Davis
Jeremy Davis
Sitecore, C# and web development
Page printed from: https://blog.jermdavis.dev/tags/c/4

Posts tagged C# (Page 4)

Programmatic WFfM submissions

Recently a client of mine came up with some requirements that involved submitting data to the Web Forms for Marketers database via code. Having done a bit of Googling, I came across a Stack Overflow answer on the same subject which seemed to offer a solution. Implementing this code did indeed allow submitting data – however it didn't trigger Save Actions. So while the data will go to the configured WFfM data store, emails or CRM integrations won't get triggered.

That was an issue for my client, who wanted to have email notifications as well. So starting from the Stack Overflow responses, I looked into how the WFfM save actions can be correctly triggered via code.

Sitecore WFfM C# ~3 min. read

Patterns for navigation controls - Language versions

I was going to stop at three posts on simple patterns for navigation (Parts one,two and three are here) – but earlier this week I realised I'd not covered an important topic in navigation for Sitecore-based websites: How you can navigate between different language versions of your sites and pages. So this week, I'll start looking at language navigation.

There are two common patterns for how you might structure your content in Sitecore if you have a multi-lingual site. Depending on what sort of content you're dealing with, you might choose to:

(Technically, there's also a third option, where you have multiple content trees which may also have multiple languages – but that's just a combination of the two ideas I'll present)

The core navigation controls for these sites work in exactly the same way as the ideas I've presented in previous posts. But if you have multiple languages, then you need some code to display links to let the users swap between languages. And you need slightly different code for these two scenarios. So this week I'll look at the first of these:

Patterns for navigation controls - Varied styles

Continuing the theme of simple approaches to navigation components, this week I want to look at a slightly more complex scenario for the top level navigation in a site. Sometimes you need the mark-up for primary navigation to vary between different items in your navigation. Perhaps you have some pages which need a different style of display because of their purpose on the site. And generally in this sort of scenario you need editors to have some control over which items get these different views.

Patterns for navigation controls - Breadcrumbs

Last week I started looking at some simple ideas for the top level navigation for Sitecore websites. This week, I'll continue that theme with some simple examples of the more localised navigation that you might use on content pages.

Patterns for navigation controls - Basics

Most websites need some sort of navigation UI. If you have a site with more than a handful of pages then you're likely to need to create some components for rendering sets of links that show the structure of your site. So continuing my theme of simple patterns for Sitecore code, here is the first of a few posts on some approaches to navigation.

Another nice feature in C#6.0

Ok, so it's technically Christmas and I should really be eating too many mince pies and watching repeats of early 80s sitcoms instead of blogging. But somehow I can't stop technology catching my eye.

C# Sitecore ~1 min. read

Three simple patterns for finding a target page

Quite often when you're putting together a website, you find yourself needing to link the current page to some sort of shared page for an action. "Click here to read terms and conditions" is a common example – where all your products need to be able to link to the Ts & Cs page.

A naive implementation might just hard code the path here, but that is inherently fragile. Renaming or moving the page can easily break your code. So what better approaches might you consider for meeting your requirement while allowing editors flexibility? Having talked about these patterns with colleagues a few times recently, I thought I'd write down some of the basics as a reference for future conversations.

C# Sitecore ~3 min. read

Merging package definitons

Continuing on from previous discussions about packages and their definitions, I found myself needing to quickly merge together the definitions of two different packages recently. And that sounded like an opportunity for a simple tool to add to my collection.

C# Packages Sitecore ~2 min. read

A quick “find that item” hack

The other day I was having a conversation with a colleague who was bemoaning the lack of a fast way to paste a Sitecore item path into the UI and have the Content Editor change selection to that item. I suggested using the search box or the Navigate button, but apparently they weren't right. The person wanted to paste a link and have the content tree change without any other clicking about.

So, in the spirit of being a helpful co-worker, I hacked up a quick command extension to solve this problem. It's trivially simple, but I figured someone else might find it useful, or learn something that helps them...

C# Sitecore UI ~2 min. read

Templates and help, part two

Last week I talked about an approach to displaying template-related help fields in Content Editor. The last week has been a bit manic, so I've not managed to spend much time on extending these ideas, but I have a basic approach to displaying similar data in Page Editor. Quick one today...