Loops and Such

There are several different types of loops in ColdFusion and sometimes it can be difficult to know which one to use and what properties are required to use it. This post is designed as a resource in deciding on the best loop for the job and how to write that particular loop. Also included is a quick reference PDF to print out that will help you remember which ones to use.

List Loop

At the top of our list is the list loop. The list loop is used when looping over any data that can be broken apart as a list. Remember in ColdFusion you can use different delimiters for lists, so you aren’t limited to just commas. For our example, lets consider a non-normal list such as a URL like so: http://domain.com/blog/my-first-post/comments. I’ve actually had to parse over a URL like this before. Looking at this string we can break apart the list by each forward slash. For our example, I don’t want the “http” so I’ll remove it as well.


File Loop

The file loop is exactly like the list loop, except the list isn’t a string you give it but a file that can be read by ColdFusion. Using the same syntax above but changing the delimiter to the new linefeed and carriage return, we can output over each line of the file.


Index Loop

The index loop is the simplest of the loops. It simply loops from point a to point b that you specify. It’s not that smart but it can get the job done when need be. For our example, we’ll pretend we want to loop based on the size of an array. In an index loop, there is a special character called an index that holds the value of the loop we are one. The index starts at the value you enter for start and counts up until it reaches the value of to.


Conditional Loop

The conditional loop is one of the few loops with real logic. The conditional loop will continue to run until the condition it is checking returns false. Once it does, it moves on. If you setup your conditional loop incorrectly it could crash your program as it will possibly run forever. In our example we’ll run our loop until we find strawberries.


Query Loop

The query loop is probably the most used as typically when grabbing data from a database, you need to output it. The query loop is designed to loop over data until all rows have been looped.


Collection/Structure Loop

The collection/structure loop is very similar to the query loop in that is loops over the keys in a structure in the same way a query loop runs over the rows in a query. With the collection loop however, the item holds only the key of the structure. One draw back to the collection/structure loop is that structs aren’t in a particular order like queries.


Download the quick reference guide to see limited syntax of these loop types for quick reference.


Instructor Walk-Through

We have developed a web application for USU instructors to access some pertinent information about their courses as well as submit and approve a few items before they teach. This system informs instructors of the status of their courses, payment information, as well as requests from them their syllabus and textbook information. This walk-through is for instructors and how they use their system.



After they login they are presented with their dashboard which shows them some quick information about their courses and information we have on file for them. Also included in their dashboard are helpful contact information and some links to common USU services. When instructors are ready to view their course details they can click on one of their courses in the list or click on “Course Info” in the main navigation.


Course Info

Once at the Course Info screen, each course they have been assigned to teach will be listed by term. One each row the instructor can see the course information including enrollment, location, delivery method, payment details, syllabus, textbooks, and materials submission. On the left side of the course information, the status is indicated by an icon. The course status changes as it is approved by USU, submitted to banner, the textbooks are submitted and finally published.



A syllabus must be on file for every course to display to the students prior to registration. The system will check in Canvas for an active syllabus and use that one if it exists. If none exists, or you want to display a different syllabus to students looking into the class, you can upload one here. Often times instructors upload a syllabus without specific dates so they can reuse the same one every semester. Once a syllabus is either in Canvas or submitted you can view the syllabus from here as well.



Textbooks are also required by law to be on file for students at the time of registration. We cannot assume you want to use the same textbooks from last year and even if no text is required you must submit a textbook order saying no text is required. If you have not submitted your textbooks there will be a submission button on the screen. If you have, a link to view the textbook order will be in the place of the button.

Blog Comparison

Let’s look at WordPress, Blogger, and Square Space. Square Space isn’t a blogging platform per-say, but rather a website editor with blogging tools. One can argue this is what wordpress has tured into anyway.

If I were to rank these for blogging I’d probably put then Blogger, WordPress, and then Square Space. The reason being is, with blogging you really only need an easy publishing tool, and it doesn’t get much easier than blogger. It’s straight forward, easy to use and really only does one thing. WordPress has evolved into a very in-depth web authoring tool and as such can be a bit harder to hit the ground running. Square Space has blogging as a feature more than anything else.

If I were to rank these by best overall tool however, I’d probably put them WordPress, Square Space, and then Blogger. WordPress is extreamly extensible, has access to probably millions of plugings, and the source code is 100% editable. It’s easy to stand on the shoulders of giants with WordPress and make some amazing things. Square Space is a great authoring tool, with some amazing built in customization features, but is a bit less open to edit. Blogger is very limited and very hard to edit. I’ve had experience with how cumbersome it is.

When choosing one though you still have to factor in other things, like the fact that Square Space isn’t free. Blogger ONLY runs on it’s platform and the underlying code I don’t believe is customizable at all. The large majority of developers know wordpress (at least some what) and could help if needed. These are just some other factors that come into play when choosing one.

Best Practices

It’s going to be hard to separate my personal beliefs I’ve held in my profession for years and those I am trying to read about today. While not an avid blogger, I’ve been involved in many blogs for years because of my profession. So without any particular order, the list.

Search Engine Optimization

While this encompasses and effects much of what you do on your blog, I think it’s almost the most important. You write a blog to get read, and generally to get read it must get found. Taking into account how search engines find your work and rank it will dramatically affect how you go about blogging.

