TagCloud for phpwcms [Update v2.3.1]

Post custom hacks and enhancements for phpwcms here only. Maybe some of these things will be included in official release later.
Post Reply
User avatar
Jensensen
Posts: 3000
Joined: Tue 17. Oct 2006, 21:11
Location: auf der mlauer

TagCloud for phpwcms [Update v2.3.1]

Post by Jensensen »

Download the newest version 2.3.1 below.
The ultimate SEO solution. Unique for easily published tag clouds of --> all NEWS and --> all articles in --> any category --> you want.


There have been many changes in the meantime. Please read this article from start to finish!

http://forum.phpwcms.org/viewtopic.php?p=101142#p101142
http://forum.phpwcms.org/viewtopic.php?p=101848#p101848
http://forum.phpwcms.org/viewtopic.php?p=108897#p108897

!!! v1.8 README http://forum.phpwcms.org/viewtopic.php?p=114476#p114476
!!! v1.9 README http://forum.phpwcms.org/viewtopic.php?p=114714#p114714
!!! v2.3 README http://forum.phpwcms.org/viewtopic.php?p=142592#p142592

please "RTFM" [and comments in source code] :wink:
#################################################
Hi folks, friends, people out here,

here comes my first [public] frontend render script written for phpwcms --> TagCloud

[OBSOLETE]
Well, I read a lot of mysql/php code and manuals to cut and paste useful elements after I got an idea [really hard work for me] what happens there. And after some further adjustments - Boom! - v0.1a was ready to go.
[/OBSOLETE]

How it works:
This script reads and analyzes the content of articles of --> certain site level structures. You can define --> each category by its ID!!!. You can switch on/off further more elements like article title, subtitle, summary, CP HTML, CP Text with image and CP subtitles to match the cloud as well.(with too much cat_ID's it could become a matter of speed, server ram etc. when the page is rendered/parsed out)

After some mathematic operations, counting words etc. there will be a tag cloud in your page, just replacing the RT {TAGCLOUD}. Additionally you can choose to display the occurrence of each tag word and the sorting.

Preparation:
(Please read detailed documentation in the header and the code of the script!)
To get it work [finally] you need a --> Landing Page. This should be a new article anywhere but --> outside the categories to match to cloud! In this article you can/should add e.g. CP HTML (as much as needed) with separate -> anchor tags for each cloud tag which will be linked exactly to its corresponding anchor --> on this landing page. If you don't add a landing page, you will still have the tag cloud but the tags are linked to index.php by default.


Well, it works fine and runs --> exactly [math.] --> without errors but as alpha it has some limitations:

a) you MUST add a landing page by hand
b) you MUST add [after --> fine tuning] the required anchors on the landing page by hand
c) BUT you CAN link all TagCloud links to [any of ] your --> search page [easiest setup]
c) SPEED: the script has to capture THE WHOLE CONTENT of i) public and ii) active articles within the defined categories.
but now saves/recalls {previous=same} results after {just one} first page call [page view] to/from MySQL-QUERY_CACHE
(should work well with MySQL 4.1 and newer]

Tip for --> fine tuning:
1) raise $min
2) add words to $exclude

If you have any idea for optimization, speeding up etc. please go here, PM me or [x] me [x]...


Have fun using the last, that was on dec 21, 2009, a christmas git {hehe}
Have fun using the latest, that was on june 26, 2014.
Have fun using the latest, that was on june 26, 2014.
Have fun using the latest, that was on feb 20, 2024.

Thank you for downloading so many hundreds!
But, now the latest version of TagCloud for phpwcms now is available only on github!

more information and Download:

https://github.com/jensensen/tagcloud-for-phpwcms
Last edited by Jensensen on Wed 21. Feb 2024, 03:12, edited 42 times in total.
{so_much} | Knick-Knack. | GitHub
Umlaute im URL sind meistens immer Kacke.
User avatar
Jensensen
Posts: 3000
Joined: Tue 17. Oct 2006, 21:11
Location: auf der mlauer

TagCloud for phpwcms v0.2a

Post by Jensensen »

--> TagCloud v0.2a is ready

Now you only need to add the RT {TAGCLOUD:0,2,17:9} somewhere in your page code e.g. CP HTML or page template...
Desription:

--> 0,2,17 ==> IDs of Site structure levels / categories to 'cloud'
--> 9 ==> Artikel ID of LANDING PAGE

{TAGCLOUD:LEVEL ID,LEVEL ID:ARTICLE ID}
Last edited by Jensensen on Tue 4. Mar 2008, 18:15, edited 1 time in total.
{so_much} | Knick-Knack. | GitHub
Umlaute im URL sind meistens immer Kacke.
User avatar
juergen
Moderator
Posts: 4556
Joined: Mon 10. Jan 2005, 18:10
Location: Weinheim
Contact:

Re: TagCloud for phpwcms

Post by juergen »

Hey there ;)

Perhaps some example would lift the clouds in brain... :?
User avatar
Jensensen
Posts: 3000
Joined: Tue 17. Oct 2006, 21:11
Location: auf der mlauer

Re: TagCloud for phpwcms

