Jump to content
TNG Community

Anniversaries, Surnames widgets


MVB

Recommended Posts

Hi,

The last couple of days I have been trying out some of the code shared by "Roger's Ramblings" on his website http://lisaandroger.com/downloads/ introducing these enhancements to be displayed in Wordpress widgets.

There have been some topics about them on this forum.

So far I have only been able to make the "Surnames Top 10" widget work on my website.

When I try to add more (on separate widgets or even within the same widget) I get a TNG database error.

The code used by Surnames Top 10;

<?php
global $wp_tng_path, $link;
$path = get_option('mbtng_path');
chdir ($path);
$wp_tng_path = get_option('mbtng_url');
include ("surnames-top10.php");
mbtng_close_tng_table ();
?>

This code works perfectly fine,  however the code is almost identical to for example the "List Anniversaries" widget, still only "Surnames Top 10" will display on my website.

The other one will result in a TNG database error.

When I add two copies of "Surnames Top 10" on the website, I also get the same database error.

 

The database error is:

Error: TNG is not communicating with your database. Please check your database settings and try again. Settings can be found under Admin/Setup/General Settings/Database, or at the top of your config.php file.

 

Is there anyone who has an idea in what the problem could be? I have tried to find out if my database doesnt allow multiple connections (I am only a beginner, so have no knowledge on this), but could not find any such setting in MySql environment.

Many thanks in advance.

 

Link to comment
Share on other sites

  • Replies 53
  • Created
  • Last Reply

Top Posters In This Topic

  • theKiwi

    19

  • cfj

    11

  • fluffy82

    9

  • PapaTango

    7

Top Posters In This Topic

Posted Images

The included Read Me file details how to include multiple files into a single widget so that it works.

This is what is in an Enhanced Text Widget on my site that works as you can see here http://LisaAndRoger.com/ in the right sidebar (or the right sidebar of the Downloads page etc

 

<?php
global $wp_tng_path, $link;
$path = get_option('mbtng_path');
chdir ($path);
$wp_tng_path = get_option('mbtng_url');
include ("userscripts/list_birthdays.php");
mbtng_close_tng_table ();
echo "<br />";
include ("userscripts/list_anniversaries.php");
mbtng_close_tng_table ();
echo "<br />";
include ("userscripts/list_deaths.php");
mbtng_close_tng_table ();
echo "<br/>";
echo "<span class=\"normal\" align=\"center\">Surnames</span>";
include ("userscripts/surnamesTagCloud.php");
mbtng_close_tng_table ();
?>

Roger

Link to comment
Share on other sites

Thanks for your reply, however on my website it doesnt work.

For some reason the only one that works is the Surnames Top 10. Perhaps a conflict with my Wordpress theme.

If you have the time I would be happy to pm you the login details of my WP dashboard so you perhaps could take a look and possibly solve it.

 

thanks

Link to comment
Share on other sites

6 hours ago, MVB said:

Thanks for your reply, however on my website it doesnt work.

For some reason the only one that works is the Surnames Top 10. Perhaps a conflict with my Wordpress theme.

If you have the time I would be happy to pm you the login details of my WP dashboard so you perhaps could take a look and possibly solve it.

Do you have the latest version of all of the other files?

Do the other ones work if you make them the first, or only one in the Widget?

Have you tried switching to another theme to see if that changes anything?

Roger

Link to comment
Share on other sites

  • 5 months later...

I have the same problem, but the other way around...

The "List anniversaries" works fine, I have one for births and one for deaths in my sidebar. But when I put the "10 Surnames", I get the same message as you: can't connect with the TNG database...

