Sponsored Post

This post is written by Zac Vineyard, Director of Web Development at Northwest Nazarene University.

At Northwest Nazarene University (NNU) we’re launching a website redesign this year where our frontend design and user experience will be focused on answering common user questions quickly, simplifying the user journey (by shoring up the navigation), developing consistency in “product” page layouts, and emphasizing on-page calls to action (CTAs). To accomplish this, we’re going to support our new design with a robust backend system for data delivery.

I bet these are goals you’re trying to pursue with your own university’s website. If so, I’d like to point out two backend website tools we’re going to use at NNU to help drive user success.

Note that we’ve selected PyroCMS as our content management system at NNU. I’m particularly excited about this CMS because it is built using the popular Laravel framework. There are several features in Laravel, like customizable routing, built-in frontend asset compiling, and a robust object-relational mapper (you’ll learn about this one shortly), that will build a foundation upon which we can enhance our website’s user experience.

The two key backend tools we’ll use are Laravel’s Eloquent ORM and PyroCMS’ Streams Platform.

Database-Driven Site

Since our last redesign, NNU’s website grew to be very large and, at times, very unorganized. If you are a university web developer, you’ve likely seen some of the problems we face every day: different prices across pages, conflicting degree information, or university statements updated in one location but not another. To help correct content inconsistency, NNU’s new website will be far more database-driven than in the past.

What does this mean? All of our degrees and academic programs will no longer be free-flowing content placed into an empty CMS layout, but instead a templated page with a consistent design from degree to degree that queries all program data from a set of predefined database tables. This might sound audacious, but we think it is possible with the right set of database tools.

What is Eloquent?

“The Eloquent ORM included with Laravel provides a beautiful, simple ActiveRecord implementation for working with your database,” according to Laravel’s site. In other words, it takes the crud out of CRUD (create, read, update, delete) work. Key to our success, and to the success of our database-driven site is this idea: with Eloquent “each database table has a corresponding ‘Model’ which is used to interact with that table. Models allow you to query for data in your tables, as well as insert new records into the table”

Here’s what this looks like in code:

<?php

use App\Degrees;

$degrees = App\Degrees::all();

foreach ($degrees as $degree) {

echo $degree>title;

}

PyroCMS Streams

One of the core features of PyroCMS is to connect Eloquent models with CMS templates. In PyroCMS, you can query data in a layout and loop over that data to quickly make pages dynamic. PyroCMS uses a core module called “Streams” to power this connection.

Here’s an example of what this looks like in code (TWIG template):

{% set degrees = entries(‘organization’,degrees).where(‘slug’, request_segments()|last).get() %}

{% for degree in degrees %}

<h1>{{ degree.title }}</h1>

<p>{{ degree.description }}</p>

{% endfor %}

You can see the similarities here between Eloquent Models and Streams. This isn’t, of course, the only way you can use Eloquent Models in Laravel or the only way you can use the Streams Platform in PyroCMS. They are very robust tools. You can call them into action from any other part of the application (in extensions or module add ons).

I encourage you to look into Laravel, the Eloquent ORM, and PyroCMS and see how ideas in those systems may change your view on the complexities of working with databases, database tables, queries, and data. You might be surprised by how fluid, flexible, and refined working with databases has become.

 

Article Author