page-sample-dynamiccontent.html 4.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. <!-- Enter here your HTML content. Add a section with an id tag and tag contenteditable="true" if you want to use the inline editor for the content -->
  2. <section id="div1" class="dolcontenteditable" style="text-align: center" contenteditable="true">
  3. <br>
  4. __(MyContainerTitle)__
  5. <br><br>
  6. </section>
  7. <section id="divmycompany" style="text-align: center" contenteditable="true">
  8. This is example of dynamic content to get the name of your company (see source of page to see code):<br>
  9. </section>
  10. <h1 style="text-align: center" >
  11. <?php echo $mysoc->name; ?>
  12. <br>
  13. </h1>
  14. <section id="divmetadata" style="text-align: center" contenteditable="true">
  15. This is another example of dynamic content to get meta data of a container/page (see source of page to see code):<br>
  16. </section>
  17. <div style="text-align: center">
  18. __(Title)__ : <?php echo $websitepage->title; ?><br>
  19. __(Description)__ : <?php echo $websitepage->description; ?><br>
  20. __(Keywords)__ : <?php echo $websitepage->keywords; ?><br>
  21. __(DateCreation)__ : <?php echo dol_print_date($websitepage->date_creation, 'dayhour', $weblangs); ?><br>
  22. <br>
  23. </div>
  24. <section id="divinclude" style="text-align: center" contenteditable="true">
  25. __(AnotherContainer)__
  26. </section>
  27. <div style="text-align: center">
  28. <?php includeContainer('alias_of_container_to_include'); ?>
  29. </div>
  30. <section id="div5" style="text-align: center" contenteditable="true">
  31. <br><br>
  32. __(YouCanEditHtmlSource)__
  33. <br><br>
  34. Page created by __WEBSITE_CREATE_BY__
  35. <br>
  36. </section>
  37. <!-- Blog list -->
  38. <section id="sectionnews" contenteditable="true" class="main section-50 section-md-50 section-md-bottom-50">
  39. This is an example of a section to show the list of latest 5 articles (container with type "blogpost"), that contains the keyword "mykeyword"...<br>
  40. <h2>Latest Blog posts</h2>
  41. <div class="center">
  42. <?php
  43. $keyword = 'mykeyword';
  44. $weblangs->loadLangs(array("main"));
  45. $websitepage = new WebsitePage($db);
  46. $fuser = new User($db);
  47. $arrayofblogs = $websitepage->fetchAll($website->id, 'DESC', 'date_creation', 5, 0, array('type_container'=>'blogpost', 'keywords'=>$keyword));
  48. if (is_numeric($arrayofblogs) && $arrayofblogs < 0)
  49. {
  50. print '<div class="error">'.$weblangs->trans($websitepage->error).'</div>';
  51. }
  52. elseif (is_array($arrayofblogs) && ! empty($arrayofblogs))
  53. {
  54. foreach($arrayofblogs as $blog)
  55. {
  56. print '<div class="row justify-content-sm-center row-40">';
  57. print '<div class="container blog-box centpercent" style="padding: 20px; transition: .3s all ease;">';
  58. print '<a href="'.$blog->pageurl.'.php">';
  59. print '<div class="post-boxed-img-wrap"><img src="'.($blog->image ? 'viewimage.php?modulepart=medias&file='.$blog->image : 'medias/image/'.$website->ref.'/calendar.svg"').'" alt="" width="120"></div>';
  60. print '<div class="post-boxed-caption">';
  61. print '<div class="post-boxed-title font-weight-bold">'.$blog->title.'</div>';
  62. print '<ul class="list-inline list-inline-dashed text-uppercase">';
  63. print '<li>'.dol_print_date($blog->date_creation, 'daytext', 'tzserver', $weblangs).'</li>';
  64. $fuser->fetch($blog->fk_user_creat);
  65. print '<li><span>by<span> <span class="text-primary">'.($fuser->firstname?$fuser->firstname:$fuser->login).'</span></span></li>';
  66. print '</ul>';
  67. print '</div>';
  68. //includeContainer($blog->pageurl);
  69. print '<span class="nohover">'.$blog->description.'</span>';
  70. print '</a>';
  71. print '</div>';
  72. print '</div>';
  73. }
  74. }
  75. else
  76. {
  77. print '<div class="row justify-content-sm-center row-40">';
  78. print '<div class="container blog-box centpercent" style="padding: 20px; transition: .3s all ease;">';
  79. print $weblangs->trans("NoArticlesFoundForTheKeyword", $keyword);
  80. print '</div>';
  81. print '</div>';
  82. }
  83. ?>
  84. </div>
  85. </section>