Post by Jensensen »

Hi

guess you are already testing...

well, i tried on [x] [*and it's working as promised*] but due to some kind of SEO --> i avoided --> redundancy and rather used much more [*most*] different expressions as possible [*to be indexed*] :wink:
And because there are not that much articles, the tag cloud finally spreads only into a few [*really relevant*] tags....

Meanwhile have a look at your local LAMPP test run....
and play with:
1) raise/decrease $min
2) add words to $exclude

You can have e.g. a TagCloud for each site level/category with only one or separate/several landing pages. Or you just run the script once [maybe around midnight CET/GMT/UTC...] --> then cut, drag and drop the code --> add hardcoded to --> template...edit CSS... and edit one, or more landing pages that suits...


But you should have [some] many! [the same!] --> meaningful words on your site --> to let the font size grow up and to get a cloudy, varying, fluctuating tag cloud...

Actually I can't add TagCloud for phpwcms to demonstrate on any other sites supported by me but....let's see...
} else { I would have done so.

Guess you are not interested in words like "the","for","vista","and" so on, aren't you?
But you can add this to the --> $exclude list...
Last edited by Jensensen on Sat 17. Jan 2009, 01:10, edited 3 times in total.
{so_much} | Knick-Knack. | GitHub
Umlaute im URL sind meistens immer Kacke.
User avatar
Jensensen
Posts: 3000
Joined: Tue 17. Oct 2006, 21:11
Location: auf der mlauer

Re: TagCloud for phpwcms

Post by Jensensen »

could need some help because neither urlencode(), htmlentities(), htmlspecialchars() OR the phpwcms-built-in html_specialchars() works well to get an (always) correct --> link to landing page. without umlauts and this stuff there's no prob...
{so_much} | Knick-Knack. | GitHub
Umlaute im URL sind meistens immer Kacke.
User avatar
Jensensen
Posts: 3000
Joined: Tue 17. Oct 2006, 21:11
Location: auf der mlauer

Re: TagCloud for phpwcms

Post by Jensensen »

DF6IH wrote:...Perhaps some example would lift the clouds in brain... :?
Here we are:
[x]

You'll find the tag cloud RT finally rendered and placed as the last CP HTML in the left column.

{TAGCLOUD:1,3,12..........:40}

I edited / prepared the Landing page [x] with some anchors for demonstration purposes only. Every cloud tag is linked to the corresponding anchor like ...id=0,40,0,0,1,0#TAG_ANCHOR
So just add --> CP HTML: <a name="TAG_ANCHOR" id="TAG_ANCHOR"></a>...... on the landing page.

Tip for --> fine tuning:
1) raise $min
2) add words to $exclude (will not be counted/analysed then)
3) $del (delete unwanted characters --> ?,.-–! and so on

Tip for --> CSS:
.tagcloud { your:styles; }
.tagcloud a { your:styles; }
.tagcloud a:hover { your:styles; }
.tagcloud a:visited { your:styles; }

.tagcloud span { your:styles; } --> affects $showCount ==> how often the expression was found
--> displayed next to the tag --> (24)
Last edited by Jensensen on Fri 19. Sep 2008, 20:16, edited 3 times in total.
{so_much} | Knick-Knack. | GitHub
Umlaute im URL sind meistens immer Kacke.
User avatar
juergen
Moderator
Posts: 4556
Joined: Mon 10. Jan 2005, 18:10
Location: Weinheim
Contact:

Re: TagCloud for phpwcms

Post by juergen »

>Sorry for being not web2.0 compatible .. I didn't even know the meaning of Tag cloud :oops: now I know...
User avatar
Jensensen
Posts: 3000
Joined: Tue 17. Oct 2006, 21:11
Location: auf der mlauer

Re: TagCloud for phpwcms

Post by Jensensen »

he, he, i just wanted to push phpwcms....
{so_much} | Knick-Knack. | GitHub
Umlaute im URL sind meistens immer Kacke.
User avatar
juergen
Moderator
Posts: 4556
Joined: Mon 10. Jan 2005, 18:10
Location: Weinheim
Contact:

Re: TagCloud for phpwcms

Post by juergen »

You are right... and this one is good !! Kind of standard in other cms. My fault not knowing these things are called clouds
Golem
Posts: 3
Joined: Sun 2. Mar 2008, 12:26

Re: TagCloud for phpwcms

Post by Golem »

DF6IH wrote:>Sorry for being not web2.0 compatible .. I didn't even know the meaning of Tag cloud :oops:...
You are not alone... :oops: :oops: :oops:


[EDIT]

:oops: :oops: :oops: :oops: :oops: :oops: :oops: :oops:
My wife was logged in with my computer but I havn't noticed that.

Heiko H.
:oops: :oops: :oops: :oops: :oops: :oops: :oops: :oops:
[/EDIT]
User avatar
Jensensen
Posts: 3000
Joined: Tue 17. Oct 2006, 21:11
Location: auf der mlauer

TagCloud v0.3a for phpwcms

Post by Jensensen »

--> TagCloud v0.3a is ready

contains some itsy-bitsy changes and:

--> now serves valid XHTML output!
--> encoded as UTF-8 (no BOM) with Unix LF

but still struggles with 'html_specialchars'... [please help]
{so_much} | Knick-Knack. | GitHub
Umlaute im URL sind meistens immer Kacke.
User avatar
marcus@localhorst
Posts: 815
Joined: Fri 28. May 2004, 11:31
Location: localhorst
Contact:

Re: TagCloud for phpwcms

Post by marcus@localhorst »

Hi since a hour I do a (not anymore) quick test :-)
here are some thoughs

