Alphabetical sorting tags

5 posts by 2 authors in: Forums > CMS Builder
Last Post: October 17, 2013   (RSS)

By ross - October 10, 2013

Hi there.

Thanks for posting!

To get your textfield of comma separated valuies, you can use the PHP's sort function like this:

<?php sort($tagList); ?>

You can review this function in the main PHP documentation here:

http://php.net/manual/en/function.sort.php

Give that a shot and let me know how you make out. Thanks!

-----------------------------------------------------------
Cheers,
Ross Fairbairn - Consulting
consulting@interactivetools.com

Hire me! Save time by getting our experts to help with your project.
Template changes, advanced features, full integration, whatever you
need. Whether you need one hour or fifty, get it done fast with
Priority Consulting: http://www.interactivetools.com/consulting/

By videopixel - October 10, 2013

Thanks Ross,

And where do I put that code?

By videopixel - October 14, 2013

Ok I found it... for some reason the code did not remove spaces in my keywords that's why it didn't sort...

<?php $tagList = split(',', $blogRecord['tags']); ?><?php sort($tagList); ?>
<?php foreach ($tagList as $tagLink): ?>
<div class="tags"><a href="/blog.php?tags_keyword=<?php echo urlencode(trim($tagLink)); ?>">
<?php echo $tagLink ?></a></div>
<?php endforeach ?>

By ross - October 17, 2013

Hi videopixel

Thanks for the heads up! Glad you got it working :)

-----------------------------------------------------------
Cheers,
Ross Fairbairn - Consulting
consulting@interactivetools.com

Hire me! Save time by getting our experts to help with your project.
Template changes, advanced features, full integration, whatever you
need. Whether you need one hour or fifty, get it done fast with
Priority Consulting: http://www.interactivetools.com/consulting/