Content is King (https://moz.com/beginners-guide-to-social-media/blogging)

I’m going to lump a few tips into one here. People come to your blog to get to your content, and as such, some things matter much less. What that is depends on your blog. I don’t care much about the design, pictures or writing style of the progamming blogs I read. I care about the clarity and examples. If I were a photographer I would care much less about the words and more about the images. When I read sports blogs I care much more about the creative writing style and images than I do in some other areas. Think about your auidence, why they are there, and whatever content they are looking for. Make that content king.

Involve Readers (http://www.campaignercrm.com/en/community/blog/crm/post/10-best-practices-for-corporate-blogging/)

I think one of the other most important thing is involving the readers. There are a few blogs I’ve visited where I can’t comment on the posts. This can be bad when I have questions or would like clarity on topics covered. It’s not needed for every setting, but in most cases, comments can’t hurt.

Educational Blogs

Most of the internet I frequent I would consider to be educational blogs. At least, they way I see it, blogs that teach or train would be educational, not just blogs that focus on traditional education. In fact this blog I am posting to is one I used to teach the webmasters I worked with how to use our system and to perform their tasks. I don’t aspire to be a teacher so I think these are much more applicable to my career. Though, some of these blogs are used in conjunction with or referenced from training I have attended.

I think the most useful thing about blog software in regards to teaching is the ease in which teachers can show examples and answer questions or otherwise interact with students and have the thoughts of all shared with everyone. It’s pretty great actually. One of my favorite is Norman Nielsen’s article blogs. (http://www.nngroup.com/articles/) Sure he calls them articles, but if you read through them they are pretty much in blog format and do a great job of teaching as well as selling their services.

Ben Nadal (http://www.bennadel.com/) is a great example of sharing his skills and expertise through his blogs. He never hesistates to interact with his readers, follow up on their questions, and touch on trending topics.

Smashing Magazine (http://www.smashingmagazine.com/) has daily articles as well which resemble NNG’s posts above. In all these example they provide what amounts to free training for those interested.

The Menus had Children

Finally, the ability to add sub-menu items to your left menus has arrived. You will notice the next time you go into the CMS, the menu manager looks very different. It functions however, in very much the same way. When you are first looking at a menu, the only thing you will see will be the link text for each menu item. These can be rearranged as they always have been. However in addition to simply changing the order, if you drop one of the items on below and to the right of another item, it will make that a sub-menu item. It will be offset a bit to the right as well.

In order to see that menu item on the website, the user will first have to click on its parent and it will drop down. If the user is looking at the parent menu item, or a page included as one of its children, that menu will automatically be expanded and visible on the website. You can see this functionality on the distance.usu.edu website currently.

In order to edit the text or link of a menu item, click on the small plus sign to drop down the options. You can no longer change the menu item type, i.e. you cannot change a menu item that is a internal link to an external link or file. You will have to delete it and add another. Also, existing file menu items are still there, but in the coming days will be removed. The file menu item will no longer exist and will need to be input simply as an external link.

Menus can only be on level deep. I may add the functionality to have more than one level deep, but for right now, that’s it. This should allow now for greater flexibility in your left menu navigation. On the distance site, I now have a single menu for almost all of the pages. The menu automatically expands based on the page the user is on and allows for consistent navigation throughout the website. I suggest you look at your current navigation scheme and decide how you can make it more consistent. I may be going through the websites in the coming days and making tweaks to better improve the usability.

As always, if you have any questions about using this new functionality, please simply drop me a line or call.

Prospective Students = Future Students

You may notice that the “prospective_student” URLs have been changed to future-students. I have gone through the CMS and updated all pages and links and changed anything with prospective students to future students. We are trying to do away with the term “Prospective Student” as well. So please refrain from using the term in the future on the website. Please remember to not accidentally create new pages in the “prospective_students” directory. Create any pages that you would put there into the future-students directory.

No action is required on your part as a webmaster at this time. If you would like, you can double check and make sure I didn’t “break” anything, but I’ve looked through most of the sites and everything looks to be fine. If you notice anything at a later time that you think may be related to this, please let me know.

The Magic Bullet

We have added a new feature to the websites that I will need your help with going forward. We have added a marketing tool to all pages that are primarily used by prospective students. This has to be added by me from here, but I went through all the websites and tried to get all the prospective students pages, tuition pages, advising pages etc. However when you create any new pages that are primarily used by prospective students, it would be a good idea to add this tool to those pages as well.

What I want from the webmasters, is to take that into account when creating new pages and let me know if you think the page you are making is primarily marketing driven, is for prospective students, etc. Any pages like that I need to know about so that I can use this tool on those as well.

The Anatomy of a Search Result

So I have added some page options to better help us with Search Engine Optimization. These new page options will also help your sites with social sharing and just good web practices in general. Essentially up till now, we have left sites like Google and Facebook in the dark as to what our pages are about. They make their best guess and move on. However there is a better way. For each page on the website now you can customize four things. These four things are:

  • Meta Title
  • Meta Description
  • Meta Image
  • Meta Keywords

Two of them are crucially important and two are less so. I’ll cover each of them so you know how they work. I ask that you set as a goal to update these four fields on each page of your website in the future. No need to rush out and get them done tomorrow. We haven’t done them in this long, it won’t hurt to wait any longer. I would just put it on the to-do list and work on it when you can. We “might” be doing these from here in the future as part of an overall SEO marketing strategy, but for now we are not.


Anatomy of SEO

Continue reading

Degree Vanity URLs

As promised I am posting the list of vanity URLs that I have created. These “may” change but for now these are them. You can download the Degree Url if you like. If you just go to your website and click on a degree, you will see the URL as well. Continue reading