1. exclude word list: it's annoying to write down 90% of all excluding words that appear in the texts:-)
I've take a quick search and came up with a tagcloud script, which contains a large file of common used english words to exclude:
( http://chir.ag/tech/download/tagline/ download the zip and take a look to the file "ignore-large.php )
didn't find that for german yet :-/

2. i was too lazy to setup the landing page (because i didn't read your post fully 8) ) and i think it would be a better idea, to combine that script with the phpwcms search?! mmh?
so i just change this line in your code:

Code: Select all

$tag_cloud .= '<a style="font-size:'.round(max($font_size,$min_size),2).'%;" href="'.PHPWCMS_URL.$landing.'&searchwords='.html_specialchars($key).'">'.$key.'</a>';
and set the RT to my searchpage, and - voila!
test my cloud here on bottom page: http://www.fieldmuzick.net/ 8)

3. specialchars ... i have no idea and the moment, but a solution will be found :-)

so thanks Jensensen for your work - really good work!
I'm looking forward to a further improved version, and I'm sure it will come, because you want to learn php, right? :-) And learning by doing is the best way.
best wishes
marcus

ps: at the moment i didn't undestand your landing page example - but i still not read your post fully :mrgreen: sorry if i missunderstand something :-)
edit: for that specialchars stuff and similar (strip RTs or so) you could take a look to phpwcms search logic, it's similar i think?!
User avatar
Jensensen
Posts: 3000
Joined: Tue 17. Oct 2006, 21:11
Location: auf der mlauer

TagCloud v0.4a

Post by Jensensen »

Hi marcus,
thank you for your quick adoption and your proposals!

marcus@localhorst wrote:...here are some thoughs

1. exclude word list: it's annoying to write down 90% of all excluding words that appear in the texts:-)...
Yes, you are right. That's why I'm searching for other algorithms to include...

marcus@localhorst wrote:...and take a look to the file "ignore-large.php"...
Well, this file contains many expressions as well...


It's not easy for me to improve the development status
but as you already mentioned "learning by doing is the best way".

marcus@localhorst wrote:...2. [] to combine that script with the phpwcms search?!...
Yeah man, excellent! This is the easiest way to get it run because you do NOT need to set up a separate landing page and add the anchors manually!

marcus@localhorst wrote:...for that specialchars stuff and similar (strip RTs or so) you could take a look to phpwcms search logic, it's similar i think?!
Yep, thank you again, will do...


--> TagCloud v0.4a
So, I acted on your suggestion and in a frist step I added optional landing pages:

Use parameters
L ==> LANDING PAGE (separate page outside categories) OR
S ==> for phpwcms SEARCH PAGE

{TAGCLOUD:1,3,12........:L:40}
40 = Article ID of "Landing page"

or

{TAGCLOUD:1,3,12........:S:127}
127 = Article ID of "SEARCH page"

1,3,12... ==> IDs of Site structure levels / categories in all the articles reside you want to match/analyse the cloud (to build the cloud of)
Last edited by Jensensen on Sat 8. Mar 2008, 23:18, edited 1 time in total.
{so_much} | Knick-Knack. | GitHub
Umlaute im URL sind meistens immer Kacke.
User avatar
Jensensen
Posts: 3000
Joined: Tue 17. Oct 2006, 21:11
Location: auf der mlauer

TagCloud for phpwcms v0.5a (works with UTF and ISO latin)!

Post by Jensensen »

--> TagCloud v0.5a

now works well with UTF-8 or ISO latin encoded web sites! I could realise some improvements regarding speed, too. So, this release is the fastest so far....

Use parameters
L ==> LANDING PAGE (separate page outside categories) OR
S ==> for phpwcms SEARCH PAGE

{TAGCLOUD:1,3,12........:L:40}
40 = Article ID of "Landing page"

or

{TAGCLOUD:1,3,12........:S:127}
127 = Article ID of "SEARCH page"

1,3,12... ==> IDs of Site structure levels / categories in which all the articles reside that you want to match/analyse the cloud (to build the cloud of)
Last edited by Jensensen on Sat 8. Mar 2008, 23:15, edited 2 times in total.
{so_much} | Knick-Knack. | GitHub
Umlaute im URL sind meistens immer Kacke.
User avatar
marcus@localhorst
Posts: 815
Joined: Fri 28. May 2004, 11:31
Location: localhorst
Contact:

Re: TagCloud for phpwcms v0.5a (works with UTF and ISO latin)!

Post by marcus@localhorst »

congratualtions!
was it just the use of this function html_specialchars($key) to get encoding done?
i just take a quick look.

cheers
marcus
Post Reply