Snippets GetOneRow-error

Have a question or a suggestion about a 3rd party addon module or plugin?
Let us know here.
Locked
User avatar
paulbaker
Dev Team Member
Dev Team Member
Posts: 1465
Joined: Sat Apr 18, 2009 10:09 pm
Location: Maidenhead, UK
Contact:

Snippets GetOneRow-error

Post by paulbaker »

I have installed Snippets, a global content block system:
http://dev.cmsmadesimple.org/projects/gcb

It is generating an error.

I create a new snippet called Headcode with the (no WYSIWYG) content simply:

Code: Select all

<!-- test -->
I call that in my page template, with:

Code: Select all

{Snippet name='Headcode'}
within the head.

I the front end I see the snippet but also an error message before it:

Code: Select all

<strong>/home/cthuk/public_html/bhs/modules/Snippet/class.neodb.php: GetOneRow-error (error)</strong><!-- test -->
Here's the code from class.neodb.php which is generating the error:

Code: Select all

function GetOneRow($criteria = array(), $failifmultiple = false)
    {
      $db = $this->NeoDb();

      $sql = "SELECT * FROM " . cms_db_prefix() . $this->_tablename . " ";
      /*$params=array();
      $string="";*/

      $pcrit = $this->_preparecriteria($criteria);

      $dbresult = $db->Execute($sql . $pcrit["sql"], $pcrit["params"]);

      if (!$dbresult || ($dbresult->RecordCount() == 0)) {
        $this->ThisEcho("GetOneRow-error", "error", $db->ErrorMsg());
        return false;
      }
      if ($failifmultiple && ($dbresult->RecordCount() > 1)) {
        $this->ThisEcho("More than one row returned", "error");
        return false;
      }

      $row = $dbresult->FetchRow();

      //echo count($result);
      return $row;
    }
Help ???

----------------------------------------------
Cms Version: 2.1.5
Installed Modules:
AdminSearch: 1.0.2
CGExtensions: 1.53.13
CGSharedContent: 1.0.1
CMSContentManager: 1.1.1
DesignManager: 1.1.1
FileManager: 1.5.2
LISE: 1.2.1.1
LISEQuotes: 1.2.1.1
MicroTiny: 2.0.3
ModuleManager: 2.0.4
Navigator: 1.0.3
News: 2.50.5
Search: 1.50.2
Snippet: 0.1.5

Config Information:
php_memory_limit:
max_upload_size: 50000000
url_rewriting: none
page_extension:
query_var: page
auto_alias_content: true
locale:
set_names: true
timezone: Europe/London
permissive_smarty: false

Php Information:
phpversion: 5.6.24
md5_function: On (True)
json_function: On (True)
gd_version: 2
tempnam_function: On (True)
magic_quotes_runtime: Off (False)
E_ALL: 22519
E_STRICT: 0
E_DEPRECATED: 0
test_file_timedifference: No time difference found
test_db_timedifference: No time difference found
create_dir_and_file: 1
memory_limit: 128M
max_execution_time: 120
register_globals: Off (False)
output_buffering: 4096
disable_functions:
open_basedir:
test_remote_url: Success
file_uploads: On (True)
post_max_size: 50M
upload_max_filesize: 50M
session_save_path: /tmp (1777)
session_use_cookies: On (True)
xml_function: On (True)
xmlreader_class: On (True)
check_ini_set: On (True)
curl: On

Performance Information:
allow_browser_cache: Off (False)
browser_cache_expiry: 60
php_opcache: Off (False)
smarty_cache: Off (False)
smarty_compilecheck: Off (False)
smarty_cache_udt: Off (False)
auto_clear_cache_age: On (True)
Server Information:
Server Software: Apache
Server Api: cgi-fcgi
Server Os: Linux 2.6.18-471.3.1.el5.lve0.8.72 On x86_64
Server Db Type: MySQL (mysqli)
Server Db Version: 5.6.30
Server Db Grants: Found a "GRANT ALL" statement that appears to be suitable

Permission Information:
tmp: /home/cthuk/public_html/bhs/tmp (0755)
tmp_cache: /home/cthuk/public_html/bhs/tmp/cache (0755)
templates_c: /home/cthuk/public_html/bhs/tmp/templates_c (0755)
modules: /home/cthuk/public_html/bhs/modules (0755)
uploads: /home/cthuk/public_html/bhs/uploads (0755)
File Creation Mask (umask): /home/cthuk/public_html/bhs/tmp/cache (0755)
config_file: 0444
----------------------------------------------
To copy System Information to the forum:
https://docs.cmsmadesimple.org/troubles ... nformation

CMS Made Simple Geekmoots attended:
Nottingham, UK 2012 | Ghent, Belgium 2015 | Leicester, UK 2016
User avatar
Silmarillion
Dev Team Member
Dev Team Member
Posts: 483
Joined: Sun Jan 02, 2005 9:10 pm
Location: Denmark

Re: Snippets GetOneRow-error

Post by Silmarillion »

Hi Paul

This sounds strange. I can reproduce the error (which has to be dealt with), but only if I try to show a Snippet with a name/textid which does not exist...
like {Snippet name='idonotexist'}
... You are sure you have spelled the name correctly, right?
I have a new version almost ready for release, I'll look into this and try to do some more checks!

Thank you :)

Morten/Silmarillion
User avatar
paulbaker
Dev Team Member
Dev Team Member
Posts: 1465
Joined: Sat Apr 18, 2009 10:09 pm
Location: Maidenhead, UK
Contact:

Re: Snippets GetOneRow-error

Post by paulbaker »

A bit more investigation has shown that this error occurs if I leave "shortcode" blank - I just fill in name and content.

If I fill in shortcode, it works without the error. So I guess you need to make shortcode a required field, too?
To copy System Information to the forum:
https://docs.cmsmadesimple.org/troubles ... nformation

CMS Made Simple Geekmoots attended:
Nottingham, UK 2012 | Ghent, Belgium 2015 | Leicester, UK 2016
User avatar
Silmarillion
Dev Team Member
Dev Team Member
Posts: 483
Joined: Sun Jan 02, 2005 9:10 pm
Location: Denmark

Re: Snippets GetOneRow-error

Post by Silmarillion »

aaah, thank you for narrowing it down! Shortcode should only be a help, not required, I'll make it work like that, probably never tested this...
thank you!

m.
Locked

Return to “Modules/Add-Ons”