Parse error: syntax error, unexpected ''lsg:LIKE'' (T_CONSTANT_ENCAPSED_STRING), expecting ')' in /home/mysite/public_html/core/cache/includes/elements/modsnippet/84.include.cache.php on line 26
<?php
/**
* @package bible
*/
/* this snippet searches the bible_verses table based on the supplied search query*/
//Load the class
$base_path = !empty($base_path) ? $base_path : $modx->getOption('core_path').'components/bible/';
//Adds the package to xPDO, and allows us to use all of xPDO's functions with the model
$result = $modx->addPackage('bible',$base_path.'model/');
// Check if package was added successfuly
if (! $result) {
return 'Failed to add package';
}
// Search in the bible_verses table
$c = $modx->newQuery('BibleVerse');
$c->where(array(
'lsg:LIKE' => '%'.$search.'%',
'OR:book:LIKE' => '%'.$search.'%',
'OR:chapter:LIKE' => '%'.$search.'%',
'OR:verse:LIKE' => '%'.$search.'%',
));
$count = $modx->getCount('BibleVerse',$c);
$c->select(array(
'id','book','chapter','verse','lsg', 'resource'
));
$c->limit($limit,$offset);
$verses = $modx->getCollection('BibleVerse',$c);
$results = array();
foreach ($verses as $verse) {
// Extract text and add highlighting
// Use functions of the SimpleSearch class
$searchObj = new SimpleSearch($modx,array());
$searchObj->parseSearchString($search);
$extract = $verse->get('lsg');
$extract = $searchObj->createExtract($extract, 200, $search,'…');
$extract = preg_replace("#\[\[(.*?)\]\]#si", '', $extract); // cleanup extract
$extract = str_replace(array('[[',']]'), '', $extract);
$extract = $searchObj->addHighlighting($extract, 'sisea-highlight', 'span'); // highlighting class and tag
$results[] = array(
'id' => $verse->get('id'),
'pagetitle' => $verse->get('chapter'),
'longtitle' => $verse->get('verse'),
'introtext' => $verse->get('lsg'),
'link' => $verse->get('book'),
'extract' => $extract
);
}
$hook->addFacet('verses',$results,$count);
return true;This question has been answered by treigh. See the first response.
I you sure that's the snippet with the ID of 84?
I can't find anything wrong with the code and my code editor agrees.
The offending line is supposed to be near line 26 and there doesn't appear to be anything wrong there.
<h1 class="bbl-h2">[[*pagetitle]]</h1> [[!SimpleSearchForm? &landing=`2190` &tpl=`tplBibleSearchForm`]] [[!SimpleSearch? &toPlaceholder=`sisea.results` &postHooks=`bibleVerseHook` &facetLimit=`5`]] <p>NORMAL</p> [[+sisea.results]] <p>FACETED</p> [[+sisea.verses.results]]
<?php
function elements_modsnippet_84($scriptProperties= array()) {
global $modx;
if (is_array($scriptProperties)) {
extract($scriptProperties, EXTR_SKIP);
}
/**
* @package bible
*/
/* this snippet searches the bible_verses table based on the supplied search query*/
//Load the class
$base_path = !empty($base_path) ? $base_path : $modx->getOption('core_path').'components/bible/';
//Adds the package to xPDO, and allows us to use all of xPDO's functions with the model
$result = $modx->addPackage('bible',$base_path.'model/');
// Check if package was added successfuly
if (! $result) {
return 'Failed to add package';
}
// Search in the bible_verses table
$c = $modx->newQuery('bibleVerse');
$c->where(array(
'lsg:LIKE' => '%'.$search.'%',
'OR:book:LIKE' => '%'.$search.'%',
'OR:chapter:LIKE' => '%'.$search.'%',
'OR:verse:LIKE' => '%'.$search.'%',
));
$count = $modx->getCount('bibleVerse',$c);
$c->select(array(
'id','book','chapter','verse','lsg', 'resource'
));
$c->limit($limit,$offset);
$verses = $modx->getCollection('bibleVerse',$c);
$results = array();
foreach ($verses as $verse) {
// Extract text and add highlighting
// Use functions of the SimpleSearch class
$searchObj = new SimpleSearch($modx,array());
$searchObj->parseSearchString($search);
$extract = $verse->get('lsg');
$extract = $searchObj->createExtract($extract, 200, $search,'…'); // number of chard and char to use for ellipsis
$extract = preg_replace("#\[\[(.*?)\]\]#si", '', $extract); // cleanup extract
$extract = str_replace(array('[[',']]'), '', $extract);
$extract = $searchObj->addHighlighting($extract, 'sisea-highlight', 'span'); // highlighting class and tag
$results[] = array(
'id' => $verse->get('id'),
'pagetitle' => $verse->get('chapter'),
'longtitle' => $verse->get('verse'),
'introtext' => $verse->get('lsg'),
'link' => $verse->get('book'),
'extract' => $extract
);
}
$hook->addFacet('verses',$results,$count);
return true;
}
<?php
require_once (dirname(dirname(__FILE__)) . '/bibleverse.class.php');
class bibleVerse_mysql extends bibleVerse {}<?php
$xpdo_meta_map['bibleVerse']= array (
'package' => 'bible',
'version' => '1.1',
'table' => 'bible_verses',
'extends' => 'xPDOSimpleObject',
'fields' =>
array (
'book' => 0,
'resource' => 0,
'chapter' => 0,
'verse' => 0,
'lsg' => 'None',
'darby' => 'None',
'ostervald' => 'None',
'martin' => 'None',
'is_promesse' => 0,
),
'fieldMeta' =>
array (
'book' =>
array (
'dbtype' => 'INT',
'precision' => '3',
'phptype' => 'integer',
'null' => false,
'default' => 0,
),
'resource' =>
array (
'dbtype' => 'INT',
'precision' => '11',
'phptype' => 'integer',
'null' => false,
'default' => 0,
),
'chapter' =>
array (
'dbtype' => 'INT',
'precision' => '3',
'phptype' => 'integer',
'null' => false,
'default' => 0,
),
'verse' =>
array (
'dbtype' => 'INT',
'precision' => '3',
'phptype' => 'integer',
'null' => false,
'default' => 0,
),
'lsg' =>
array (
'dbtype' => 'text',
'phptype' => 'string',
'null' => false,
'default' => 'None',
),
'darby' =>
array (
'dbtype' => 'text',
'phptype' => 'string',
'null' => false,
'default' => 'None',
),
'ostervald' =>
array (
'dbtype' => 'text',
'phptype' => 'string',
'null' => false,
'default' => 'None',
),
'martin' =>
array (
'dbtype' => 'text',
'phptype' => 'string',
'null' => false,
'default' => 'None',
),
'is_promesse' =>
array (
'dbtype' => 'int',
'precision' => '1',
'attributes' => 'unsigned',
'phptype' => 'integer',
'null' => false,
'default' => 0,
),
),
'indexes' =>
array (
'lsg' =>
array (
'alias' => 'lsg',
'primary' => false,
'unique' => false,
'type' => 'BTREE',
'columns' =>
array (
'lsg' =>
array (
'length' => '',
'collation' => 'A',
'null' => false,
),
),
),
),
'aggregates' =>
array (
'Resource' =>
array (
'class' => 'modResource',
'local' => 'resource',
'foreign' => 'id',
'cardinality' => 'one',
'owner' => 'foreign',
),
'Book' =>
array (
'class' => 'bibleBook',
'local' => 'book',
'foreign' => 'id',
'cardinality' => 'one',
'owner' => 'foreign',
),
),
);
$c->where(array(
'lsg:LIKE' => '%'.$search.'%',
'OR:book:LIKE' => '%'.$search.'%',
'OR:chapter:LIKE' => '%'.$search.'%',
'OR:verse:LIKE' => '%'.$search.'%',
));