Forcing field value to render as UPPERCASE

12 posts by 3 authors in: Forums > CMS Builder
Last Post: February 15, 2010   (RSS)

By gkornbluth - January 30, 2010

Hi all,

I’d like to convert all the characters in a field called "title" to UPPER CASE and then echo the UPPERCASE version.

I found strtoupper but can’t seem to implement it correctly.

Any insights?

Thanks,

Jerry Kornbluth
The first CMS Builder reference book is now available on-line!







Take advantage of a free 3 month trial subscription, only for CMSB users, at: http://www.thecmsbcookbook.com/trial.php

Re: [gkornbluth] Forcing field value to render as UPPERCASE

By Damon - January 30, 2010

What about using CSS?

text-transform: uppercase;
Cheers,
Damon Edis - interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/

Re: [Damon] Forcing field value to render as UPPERCASE

By gkornbluth - January 30, 2010 - edited: January 30, 2010

Hi damon,

Didn't know that even existed.

I'm trying to force the UPPERCASE in both a viewer and in an RSS feed.

What would the syntax be for using this in the style sheet/viewer and for the RSS XML.

Is there a reason why I wouldn't want to use strtoupper

Thanks,

Jerry Kornbluth
The first CMS Builder reference book is now available on-line!







Take advantage of a free 3 month trial subscription, only for CMSB users, at: http://www.thecmsbcookbook.com/trial.php

Re: [gkornbluth] Forcing field value to render as UPPERCASE

By Damon - February 1, 2010

Hi,

As far as I'm aware, the styling for RSS feeds is done in the readers, either web or pc/mac based, not in the actually XML.

For an RSS feed, you are better off using the strtoupper function:

<?php
echo strtoupper("Hello WORLD!");
?>

Output:

HELLO WORLD!
Cheers,
Damon Edis - interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/

Re: [Damon] Forcing field value to render as UPPERCASE

By gkornbluth - February 1, 2010

Damon,

I appreciate the feedback.

Since the original code in the rss feed was

<title><?php echo htmlspecialchars($record['title']) ?></title>

I haven't been able to figure out the correct syntax for incorporating "strtoupper" into that line of code.

Thanks,

Jerry
The first CMS Builder reference book is now available on-line!







Take advantage of a free 3 month trial subscription, only for CMSB users, at: http://www.thecmsbcookbook.com/trial.php

Re: [gkornbluth] Forcing field value to render as UPPERCASE

By Damon - February 1, 2010

How about this:

<?php $title = htmlspecialchars($record['title']; ?>
<title><?php echo strtoupper($title); ?></title>


I haven't tested this out but it looks good to me.
Cheers,
Damon Edis - interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/

Re: [gkornbluth] Forcing field value to render as UPPERCASE

By Damon - February 1, 2010

Sorry, I missed a closing bracket:

<?php $title = htmlspecialchars($record['title']); ?>
<title><?php echo strtoupper($title); ?></title>

I tested this out and it works. Next time, I will write my code in Komodo Edit and it will underline any syntax errors and save me lots of head scratching. :)
Cheers,
Damon Edis - interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/

Re: [Damon] Forcing field value to render as UPPERCASE

By gkornbluth - February 1, 2010

Sorry. I didn't catch it either.

As they say on the other side of the pond...

It works a treat!

Komodo Edit looks interesting. Thanks for that too.

Best,

Jerry
The first CMS Builder reference book is now available on-line!







Take advantage of a free 3 month trial subscription, only for CMSB users, at: http://www.thecmsbcookbook.com/trial.php

Re: [Damon] Forcing field value to render as UPPERCASE

By gkornbluth - February 13, 2010

Hi Damon,

Thanks for the implementation tips. I've been using it a lot.

One question...

If I wanted to implement strtoupper in a date to force any text characters into upper case, what syntax would I use?

Here's what I have now.

<?php echo date("D, M jS, Y", strtotime($e_blastRecord['press_release_publish_date'])) ?>

Thanks,

Jerry
The first CMS Builder reference book is now available on-line!







Take advantage of a free 3 month trial subscription, only for CMSB users, at: http://www.thecmsbcookbook.com/trial.php