Jump to content
TNG Community
fish007

tagcloud surnames

Recommended Posts

fish007

Is it possible to put a togcloud of the surnames on the firstpage of the site?

regards,

Share this post


Link to post
Share on other sites
ojay

IMHO only with Zirkula.

Surname-tagcloud see http://code.zikula.org/tngz

I want only the tagcloud too, but the work will be too much. :cry:

Is it possible to put a togcloud of the surnames on the firstpage of the site?

regards,

Share this post


Link to post
Share on other sites
Steven

I've created a quick and dirty tag cloud, which can be seen on my site at

http://www.stevenwillingale.com/tng

The file is attached. Just upload tc.php to your tng folder then put an include in the file where you want the tag cloud to display, i.e. add the following line to your index.php file:


<?php include('tc.php'); ?>

EDIT:

In light of bugs found, amended hopefully bug free file now in post below:

Share this post


Link to post
Share on other sites
theKiwi

I've created a quick and dirty tag cloud, which can be seen on my site at

http://www.stevenwillingale.com/tng

The file is attached. Just upload tc.php to your tng folder then put an include in the file where you want the tag cloud to display, i.e. add the following line to your index.php file:


<?php include('tc.php'); ?>
Something is amiss in the code somewhere... http://testing.lisaandroger.com/index.php is just printing out some of the code to the page, rather than the results? The error log shows
[Wed Mar 17 18:41:01 2010] [error] [client 66.93.200.62] PHP Fatal error:  Call to undefined function get_tag_cloud() in /Library/WebServer/Documents/TestingTNG/tc.php on line 82, referer: http://testing.lisaandroger.com/
OK- the problem is the opening php tag at least on my server needs to be
<?php
not
<?

Roger

Share this post


Link to post
Share on other sites
ojay

Something is amiss in the code somewhere...

On my site works the surname-cloud.

I have only changed the path of the search-URL (delete "/tng")

"tag_cloud" href="/search.php?mylastname='

Thanks Steven!

Share this post


Link to post
Share on other sites
theKiwi

Another suggested change...

Line 50 should be

        . '&amp;lnqualify=equals" title="\'' . $tag  . '\' returned a count of ' . $count . '">' 

so that the search is for Last Name Equals. Otherwise it will find occurrences of a last name in other last names - for example

Moffat

appears in the Tag Cloud, but clicking it would give a list of names that also included

Moffatt

Roger

Share this post


Link to post
Share on other sites
Brett

In light of Roger's post below, I've amended the attached file

Ok, downloaded new file. Placed it in root folder, where TNG lives. Made change at line 49. Lines 19 & 20 unchanged.

The following is displayed, even if only loading tc.php:

Popular surnames

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/vbk/public_html/relativelyknown/tc.php on line 62

Warning: ksort() expects parameter 1 to be array, null given in /home/vbk/public_html/relativelyknown/tc.php on line 66

Warning: array_values() [function.array-values]: The argument should be an array in /home/vbk/public_html/relativelyknown/tc.php on line 33

Warning: Wrong parameter count for max() in /home/vbk/public_html/relativelyknown/tc.php on line 33

Warning: array_values() [function.array-values]: The argument should be an array in /home/vbk/public_html/relativelyknown/tc.php on line 34

Warning: Wrong parameter count for min() in /home/vbk/public_html/relativelyknown/tc.php on line 34

Warning: Invalid argument supplied for foreach() in /home/vbk/public_html/relativelyknown/tc.php on line 42

Is having the site 'closed' to non logged in the reason?

Share this post


Link to post
Share on other sites
Steven

A slight variation on the previous file, this one randomises the tag cloud, rather than have the names in alpha order.

One other thing is the heading on line 79 probably needs to be changed to a variable and moved to cust_text.php so the tag cloud is multi-lingual. Will try and do this later if have time.

EDIT: Updated file now in post below :)

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/vbk/public_html/relativelyknown/tc.php on line 62

This seems to indicate it does not like the SQL statement (line 61), i dont think having the site closed is the reason as the SQL statement bypasses any filtering, unless calling config or genlib at the start of the file imposses something I'm not aware of.

Not sure why its falling over when others seem to be able to use the file OK

Share this post


Link to post
Share on other sites
Brett

Not sure why its falling over when others seem to be able to use the file OK

