TagCloud for phpwcms [Update v1.9]

Post custom hacks and enhancements for phpwcms here only. Maybe some of these things will be included in official release later.

TagCloud for phpwcms [Update v1.9]

Postby Jensensen » Sat Mar 01, 2008 00:37

Download the newest version 1.9 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!

viewtopic.php?p=101142#p101142
viewtopic.php?p=101848#p101848
viewtopic.php?p=108897#p108897

!!! v1.8 README viewtopic.php?p=114476#p114476
!!! v1.9 README viewtopic.php?p=114714#p114714

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.

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]...

[/OBSOLETE]
Have fun using the newest
You do not have the required permissions to view the files attached to this post.
Last edited by Jensensen on Thu Mar 12, 2009 22:36, edited 36 times in total.
Wenn ich da lese, welche Unternehmen für die Ausarbeitung einer "Marktanalyse" einen "Praktikanten" suchen, wird mir alles klar.
User avatar
Jensensen
 
Posts: 2661
Joined: Tue Oct 17, 2006 19:11
Location: Rhein-Ruhr-Stever-Verse

TagCloud for phpwcms v0.2a

Postby Jensensen » Sat Mar 01, 2008 16:42

--> 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 Mar 04, 2008 17:15, edited 1 time in total.
Wenn ich da lese, welche Unternehmen für die Ausarbeitung einer "Marktanalyse" einen "Praktikanten" suchen, wird mir alles klar.
User avatar
Jensensen
 
Posts: 2661
Joined: Tue Oct 17, 2006 19:11
Location: Rhein-Ruhr-Stever-Verse

Re: TagCloud for phpwcms

Postby DF6IH » Sat Mar 01, 2008 19:35

Hey there ;)

Perhaps some example would lift the clouds in brain... :?
http://www.phpwcms-docu.de/download-dev-versions.phtml --> playing 314
http://jgbm.de/bensheim_2009.phtml Wir haben uns getroffen und die Freude am CMS ist wieder steil gestiegen, Bilder folgen !!
How to code my own Module? -> http://jgbm.de/Module-creation-guide-1.phtml
User avatar
DF6IH
 
Posts: 2804
Joined: Mon Jan 10, 2005 17:10
Location: Weinheim

Re: TagCloud for phpwcms

Postby Jensensen » Sun Mar 02, 2008 00:04

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 Jan 17, 2009 00:10, edited 3 times in total.
Wenn ich da lese, welche Unternehmen für die Ausarbeitung einer "Marktanalyse" einen "Praktikanten" suchen, wird mir alles klar.
User avatar
Jensensen
 
Posts: 2661
Joined: Tue Oct 17, 2006 19:11
Location: Rhein-Ruhr-Stever-Verse

Re: TagCloud for phpwcms

Postby Jensensen » Sun Mar 02, 2008 03:12

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...
Wenn ich da lese, welche Unternehmen für die Ausarbeitung einer "Marktanalyse" einen "Praktikanten" suchen, wird mir alles klar.
User avatar
Jensensen
 
Posts: 2661
Joined: Tue Oct 17, 2006 19:11
Location: Rhein-Ruhr-Stever-Verse

Re: TagCloud for phpwcms

Postby Jensensen » Tue Mar 04, 2008 14:41

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 Sep 19, 2008 18:16, edited 3 times in total.
Wenn ich da lese, welche Unternehmen für die Ausarbeitung einer "Marktanalyse" einen "Praktikanten" suchen, wird mir alles klar.
User avatar
Jensensen
 
Posts: 2661
Joined: Tue Oct 17, 2006 19:11
Location: Rhein-Ruhr-Stever-Verse

Re: TagCloud for phpwcms

Postby DF6IH » Tue Mar 04, 2008 17:43

>Sorry for being not web2.0 compatible .. I didn't even know the meaning of Tag cloud :oops: now I know...
http://www.phpwcms-docu.de/download-dev-versions.phtml --> playing 314
http://jgbm.de/bensheim_2009.phtml Wir haben uns getroffen und die Freude am CMS ist wieder steil gestiegen, Bilder folgen !!
How to code my own Module? -> http://jgbm.de/Module-creation-guide-1.phtml
User avatar
DF6IH
 
Posts: 2804
Joined: Mon Jan 10, 2005 17:10
Location: Weinheim

Re: TagCloud for phpwcms

Postby Jensensen » Tue Mar 04, 2008 17:54

he, he, i just wanted to push phpwcms....
Wenn ich da lese, welche Unternehmen für die Ausarbeitung einer "Marktanalyse" einen "Praktikanten" suchen, wird mir alles klar.
User avatar
Jensensen
 
Posts: 2661
Joined: Tue Oct 17, 2006 19:11
Location: Rhein-Ruhr-Stever-Verse

Re: TagCloud for phpwcms

Postby DF6IH » Tue Mar 04, 2008 17:59

You are right... and this one is good !! Kind of standard in other cms. My fault not knowing these things are called clouds
http://www.phpwcms-docu.de/download-dev-versions.phtml --> playing 314
http://jgbm.de/bensheim_2009.phtml Wir haben uns getroffen und die Freude am CMS ist wieder steil gestiegen, Bilder folgen !!
How to code my own Module? -> http://jgbm.de/Module-creation-guide-1.phtml
User avatar
DF6IH
 
Posts: 2804
Joined: Mon Jan 10, 2005 17:10
Location: Weinheim

Re: TagCloud for phpwcms

Postby Golem » Tue Mar 04, 2008 19:28

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]
Golem
 
Posts: 3
Joined: Sun Mar 02, 2008 11:26

TagCloud v0.3a for phpwcms

Postby Jensensen » Tue Mar 04, 2008 22:47

--> 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]
Wenn ich da lese, welche Unternehmen für die Ausarbeitung einer "Marktanalyse" einen "Praktikanten" suchen, wird mir alles klar.
User avatar
Jensensen
 
Posts: 2661
Joined: Tue Oct 17, 2006 19:11
Location: Rhein-Ruhr-Stever-Verse

Re: TagCloud for phpwcms

Postby marcus@localhorst » Wed Mar 05, 2008 11:06

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.'&amp;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?!
„go out and love everyone“ (Akron/Family)
User avatar
marcus@localhorst
 
Posts: 732
Joined: Fri May 28, 2004 09:31
Location: localhorst

TagCloud v0.4a

Postby Jensensen » Wed Mar 05, 2008 23:20

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 Mar 08, 2008 22:18, edited 1 time in total.
Wenn ich da lese, welche Unternehmen für die Ausarbeitung einer "Marktanalyse" einen "Praktikanten" suchen, wird mir alles klar.
User avatar
Jensensen
 
Posts: 2661
Joined: Tue Oct 17, 2006 19:11
Location: Rhein-Ruhr-Stever-Verse

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

Postby Jensensen » Thu Mar 06, 2008 21:51

--> 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 Mar 08, 2008 22:15, edited 2 times in total.
Wenn ich da lese, welche Unternehmen für die Ausarbeitung einer "Marktanalyse" einen "Praktikanten" suchen, wird mir alles klar.
User avatar
Jensensen
 
Posts: 2661
Joined: Tue Oct 17, 2006 19:11
Location: Rhein-Ruhr-Stever-Verse

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

Postby marcus@localhorst » Fri Mar 07, 2008 10:21

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

cheers
marcus
„go out and love everyone“ (Akron/Family)
User avatar
marcus@localhorst
 
Posts: 732
Joined: Fri May 28, 2004 09:31
Location: localhorst

Next

Return to hacks & enhancements

Who is online

Users browsing this forum: Alexa [Bot] and 0 guests