Pages

Friday, January 8, 2016

Sitecore Search - Part 1 - Introduction

Using a search-based approach instead of native APIs is a great way to improve the experience users have with your Sitecore application, for performance and usability, among other reasons. LINQ to Provider is the search API piece of LINQ to Sitecore that allows you to develop search-centered solutions in Sitecore.

LINQ to Provider uses a LINQ query syntax to abstract your code, and focus, from the provider specific query parser. As a developer, this means flexibility and efficiency, since you can write some search code for a Lucene based search project, and move that code to a SOLR based project with little modification. And you don’t have to construct provider specific queries yourself.

Friday, July 31, 2015

Properly adding Javascript in Blogger templates

Back in March, I wrote a post about a simplified method to use Syntax Highlighter in Blogger posts. The method utilizes a script I wrote so that I don't have to directly modify the html in a post (Working with Syntax Highlighter in Blogger Simplified). One of the issues I have run into with various scripts that have been posted, mine included, is the handling of special characters in the script. In certain conditions you need to look for an angle bracket or an ampersand using your script, and those special characters will break the Blogger parser when you attempt to add them directly in your script. In those examples, again, mine included, the special characters in the script have been replaced with their entity codes (see references below). For example, you can't simply add "<br>'.replace('<br/><br/>');" in a Blogger script.

After I posted that, I had a realization that you can simplify that condition, and future situations surrounding the use of Javascript in Blogger. Well, I finally got around to doing a quick test, and it seems to work without issue.

Tuesday, May 12, 2015

Sitecore List Fields - Item Not Found in Selection

I recently wrote an extension library for Sitecore to simplify setting values for fields.
Because of the way the specific field classes are created in Sitecore, setting values specific to the type of field can be tricky. For text-based fields, like Single-Line Text, Multi-Line Text, Rich Text, and a few others, you can actually set the value directly on a generic Field object with relative ease. For more complex types like lists, links, and images, though you can set the value directly on a generic Field object, setting the more specific options for the value needs more care.

So, I wrote an extension library to look at the Field type and set the value using the best method for that type. It worked great as far as I could tell, until I looked a little deeper during my "QA phase". And wouldn't you know it, it turns out there is a funky behavior with the list fields.

Tuesday, March 24, 2015

List Enum Types and Values in C# - Ektron Sample

Sometimes when you are working with an API you run across a scenario where the documentation doesn't outline exactly what you need, but you know it's there in the code. I have come across this scenario in several cases while working with Enumerations, specifically, where I knew I needed one specific value, maybe two, but I was uncertain exactly which ones they were.

Thankfully, with Visual Studio you can type a part of the Namespace, Class, or Enumeration, and then scroll through the list to see your choices for Enum types or values in Intellisense. Sometimes, though, that's a bit slow for finding exactly what's needed; especially when dealing with a list of over 150 options. This isn't always the case, but in those instances where I have a large list housed in a Namespace, Class, or two, I would prefer an easier method to visualize them, and maybe look through them.

Wednesday, March 18, 2015

Organizing Views in Sitecore

I have recently been working on a Sitecore project that is not terribly complicated, but has the potential to support multiple sites. The sites are similar in structure, and they will share some components, but there are many pieces of them that will be unique enough to warrant their own Views.

And with that magic word you can probably guess that this Sitecore instance is built with MVC. For a little more information about it, this instance of Sitecore is running version 7.5 and MVC 5.1 with Razor syntax.

The Problem

The problem is I want to keep an organized structure for my site not only with my Sitecore architecture, but also for my Controllers and Views. I am dealing with a Sitecore instance that will host multiple sites in the near future, so I have structured Sitecore to have different site-specific folders in my Content, Layouts, Media Library, and Templates sections. There are also Global folders in these sections where I will store items that are universal, but the specifics around my architecture can be saved for another post.

Wednesday, November 5, 2014

Solving Glyphicon Support In IE7

Yes, I am talking about IE7 support. If you don't care about half of the how and why, you can just scroll down to my solution. If you care a little bit more about why I came up with this solution, read on.

The Backstory

Bootstrap has become a staple to websites like salt and pepper have to a dining room table and while most of the world developers have moved on to Bootstrap 3, my current project is reveling in Bootstrap 2.3. To some this may seem like a travesty, but I have good reasons for it, the most prominent being required IE7 support, and that is where the reasoning ends in this post.

Actually, if I really think about it, this blog deals less with me being on Bootstrap 2.3 for this application, and more with the Glyphicons used in Bootstrap 3. Why? Well, I had a need for Glyphicons from BS 3 in our BS 2 application so, like any good developer would do, I ported them over. Done. Well, kinda...

Wednesday, September 3, 2014

Refresh CSS without refreshing your page

I've been using Visual Studio 2013 for several months now and one of the new features I was enjoying was Browser Link. Since I have been implementing the front end for a project, I have been using Web Essentials for VS 2013 with all the CSS built using LESS. While I have used more complex and advanced LESS compilers, it's got a nice integration into Visual Studio with pretty solid support, and the developer has been keeping it well updated. It's nice because I can play in my browser, move my changes into my "main.less" file right in VS, fire off a Shift+Alt+Y shortcut combo, and my LESS files are compiled into my "main.css" file. With Browser Link, the page detects the change and refreshes with the CSS updates. Voila!

Now, anyone who read that with a keen eye would have noticed the use of the word "was" in the opening sentence. A past progressive verb! This means I am not "enjoying" the feature anymore.