I hope someone can find a solution, my coding skills are inexistant lol (I know how to modify simple things like a css-sheet or column width, and follow instructions, but that's about it).

Tom

Link to comment
Share on other sites

Hi Roger,

I do have the latest files.

I tried two ways: first with the "pre-made" widgets available on https://www.uniquelyyourshosting.net/wordpress-tng-plugins/ and also with the php files downloaded from your website, used through the Enhanced Text widget. The Top10 Surnames always gives "not communicating with database". I did check the path, the php's were saved in my tng folder and I made sure the code made reference to that, rather than "userscripts".

Tom

Link to comment
Share on other sites

Tom

I've taken another look at the scripts and can't see what the problem might be for sure - they all work - including surnamesTagCloud and surnames-top10 on my site as you can see if you look down the sidebar here

http://LisaAndRoger.com/

The only difference I can think of right now is that there is some path problem due to them not being in "userscripts" folder - can you try putting them into a folder called userscripts and then change that in the Enhanced Text Widget to call them from that folder?

Also - try changing the order of them to see if it's always surnames-top10 that fails, or is it for example the last one that fails or the 2nd last one etc.

If you only use surnames-top10 does it work by itself?

Otherwise, if you want to send an eMail to rogerkiwi@aol.com with details of how to log in to your site by 

FTP - username and password

WordPress Admin - username and password

And I'll take a look to see if I can figure out why it's not working.

Roger

Link to comment
Share on other sites

On 3.10.2017 at 1:05 PM, MVB said:

Error: TNG is not communicating with your database. Please check your database settings and try again. Settings can be found under Admin/Setup/General Settings/Database, or at the top of your config.php file.

I have the same issue with all of this files: list_deaths.php, list_anniversaries, list_deaths.php

I have been able to use the widget, but have to change the widget tng-list-events. Line 349 changed from begin-wp.php to begin.php, since I don't have begin-wp in my tng folder.

I alson have trouble with UTF-8 characters. The Scandinavian letters 'Æ', 'Ø' and 'Å gives me diamond with a question mark.�, when I use list events on my wp site.

Link to comment
Share on other sites

3 minutes ago, cfj said:

I have been able to use the widget, but have to change the widget tng-list-events. Line 349 changed from begin-wp.php to begin.php, since I don't have begin-wp in my tng folder.

 

That's a whole separate issue - @HeatherFeuer created those widgets, or publishes them for someone else that created them.

The extended characters issue also needs to be addressed by @HeatherFeuer

The set called list_anniversaries, list_birthdays, etc are ones that I created. They should work as expected with extended characters as long as the rest of your site works with them. The "not communicating with your database" issues is one I've seen before, but I thought was resolved with the current versions of those add-ons - as long as you have the latest versions from 

http://lisaandroger.com/downloads/download-category/wordpress/

and follow the instructions in the ReadMe files about how to put them into the Enhanced Text Widget for WordPress.

Roger

 

 

Link to comment
Share on other sites

1 minute ago, theKiwi said:

That's a whole separate issue - @HeatherFeuer created those widgets, or publishes them for someone else that created them.

I have tested yours files theKiwi. They didn't work:( because of this:

Error: TNG is not communicating with your database. Please check your database settings and try again. Settings can be found under Admin/Setup/General Settings/Database, or at the top of your config.php file.

Link to comment
Share on other sites

Just now, cfj said:

Error: TNG is not communicating with your database. Please check your database settings and try again. Settings can be found under Admin/Setup/General Settings/Database, or at the top of your config.php file.

Did you have the latest versions of the files, included in the Enhanced Text Widget?

Does it make a difference if you have only a single item - e.g. list_birthdays.php - in the Widget as opposed to multiple?

Have you tried a different theme, in case that's causing the problem?

If you want me to take a look at it, send an eMail to rogerkiwi@aol.com with

FTP - login details - address, username and password

WordPress Admin - login details - address, username and password

TNG Admin - login details - address, username and password

Roger

Link to comment
Share on other sites

I haven't tried them in a different theme, but I have tried everything you have suggested to others. I have the latest versions from your site.

After one week I gave up and went for the widget. Didn't think it would work, since I use Kloosterman method. Also tried tngToday but the same trouble here, also with the scandinavian letters.

I replied to this topic, since it's others who have the same issue. Regarding your files, everything went well in the WordPress directory, but not as an include.

Thank you for your fast reply.

 

Link to comment
Share on other sites

11 minutes ago, cfj said:

After one week I gave up and went for the widget. Didn't think it would work, since I use Kloosterman method.

 

Ahhh - the Kloosterman method is the problem I think then - since the add-ons are looking for a function that is in the TNG-WordPress-Plugin to be able to work - if they don't find those functions, then it assumes WordPress isn't involved.

if ( function_exists ('get_option') ) 
$wp_tng_path = get_option('mbtng_url');

So it will determine that WordPress is involved because get_option() exists, but it won't be able to retrieve the value for mbtng_url since that is part of the plugin

12 minutes ago, cfj said:

Regarding your files, everything went well in the WordPress directory, but not as an include.

Do you mean that if you called them directly they work, but won't work when included into the Widget?

How about if you include them directly into a static page - like I have on my index.php page at 

http://LisaAndRoger.com/ ?

Roger

Link to comment
Share on other sites

1 hour ago, theKiwi said:

That's a whole separate issue - @HeatherFeuer created those widgets, or publishes them for someone else that created them.

The extended characters issue also needs to be addressed by @HeatherFeuer

The set called list_anniversaries, list_birthdays, etc are ones that I created. They should work as expected with extended characters as long as the rest of your site works with them. The "not communicating with your database" issues is one I've seen before, but I thought was resolved with the current versions of those add-ons - as long as you have the latest versions from 

http://lisaandroger.com/downloads/download-category/wordpress/

and follow the instructions in the ReadMe files about how to put them into the Enhanced Text Widget for WordPress.

Roger

 

 

Hi Roger,

ok, I thought the @HeatherFeuer widgets were based on the same script as yours. Sorry for the confusion.

 

So, I tried yours again, with the enhanced text widget, making sure I have the most recent files. The problems shifted, but remain. I tested the birthday list and the top10 surnames.

 

TOP 10 SURNAMES

- when going to the .php directly, it works and shows 10 names (www.mysite.com/tngfolder/surnames-top10.php)
- making the enhanced text widget, the 10 names are displayed on my page
- however: the title is not displayed (checking the box "do not display title" doesn't make a difference)
- also: the rest of my page stops loading (all other widgets below this one, the footer, the TABS in my content,... it's like when the page loads the 10 surnames list, it just freezes; I tried moving it around on the page, with the same result: everything "above" the list is displayed properly, everything "below" is omitted)
- putting the code in a static page, gives no output

BIRTHDAY LIST

- when going to the .php directly, as described above, I get an error message ("this page does not work")
- I have not changed anything regarding language, $outputoption, cust_txt.php or anything, I have left all as "default", and both files are present in my TNG folder
- when using the enhanced text widget, it doesn't display anything (no error message, not even an empty container box) and as the above the rest of the page stops loading
- putting the code in a static page, gives no output

I don't have access to my FTP server here (I'm not on my own computer right now...). The only thing I haven't checked is if there is a default number for $outputoption. The txt file says we can modify it to a number between 1 and 6 with different outputs, I haven't touched it (thinking it would already be set at 1).

Regards,
Tom

Link to comment
Share on other sites

Are you using the TNG-WordPress-Plugin, or are you using the Kloosterman method?

11 minutes ago, fluffy82 said:

TOP 10 SURNAMES

- when going to the .php directly, it works and shows 10 names (www.mysite.com/tngfolder/surnames-top10.php)
- making the enhanced text widget, the 10 names are displayed on my page
- however: the title is not displayed (checking the box "do not display title" doesn't make a difference)
- also: the rest of my page stops loading (all other widgets below this one, the footer, the TABS in my content,... it's like when the page loads the 10 surnames list, it just freezes; I tried moving it around on the page, with the same result: everything "above" the list is displayed properly, everything "below" is omitted)
- putting the code in a static page, gives no output

The title must be entered into the Enhanced Widget - it doesn't come from the add-on - so in the Enhanced Text Widget you do need to enter a title like this

echo "<span class=\"normal\" align=\"center\">Surnames</span>";
include ("userscripts/surnamesTagCloud.php");
mbtng_close_tng_table ();
echo "<br/>";
echo "<span class=\"normal\" align=\"center\">Surnames Top 10</span>";
include ("userscripts/surnames-top10.php");
mbtng_close_tng_table ();

Where the first and 5th lines are creating the titles for Surnames Tag Cloud and Surnames Top 10.

Yes, it's inconsistent with the other lists for birthdays etc, and I suppose I should change it, but it is working as currently intended.

If the page stops after the successful loading of the first one, it means that the second one has failed. Do you have access to server error logs - that would probably tell you the reason for the failure.

If you are putting the code into a static page it requires different coding - see the Read Me file above the section that talks about using it with WordPress.

 

Quote

BIRTHDAY LIST

- when going to the .php directly, as described above, I get an error message ("this page does not work")
- I have not changed anything regarding language, $outputoption, cust_txt.php or anything, I have left all as "default", and both files are present in my TNG folder
- when using the enhanced text widget, it doesn't display anything (no error message, not even an empty container box) and as the above the rest of the page stops loading
- putting the code in a static page, gives no output

I don't have access to my FTP server here (I'm not on my own computer right now...). The only thing I haven't checked is if there is a default number for $outputoption. The txt file says we can modify it to a number between 1 and 6 with different outputs, I haven't touched it (thinking it would already be set at 1).

 

Are you able to provide me login details to be able to access the server?

I think until I can see it and look at and edit the code of the add ons and Enhanced Text Widget it's all guess work that will lead nowhere.

Roger

Link to comment
Share on other sites

Aaaaaaand I think I found the problem. I need to check if that's it when I'm home and have access to the .php file on my server.

The birthday list .php says at one point:

if ($mylanguage == "languages/English" || $mylanguage == "languages/English-UTF8") {$text;}

without giving another option.

$mylanguage is set in Dutch. So because it's not English, the $text is not displayed (as the above rule says only to display it when it's English).

Stupid me.

I'm quite sure that I can make the output appear, but I wonder if that will stop the page from freezing...

 

And the second possible problem: it says $userdirectory = "userscripts"; while my files are just in the tng folder. I need to change that to $userdirectory = ""; I suppose?
I thought that was being dealt with by putting include ("list_birthdays.php"); in the text widget?

Tom

Link to comment
Share on other sites

2 minutes ago, theKiwi said:

Are you able to provide me login details to be able to access the server?

I think until I can see it and look at and edit the code of the add ons and Enhanced Text Widget it's all guess work that will lead nowhere.

Roger

Yes, I'll do that tonight. I'm at work and don't have my log in codes etc here. I'll send you an e-mail.

Oh and yes, I am using the Kloosterman method.

I did put in the <?php include ("list_birthdays.php") ?> in the static page, and I also tried <?php include ("tng_11/list_birthdays.php") ?> (which is the folder the file is in looking at it from WordPress) but neither of them give results.

Thanks in advance!
Tom

Link to comment
Share on other sites

4 minutes ago, fluffy82 said:

Aaaaaaand I think I found the problem. I need to check if that's it when I'm home and have access to the .php file on my server.

The birthday list .php says at one point:

if ($mylanguage == "languages/English" || $mylanguage == "languages/English-UTF8") {$text;}

without giving another option.

$mylanguage is set in Dutch. So because it's not English, the $text is not displayed (as the above rule says only to display it when it's English).

Stupid me.

I'm quite sure that I can make the output appear, but I wonder if that will stop the page from freezing...

 

Step 5 in the Read Me file explains what you have to do if you support another language - I guess you haven't done that.

 

4 minutes ago, fluffy82 said:

And the second possible problem: it says $userdirectory = "userscripts"; while my files are just in the tng folder. I need to change that to $userdirectory = ""; I suppose?
I thought that was being dealt with by putting include ("list_birthdays.php"); in the text widget?

 

No, because the code on the page is testing for whether the add on is being called from a sub-directory or not.

So if it's in the TNG directory, the test is "is it in the userscripts directory" and if the answer is no, then it assumes it's in the TNG directory. This affects how it calls begin.php - from the same directory, or the directory above it.

The problem would arise if you had it in a sub-directory that wasn't called "userscripts".

Have you tried putting them into such a folder rather than in the TNG folder?

Roger

Link to comment
Share on other sites

1 minute ago, fluffy82 said:

Oh and yes, I am using the Kloosterman method.

 

So as I noted to @cfj, there are aspects of the code of these that is assuming you're using the plugin, and so may fail if you're not. For example

mbtng_close_tng_table ();

will fail if you're not using the plugin - maybe that's why the first instance shows, then it craps out because it can't find that function. So you and @cfj remove the instances of that line from the Enhanced Text Widget, maybe it will work?

Roger

Link to comment
Share on other sites

On 21.3.2018 at 3:22 PM, theKiwi said:

Do you mean that if you called them directly they work, but won't work when included into the Widget?

I have now tested again several times, but no include works in WordPress.

Error: TNG is not communicating with your database. Please check your database settings and try again. Settings can be found under Admin/Setup/General Settings/Database, or at the top of your config.php file.

However the file I have in the wp directory that work, with links, when I changes this line:

$cms['tngpath'] = $rootpath;

to

$cms['tngpath'] = $tngdomain;

This is not an include, but code from all of your events files

In my tng directory/subfolder, I have one include file

An other files, that uses helpers.php from the widget. I have removed this lines:

//include_once($cms['tngpath'] . "checklogin.php");
//include_once($cms['tngpath'] . "/script/userdatetimelib.php");

I have also tested your files without no modifications.

Link to comment
Share on other sites

Removing the line

mbtng_close_tng_table ();

did the trick. The surnames list now works like a charm. I also succeeded in adding the title, thanks for that.
 

All the best and thanks for your help!
Tom

EDIT: I spoke too soon... The top-10 surnames works perfectly, so does the list of deaths. But the births and anniversaries lists don't give results. They stopped blocking the page from loading, which is a step forward, and I don't get the "not communicating" error anymore. They just show no content, not even the text ("no birthdays" or "birthdays on ..."). I checked in my database and there should be indeed no anniversaries, but 46 births... It's the same result when using them all together in one single widget or when I single them out: top10 and deaths work, anniversaries and births remain empty.

And it gets even weirder... At first, I wasn't able to make the title show. I followed your advice and added the span line. That worked.
While playing around with it, I didn't bother adding that every time I "made" a new widget, knowing it works. But... Now the title I give withing the Enhanced Text widget DOES show! While it didn't 2 days ago. So apparently, I don't need that line of code anymore.

And one last update: it does the above on any WordPress page. When I go to a TNG page, the "no communication" error is back...

Link to comment
Share on other sites

3 hours ago, fluffy82 said:

And one last update: it does the above on any WordPress page. When I go to a TNG page, the "no communication" error is back...

Do you mean if you go to a TNG page in WordPress that is showing the sidebar?

Or do you mean a TNG page that you're trying to show the add ons on?

Do you have some links to pages where it works and doesn't?

Roger

Link to comment
Share on other sites

Hi Roger,

on my homepage, it works perfectly: https://huygens-vandemoortel-ancestry.be/

On a WordPress page as well: https://huygens-vandemoortel-ancestry.be/de-atlas-ferraris/

But on a page that includes TNG, it doesn't: https://huygens-vandemoortel-ancestry.be/tng_11/surnames.php

Don't mind the looks of the site, I just started and have some major tweaking to do still :)
I first want to get all the elements in place before I start fiddling with colours and fonts etc.

Regards,
Tom

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...