WCAG 2.0 Compliance Suggestion

8 posts by 2 authors in: Forums > CMS Builder
Last Post: November 17, 2011   (RSS)

By InHouse - November 15, 2011

While adjusting a few sites to meet WCAG 2.0 compliance standards I've come up with a suggestion for CMSB.

Would it be possible to scrub _link strings clean of all punctuation? I think it already does a bit but leaves in question marks and exclamation points - both of which trip validation issues.

Furthermore, if the automatic _link values where scrubbed of these, would it be possible to expose a built-in function which would do the same to any string fed into it? In our case, the _link value isn't always what we want so we build a custom URL string, frequently using the article 'title' or 'headline' in the URL for SEO purposes. It would be nice if we could have a standard 'url-sting-cleanup' function which acts the same way as the _link automation does.

Cheers,
Jayme

Re: [InHouse] WCAG 2.0 Compliance Suggestion

By Dave - November 15, 2011

Hi Jayme,

Thanks for feedback.

You can control which fields are used in _link urls under:
Admin > Section Editors > Viewer URLs > Filename fields

And the default plugin "Remove Viewer Link Accents" provides a good example of how to modify _link values:
cmsAdmin/plugins/removeViewerLinkAccents.php

Beyond that, if there's a default change we could make to how links are constructed that would make them WCAG 2.0 compliant I could do that for the next version. Just let me know what the input is, current output is, and what the desired output should be.

Hope that helps! :)
Dave Edis - Senior Developer

interactivetools.com

Re: [Dave] WCAG 2.0 Compliance Suggestion

By InHouse - November 15, 2011

It's almost there now Dave. An article numbere 30 and titled "Get ready for winter! Do you know how, or why?" should reduce to a url like:
page.php?get ready for winter do you know how or why-30

Automating the _link is a good step. But being able to match it when manually creating links would keep the URLs consistent throughout the site. That consistency is a bonus for those clients who need to manage their Google Analytics accounts.

J.

Re: [InHouse] WCAG 2.0 Compliance Suggestion

By Dave - November 15, 2011

Hi Jayme,

Ok, I'm trying to re-create the scenario. I created a test record with this title:
"Get ready for winter! Do you know how, or why?!"

That generated a link like this:
listingsDetail.php?Get-ready-for-winter-Do-you-know-how-or-why-6

It looks like it already strips out ? and !. Am I looking at the right thing?

One thing you can do is create a field for "searchUrlText" and then set (Admin > Section Editors > Viewer URLs > Filename fields) to "searchUrlText, title" and then it will use the first field that isn't blank. This allows you to control through the CMS what is shown in the link.

Otherwise, let me know some more details on how you'd like it to work and I'll try and help.
Dave Edis - Senior Developer

interactivetools.com

Re: [Dave] WCAG 2.0 Compliance Suggestion

By InHouse - November 17, 2011

That's a very good and useful suggestion Dave. Thanks for that!

I guess what I'd like to do for my retrofit sites is to have a function that processes the title field contents (or another string) to mimic the way that the native URL handler does.

We often can't use the _link as we need to adjust the href value in some way for some purpose. These might be for certain kinds of Analytics tracking, or maybe we just have several tables of data consolidated into one viewer and we need to send users to different landing pages depending on the link they are clicking on. In those cases, we build our our link href to be like:

href=destinationPage1.php?ArbitrarySectionNameOrID-ArticleTitle(fromRecord)-RecordNum

If would be nice to use pre-built tools to format ArticleTitle(fromRecord) so that the behaviour is consistent with the anchors which do use _link.

Cheers,
Jayme

Re: [InHouse] WCAG 2.0 Compliance Suggestion

By Dave - November 17, 2011

Hi Jayme,

There's an undocumented function in viewer-functions.php which we use for that purpose. It's called getFilenameFieldValue(). It's meant to be passed a $record and list of fields, but you can call it directly like this:

$string = 'Hello World! How are "you" doing today?';
$_link = getFilenameFieldValue(array('input' => $string), 'input');
$_link = "article-" .$_link. "123";

showme($string); // outputs: Hello World! How are "you" doing today?
showme($_link); // outputs: article-Hello-World-How-are-you-doing-today-123


Would that do what you need? Or are we getting closer? :) If that works for you we could make a wrapper function for it so it's even easier to call, such as createCustomLink($prefix, $title, $recordNum);
Dave Edis - Senior Developer

interactivetools.com

Re: [InHouse] WCAG 2.0 Compliance Suggestion

By Dave - November 17, 2011

Sure, how about something like this:

//
function createCustomLink($prefix, $title, $recordNum) {
$_link = getFilenameFieldValue(array('input' => $title), 'input');
return $prefix . $_link . $recordNum;
}

$_link = createCustomLink('article-', 'Hello World! How are "you" doing today?', 123);
print $_link; // prints article-Hello-World-How-are-you-doing-today-123


Let me know how that works for you.
Dave Edis - Senior Developer

interactivetools.com