WBCE CMS Forum

WBCE CMS – Way Better Content Editing.

You are not logged in.

#1 23.12.2021 23:02:24

losttrip
Member

No search results from oneforall or news with images

WBCE Version: 1.5.0
Tag: 1.5.0
PHP Version: 7.4.26

(modified) oneforall 1.1.6
News with Images 5.0.7

I have added the search box droplet to a page.  When I do a search for a known term, the page that is returned does not have my template elements (header, menus, footer) and it shows "Results for 'search term':  and then the rest of the page is blank

I am wanting results form (modified) oneforall pages and NWI pages.

The error log shows:

2021-12-23T21:45:07+00:00 [Warning] /search/search_modext.php:[110] from /modules/news_img/search.php:[50] print_excerpt2 "count(): Parameter must be an array or an object that implements Countable"
2021-12-23T21:45:07+00:00 [Exception] There was an unknown exception: Call to a member function numRows() on null in line (46) of /modules/oneforallmod/search.php 

Last edited by losttrip (23.12.2021 23:03:06)

Offline

#2 24.12.2021 01:19:25

bernd
Developer

Re: No search results from oneforall or news with images

Your nearly "blank page" is caused by the Exception.
You have renamed your modified oneforall to oneforallmod as far as I see?
Unfortunately  in the modules search.php the module name is hardcoded so you have to change line 20 in your /oneforallmod/search.php to match your modules name .
Otherwise the all the database queries will look in the "wrong" tables.

Last edited by bernd (24.12.2021 01:22:21)


... nein in Europa verwenden wir beim Programmieren nicht € statt $ ...

Online

#3 24.12.2021 03:59:49

losttrip
Member

Re: No search results from oneforall or news with images

Thanks for your reply.
I changed the name of the modified module in my post to a generic name - "oneforallmod".  Not sure why, probably out of habit to keep the site private, which was not necessary in this case.

The actual error is:

2021-12-24T02:48:56+00:00 [Exception] There was an unknown exception: Call to a member function numRows() on null in line (46) of /modules/hrhshop/search.php 

The name of the modified oneforall is actually "HRHShop".  I just checked line 20 and I had the following:

$mod_name = 'HRHShop';

I guess the name can't contain uppercase, or it doesn't match something because of it has uppercase.

I changed line 20 to:

$mod_name = 'hrhshop';

and all works now.

Thanks for nudging me in the right direction.

Offline

#4 25.12.2021 03:58:01

bernd
Developer

Re: No search results from oneforall or news with images

Ah, ok,
as far as I can see, the install.php takes into account possibly renamed installations and adjusts the places in various files affected by the renaming accordingly.
Somewhere there seems to be an uppercase / lowercase conversion problem ...
If you named your module "HRHShop" in info.php, but the database tables are created in lowercase as "hrhshop_xxx" and the "HRHShop" appears again in search.php (where it is needed for data queries), this must go wrong, because Linux operating systems are case sensitive.
I have to play around with it the days, probably only a small bug in the installer.


... nein in Europa verwenden wir beim Programmieren nicht € statt $ ...

Online

#5 27.12.2021 02:13:16

bernd
Developer

Re: No search results from oneforall or news with images

Ok,
I think I have it. A little f***ing slip in install.php
The install.php takes excellent care of renamed installs on its own, and renames all relevant occurrences of "oneforall" on the fly in various files accordingly.
Except for the search.php.

There it counts how often "oneforall" occurs (line 101)

if ($count == 2) {

But in reality there are actually 3 occurrences - 1 time in the actual source code, 1 time in the function name and one time in the comment area in the header of the file.

So if I change the above line to

if ($count == 3) {

This also changes the function name, but this is also (as far as I can see) in the sense of the search function?
Not quite sure, at the moment.

@losttrip
Apart from my explanations above:
if you only changed the $mod_name (line 20) in the search.php, probably no reasonable search results should appear from your hrhshop?!?
Could you please verify this?

Last edited by bernd (27.12.2021 05:18:34)


... nein in Europa verwenden wir beim Programmieren nicht € statt $ ...

Online

#6 27.12.2021 02:56:10

losttrip
Member

Re: No search results from oneforall or news with images

bernd wrote:

@losttrip
Apart from my explanations above:
if you only changed the $mod_name (line 20) in the search.php, probably no reasonable search results should appear from your hrhshop?!?
Could you please verify this?

Thanks for your effort on this.
All I changed was line 20 (as noted above), and the search returns the expected (reasonable) results.

Offline

#7 27.12.2021 03:13:28

bernd
Developer

Re: No search results from oneforall or news with images

Thank you very much for your answer.
I am not really familiar with the functionality of the search.

Can I ask you one more favor (to exclude unwanted side effects):
how exactly looks the line 18 ( function ...) in the said search.php
and, if it says oneforall_search, could you change it to hrhshop_search and check if the search results are still ok?


... nein in Europa verwenden wir beim Programmieren nicht € statt $ ...

Online

#8 27.12.2021 04:25:30

losttrip
Member

Re: No search results from oneforall or news with images

I am happy to help in any little way I can, so you never need to hesitate to ask.

Line 18:

function hrhshop_search($func_vars) {

Here are lines 1-22:

<?php

/**
 *
 * @category		modules
 * @package			hrhshop
 * @author			WBCE Community
 * @copyright		2004-2009, Ryan Djurovich
 * @copyright		2009-2010, Website Baker Org. e.V.
 * @copyright		2019-, WBCE Community
 * @link			https://www.wbce.org/
 * @license			http://www.gnu.org/licenses/gpl.html
 * @platform		WBCE
 *
 */


function hrhshop_search($func_vars) {
	extract($func_vars, EXTR_PREFIX_ALL, 'func');
	$mod_name = 'hrhshop';

	// How many lines of excerpt we want to have at most

I honestly can not say for certain that these lines were auto-populated on install.  It has been a long time since I installed this module.  It appears I might have made the changes on line 6 and 18 manually.

I just checked another modified oneforall install on another site, and it ONLY shows the modified name on line 20:

<?php

/**
 *
 * @category		modules
 * @package			oneforall
 * @author			WBCE Community
 * @copyright		2004-2009, Ryan Djurovich
 * @copyright		2009-2010, Website Baker Org. e.V.
 * @copyright		2019-, WBCE Community
 * @link			https://www.wbce.org/
 * @license			http://www.gnu.org/licenses/gpl.html
 * @platform		WBCE
 *
 */


function oneforall_search($func_vars) {
	extract($func_vars, EXTR_PREFIX_ALL, 'func');
	$mod_name = 'rndteams';

	// How many lines of excerpt we want to have at most

In this last site's case, the "rndteams" items were not showing in the search results.  I just manually changed line 18 and it now works.

Hope this helps.

Last edited by losttrip (27.12.2021 04:30:40)

Offline

#9 27.12.2021 05:08:34

bernd
Developer

Re: No search results from oneforall or news with images

Ok.
this confirms my theory and erases my last doubts.
If the installer does not replace all occurrences of "oneforall" the search does not work.

I will inform Florian, so that there is an appropriate patch for it, so that feature users do not run into this problem.

All in all:
thanks for your help in debugging such a "rare" problem.
I wish more users would be so cooperative ;-)


... nein in Europa verwenden wir beim Programmieren nicht € statt $ ...

Online

Liked by:

losttrip

#10 27.12.2021 12:58:03

florian
Administrator

Re: No search results from oneforall or news with images

Thanks, I've update the module.

Offline

Liked by:

losttrip, bernd

Board footer

up