diff --git a/htdocs/website/samples/page-sample-dynamiccontent.html b/htdocs/website/samples/page-sample-dynamiccontent.html index c0e217dcc72..b2dd5acaea4 100644 --- a/htdocs/website/samples/page-sample-dynamiccontent.html +++ b/htdocs/website/samples/page-sample-dynamiccontent.html @@ -42,3 +42,57 @@ __(YouCanEditHtmlSource)__ Page created by __WEBSITE_CREATE_BY__
+ + + + +
+This is an example of a section to show the list of latest 5 articles (container with type "blogpost"), that contains the keyword "mykeyword"...
+ +

Latest Blog posts

+
+ loadLangs(array("main")); + $websitepage = new WebsitePage($db); + $fuser = new User($db); + $arrayofblogs = $websitepage->fetchAll($website->id, 'DESC', 'date_creation', 5, 0, array('type_container'=>'blogpost', 'keywords'=>$keyword)); + if (is_numeric($arrayofblogs) && $arrayofblogs < 0) + { + print '
'.$weblangs->trans($websitepage->error).'
'; + } + elseif (is_array($arrayofblogs) && ! empty($arrayofblogs)) + { + foreach($arrayofblogs as $blog) + { + print ''; + } + } + else + { + print '
'; + print '
'; + print $weblangs->trans("NoArticlesFoundForTheKeyword", $keyword); + print '
'; + print '
'; + + } + ?> +
+
\ No newline at end of file