Ich bin jetzt mit der DB-Abfrage für die Gesamtzahl der Kommentare soweit:
PHP-Code:
<?php
$this->import('Database');
$result = $this->Database->prepare("SELECT COUNT(*) FROM tl_comments")->execute();
echo $result;
?>
Erhalte diesen Ausstoß:
PHP-Code:
Recoverable error: Object of class DB_Mysql_Result could not be converted to string.
#0 /.../html/contao/templates/.../com_default.xhtml(15): __error(4096, 'Object of class...', '/var/www/virtua...', 15, Array)
#1 /.../html/contao/system/libraries/Template.php(246): include('/var/www/virtua...')
#2 /.../html/contao/system/modules/frontend/FrontendTemplate.php(49): Template->parse()
#3 /.../html/contao/system/modules/comments/Comments.php(139): FrontendTemplate->parse()
#4 /.../html/contao/system/modules/comments/ContentComments.php(85): Comments->addCommentsToTemplate(Object(FrontendTemplate), Object(stdClass), 'tl_content', '85', '...')
#5 /.../html/contao/system/modules/frontend/ContentElement.php(139): ContentComments->compile()
#6 /.../html/contao/system/modules/comments/ContentComments.php(65): ContentElement->generate()
#7 /.../html/contao/system/libraries/Controller.php(489): ContentComments->generate()
#8 /.../html/contao/system/modules/frontend/ModuleArticle.php(193): Controller->getContentElement('85')
#9 /.../html/contao/system/modules/frontend/Module.php(140): ModuleArticle->compile()
#10 /.../html/contao/system/modules/frontend/ModuleArticle.php(71): Module->generate()
#11 /.../html/contao/system/libraries/Controller.php(421): ModuleArticle->generate(false)
#12 /.../html/contao/system/libraries/Controller.php(294): Controller->getArticle('33', false, false, 'main')
#13 /.../html/contao/system/modules/frontend/PageRegular.php(100): Controller->getFrontendModule('0', 'main')
#14 /.../html/contao/index.php(200): PageRegular->generate(Object(DB_Mysql_Result))
#15 /.../html/contao/index.php(319): Index->run()
#16 {main}
Lesezeichen