Tried it on 3 domains already running, 1 domain freshly installed just for it, and all fall over at the same error. They are all on the same shared server though, so will try on different host tommorrow. :(

Share this post


Link to post
Share on other sites
theKiwi

Did you change the first line to be

<?php
I needed to make that change on my server as it was set to NOT use short opening tags. Note that the download just above called tc1.php uses
<?PHP

which I think isn't strictly correct either.

Roger

Share this post


Link to post
Share on other sites
Brett

Did you change the first line to be

<?php
I needed to make that change on my server as it was set to NOT use short opening tags.
<?PHP

which I think isn't strictly correct either.

Thanks Roger, I had changed it to ?php each time.

Share this post


Link to post
Share on other sites
Steven

This post contains both files with all changes suggested so far, still need to change the file for multi-lingual use though.

tc.php - shows cloud in alpha order

tc1.php - shows cloud in random order.

Steven

tc.php

tc1.php

Share this post


Link to post
Share on other sites
thewillistree

This post contains both files with all changes suggested so far, still need to change the file for multi-lingual use though.

tc.php - shows cloud in alpha order

tc1.php - shows cloud in random order.

Steven

I've now added the tag cloud to my home page and it looks fine, and the size of the surnames seems to be in proportion to their volume on the site. HOWEVER, when I compare the figures shown in the 'hover' text with the figures in the Surname List they are not the same. For example, on the tag cloud 'KINGSNORTH' returned a count of 125, but in the Surname List a total of 87 is shown.

Any reason why this should be?

Share this post


Link to post
Share on other sites
ojay

For example, on the tag cloud 'KINGSNORTH' returned a count of 125, but in the Surname List a total of 87 is shown.

Any reason why this should be?

Do you have more than one familytree in TNG?

It counts all the names in the FamilyTrees together.

Share this post


Link to post
Share on other sites
theKiwi

I've now added the tag cloud to my home page and it looks fine, and the size of the surnames seems to be in proportion to their volume on the site. HOWEVER, when I compare the figures shown in the 'hover' text with the figures in the Surname List they are not the same. For example, on the tag cloud 'KINGSNORTH' returned a count of 125, but in the Surname List a total of 87 is shown.

Any reason why this should be?

The difference is likely because the tag could is counting everyone - including Living, whereas the Surname page doesn't count Living if you're not logged in.

Try logging in to your site and then compare the numbers.

Roger

Share this post


Link to post
Share on other sites
Chuchon

Hello,

would it be possible to exclude some names in the tag cloud.

For example, I use to write NN (Not Named) as name for unknown people and I don't want this NN (there are a lot) appearing in the tag cloud.

Thanks for any help,

Christian

Share this post


Link to post
Share on other sites
theKiwi

Hello,

would it be possible to exclude some names in the tag cloud.

For example, I use to write NN (Not Named) as name for unknown people and I don't want this NN (there are a lot) appearing in the tag cloud.

Thanks for any help,

Christian

Change the query line along these lines

  $result = mysql_query("SELECT lastname, count( lastname ) as mycount FROM `tng_people` WHERE lastname != \"\" AND lastname != \"[--?--]\" GROUP BY lastname ORDER BY count( lastname ) DESC LIMIT 0 , 50"); 

and you could replace the [--?--] with your NN to exclude them.

Roger

Share this post


Link to post
Share on other sites
Chuchon

Change the query line along these lines

  $result = mysql_query("SELECT lastname, count( lastname ) as mycount FROM `tng_people` WHERE lastname != \"\" AND lastname != \"[--?--]\" GROUP BY lastname ORDER BY count( lastname ) DESC LIMIT 0 , 50"); 
and you could replace the [--?--] with your NN to exclude them. Roger
Thanks a lot Roger, I added a part of your code to the line I have in tc1.php to have this line :
 $result = mysql_query("SELECT * FROM ( SELECT lastname, count( lastname ) AS mycount FROM `tng_people` WHERE lastname != \"\" AND lastname != \"NN\" GROUP BY lastname ORDER BY count( lastname ) DESC LIMIT 0 , 20) AS presort order by rand()"); 

Exactly what I wanted :-D

Have a nice evening (or whatever, it's the evening in France)

Christian

Share this post


Link to post
Share on other sites
Jay Wilpolt

Change the query line along these lines

  $result = mysql_query("SELECT lastname, count( lastname ) as mycount FROM `tng_people` WHERE lastname != \"\" AND lastname != \"[--?--]\" GROUP BY lastname ORDER BY count( lastname ) DESC LIMIT 0 , 50"); 

and you could replace the [--?--] with your NN to exclude them.

Roger

Roger,

what would be a quick set of directions to use this tag cloud on a page?

do you just add <? php include tc.php ; ?> and it shows up??

Thanks in advance for any help

Jay

Nevermind

OH, I now see the install notes at the beginning of the file.

But there does appear to be an extra </div> at the end of each file.

Share this post


Link to post
Share on other sites
Chuchon

Roger,

what would be a quick set of directions to use this tag cloud on a page?

do you just add <? php include tc.php ; ?> and it shows up??

Thanks in advance for any help

Jay

Nevermind

OH, I now see the install notes at the beginning of the file.

But there does appear to be an extra </div> at the end of each file.

Hello Jay,

I use template 8 and here are the lines I added at the end of the latest news (between </div> and </td>


<br/>
        <div class="latest_news">
<?php include('tc1.php'); ?>
      </div>

You can view my new website to see the result.

I also moved the div class from tc1.php to mytngstyle.php (in template 8) to make some changes.

Christian

Share this post


Link to post
Share on other sites
cogden

This post contains both files with all changes suggested so far, still need to change the file for multi-lingual use though.

tc.php - shows cloud in alpha order

tc1.php - shows cloud in random order.

Steven

Thanks for sharing Steven!

Share this post


Link to post
Share on other sites
FredB

Great item..loving it. Ran ok on my site for about a week....then I started getting the same errors listed in POST #7 above. Intermittent..so I will try again tomorrow.

http://tree.fredberardi.com

EDIT:1/11/12- Opened site this AM and it is functioning again. No real explanation as to WHY. I tried it last night in different browsers and with cache cleared, but couldn't get it to restart.???? This functioning correctly lasted about an hour..and now I get the errors on the site again!!!

Share this post


Link to post
Share on other sites
FredB

This was found to be a server related issue, having to do with memory.

Once the server errors were corrected, the errors went away.

Thanks again for a great piece of code!!!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×