tags?

19 posts by 4 authors in: Forums > CMS Builder
Last Post: June 1, 2009   (RSS)

By ross - May 25, 2009

Hi Tim

There's probably going to be a way to do just about anything you want :). PHP and CMS Builder are both very flexible so I am sure there are options for you.

If you make that one array that has every single tag in it (duplicates and all), you can use the PHP function to pull out all the unique values to display a list of all the tag options. With that unique list, you can then do some more searching in the big list to see how many times each unique item appears in the whole list to get an idea of the most popular tags

This does start getting a bit advanced but it's still possible. If you wanted, this could be something we look at through consulting for you.

How comfortable are you working with PHP?

Let me know what you think and we'll go from there. 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/

Re: [ross] tags?

By Toledoh - May 25, 2009

Hi Ross,

Bring it on! As before, I'd rather learn the ins and outs than have it done for me.

Cheers,
Cheers,

Tim (toledoh.com.au)

By ross - May 27, 2009

Hi Tim

Sounds good. Could you post a copy of your test page so I can see all the code you are using? If you wouldn't mind attaching the file instead of just pasting code, that will make it much easier to work with.

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/

Re: [ross] tags?

By Toledoh - May 29, 2009 - edited: May 29, 2009

Hi Ross,

File attached - however it's pretty convoluted, maybe we should just use a simple demo page that hasn't got my styles and js links?

Cheers,
Tim
Cheers,

Tim (toledoh.com.au)
Attachments:

posts.php 3K

By willbegood - May 31, 2009

Hello Toledoh, i have done exactly the same thing... perhaps i can help.
contact me on moolood@gmail.com [;)]

By ross - June 1, 2009

Hi there.

I'll work on some code for you this afternoon. I might need until tomorrow to test it all out. I also like the idea of going with a simple version to get a feel for it. I like having a copy of your whole page though just so I can see what variable names you have :).

If willbegood beats me to the punch, let me know.

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 Dave - June 1, 2009

Hi Toledoh,

Using another table is a great approach (application design wise) but would require a lot of custom code. If you're not going to have too many records then you can just loop over them all and get a list of all tags and the counts like this:

<?php

// example: use getRecords() to load all records from your section
$records[] = array('tags' => 'one,two, three');
$records[] = array('tags' => 'three,four, five');

// loop over all records and get tag counts
$allTags = array();
foreach ($records as $record) {
$tags = explode(',', $record['tags']);
foreach ($tags as &$tag) {
$tag = trim($tag); // remove leading/trailing whitespace
$tag = strtolower($tag); // lowercase
@$allTags[$tag]++;
}
}

// show contents of $allTags
print "<xmp>";
print_r($allTags);
print "</xmp>";


This is getting pretty advanced PHP wise, so we can't offer too much support on it, but hopefully this will point you in the right direction.

Hope that helps! Let me know if you have any other questions about this.
Dave Edis - Senior Developer
interactivetools.com

Re: [Dave] tags?

By Toledoh - June 1, 2009

Hi Dave / Ross,

Thanks a bunch! Yet again you've come through for me! A bit of further reading (I've never done any php before...) and I'm done.

In summary, what we have here is;

1. Within a Article, the editor has the ability to type in key words, or "tags"... whatever they think is appropriate.

2. These Articles are then displayed in a grid format, usinging <li> and CSS.

3. Each <li> then has the "tags" applied as classes.

4. From the code in this thread, I'm now displaying all "tags" from all "articles", they are collated into like tags, and counted, then sorted in order or most popular (highest count). CSS and <li> forms the navigation.

5. Some jQuery magic then uses the navigation to filter the Article <li>'s via the "Tag" classes... and displays the filtered Articles List.

http://www.murraysbrewingco.com.au/web09/posts2.php

Thanks again!
Cheers,

Tim (toledoh.com.au)