Du hast recht...das hatte ich aber schon geändert. Leider wird aber nichts ausgegeben.
tl_module.php
PHP-Code:
$GLOBALS['TL_DCA']['tl_module']['fields']['numImmos'] = array(
'label' => &$GLOBALS['TL_LANG']['tl_immo']['numImmos'],
'inputType' => 'text',
'default' => 6,
'eval' => array(
'mandatory' => true,
'tl_class' => 'w50',
),
'sql' => "int(10) NOT NULL"
);
ModuleImmolist.php
PHP-Code:
class ModuleImmolist extends Module
{
/**
* Template
* @var string
*/
protected $strTemplate = 'immolist';
/**
* Generate the module
*/
protected function compile()
{
$this->import('Database') ;
$objImmo = $this->Database
-> prepare('SELECT *
FROM tl_immo
WHERE published = 1
ORDER BY id DESC
LIMIT ?')
-> execute($this->numImmos);
$this->Template->immo = $objImmo->fetchAllAssoc();
}
}
Fehlermeldung
PHP Fatal error: Uncaught exception 'Exception' with message 'Query error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''3'' at line 5 (SELECT *
FROM tl_immo
WHERE published = 1
ORDER BY id DESC
LIMIT '3')' thrown in /Users/Torsten/Projekte/gosebrink/internet/system/modules/core/library/Contao/Database/Statement.php on line 295
Hinweis: Wenn ich in die PHP Datei nach Limit die Zahl 3 in den Code eingebe, bekomme ich eine Ausgabe von 3 Objekten
Lesezeichen