George Mason University Antonin Scalia Law School

Setting up an RSS Feed Parser in MODX

MODX uses an add-on called getFeed to parse RSS content.

In order to use it, place this code on your page template (example uses the Faculty News Feed):


[[!getFeed?
&url=`https://sls.gmu.edu/faculty-news/feed/`
&tpl=`RSSFeedParser`
&limit=`1`
]]

The code pulls the RSSFeedParser, a custom chunk we made that pulls the most recent article title and link.

Titles are pulled using:

[[+title]]

Links are pulled using:

[[+link]]

Here is a list of other data fields that may be pulled from the RSS Feed, if available:

  • title – The title of the post.
  • link – A direct link to the post.
  • description – The description of the post.
  • pubdate – The date the post was published.
  • guid – The GUID of the post.
  • author – The name of the author of the post.
  • category – Any tags or category associations the post has.
  • summary – A short summary of the post.
  • date_timestamp – The timestamp of the post.

Like most MODx variables, wrap the data fields with double square brackets, but be sure to use the + sign prefix rather than the * symbol.

Full-Time Faculty Table

The Full Time Faculty Table implements one ditto that calls two separate chunks.

The chunks are:

ditto.people_finder.odd.tr.2018

and

ditto.people_finder.even.tr.2018

The structure of both dittos are the same, with only the row background color being different using the existing even and odd classes within the main style sheet.

When calling the ditto, filter the results using:

&parents=`5842,1794`

This sorts the list based on Faculty Type.

When adding fields use the + sign instead of the usual *, so to add the professor’s title, it would look like this:

[[+title_main]]

To integrate a link, use this format:

<a href="mailto:[[+email]]"">[[+email]] </a>

Main Site Top Navigation Bar

Assigning new pages to different sections of the site are done within the resource itself under Template Variables.

However, adding sections to the Top Navigation Bar requires manually editing a Chunks within MODX.

To add a new Admissions Program to the Admissions section, for example, Navigate to Elements, select Chunks, then Navigation, and select the nav_admissions chunk to manually add the page. Be sure to use Resource IDs in place of the URL.

Main Site Hompage and Slider

The main site homepage is comprised of two different templates.

Slider edits can be made through the “2015_home_banners” template. Must go through Files -> Assets -> Templates to find.

The bottom half of the homepage is through the “2019 Home” template. Must go through Elements -> Templates to find.

Two versions of the Carousel image must be uploaded, the desktop and mobile version.

Approved font for Carousel image is Myriad Pro Condensed Black, but Myriad Pro Condensed Bold is an appropriate substitute.

PowerShell Script For Semester Batches

This is a script I’ve developed after relying on CMD for so long and needing to use PowerShell to quickly export file names in large .ZIP files.

Be sure to run as Administrator and make sure your execution policy is not restricted.

You can call the function whatever you like. Export-Csv converts objects into a series of strings. Read more here.

Function GetClassList([string]$path, [string]$outputFile) {
$list = Get-ChildItem $path -Recurse | where {!$_.PSIsContainer}
$list | Select-Object BaseName | Export-Csv $outputFile
}
GetClassList "C:\Users\T\Desktop\fall2018\batch5" "C:\Users\T\Desktop\fall2018\batch5\list1.txt"

First argument is the directory and the second is your file destination.

Trouble Viewing Published Material on MODx?

If you’re making an edit to an existing page that has been unpublished in the past, be sure to take an extra look at the “Hide Template Variables on Output” field.

The field is located under most page templates under Template Variables -> Templates – Default TVs:

It varies, but the field in most page templates can be found at the very bottom of the page:

 

A Template Variable or TV, is simply what MODx calls a custom field found in page creation forms. When this field is set to “Yes” and the page is published, no content will be viewable.

This field is set to “No” by default and should not be a problem when creating new content.

 

 

Upgrading to PHP 7

This guide is for CentOS Linux systems running PHP 5.3 and up.

Start by logging into WHM and making sure the server is on Apache 4. Use EasyApache 4 to upgrade if necessary.

To upgrade PHP 7, SSH into the server and download Remi and EPEL Repository:

$ wget -q http://rpms.remirepo.net/enterprise/remi-release-7.rpm
$ wget -q https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm

Enable the respositories:

# rpm -Uvh remi-release-7.rpm epel-release-latest-7.noarch.rpm
FOR PHP 7.0 EXECUTE:
# yum-config-manager --enable remi-php70
FOR PHP 7.1 EXECUTE:
# yum-config-manager --enable remi-php71

Then upgrade to PHP 7:
# yum update

Events Planning Form Using Javascript

A short questionnaire to direct users to the right form using Javscript
window.onload = function() { document.getElementById('link1').style.display = 'none'; document.getElementById('link2').style.display = 'none'; }; //Clears div box

var x, y, z; //assigns variables to radio selections

function a1(answer1){ x = answer1; };
function a2(answer2){ y = answer2; };
function a3(answer3){ z = answer3; };

//if all answers are no, display link2 and hide link2; if any answers are yes, do the opposite.

function showdiv() { if (x==1 | y==1 | z==1){ document.getElementById('link1').style.display='block'; document.getElementById('link2').style.display='none'; } else { console.log("None of the questions is 1"); document.getElementById('link1').style.display='none'; document.getElementById('link2').style.display='block'; } return; }

//How to structure your HTML to code. Onlick assigns value to x,y,z variables

<input type="radio" onclick="a1(1)" name="q1">Yes
<input type="radio" onclick="a1(0)" name="q1">No

//execute code
<button onclick="showdiv()">What Form Do I Need?</button>

//hide show divs using IDs
<div id="link1">
Link 1
</div>
<div id="link2">
Link 2
</div>