page.php 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. <?php
  2. /**
  3. * Copyright (c) UNA, Inc - https://una.io
  4. * MIT License - https://opensource.org/licenses/MIT
  5. *
  6. * @defgroup UnaCoreSamples Samples
  7. * @{
  8. */
  9. /**
  10. * @page samples
  11. * @section page Page
  12. */
  13. /**
  14. -- Page Object
  15. INSERT INTO `sys_objects_page` (`object`, `title`, `module`, `layout_id`, `visible_for_levels`, `visible_for_levels_editable`, `url`, `meta_description`, `meta_keywords`, `meta_robots`, `cache_lifetime`, `cache_editable`, `deletable`, `override_class_name`, `override_class_file`) VALUES
  16. ('sample', 'Sample Page', 'sample', 9, 2147483647, 1, 'samples/page.php', 'sample page', 'sample, page', 'noindex', 3600, 1, 1, '', '');
  17. -- Page Blocks
  18. INSERT INTO `sys_pages_blocks` (`object`, `cell_id`, `module`, `title`, `designbox_id`, `visible_for_levels`, `type`, `content`, `deletable`, `copyable`, `order`) VALUES
  19. ('sample', 1, 'sample', 'sample 1', 11, 2147483647, 'raw', 'sample 1', 1, 1, 1),
  20. ('sample', 1, 'sample', 'sample 2', 11, 2147483647, 'raw', 'sample 2', 1, 1, 2),
  21. ('sample', 2, 'sample', 'sample 11', 11, 2147483647, 'raw', 'sample 11<br />\r\nsample 11<br />\r\nsample 11<br />\r\nsample 11<br />\r\nsample 11<br />\r\nsample 11<br />\r\n', 1, 1, 1),
  22. ('sample', 3, 'sample', 'sample 33', 11, 2147483647, 'raw', 'sample 33<br />\r\nsample 33<br />\r\n', 1, 1, 1);
  23. */
  24. $aPathInfo = pathinfo(__FILE__);
  25. require_once ($aPathInfo['dirname'] . '/../inc/header.inc.php');
  26. require_once(BX_DIRECTORY_PATH_INC . "design.inc.php");
  27. $oTemplate = BxDolTemplate::getInstance();
  28. $oTemplate->setPageNameIndex (BX_PAGE_DEFAULT);
  29. $oTemplate->setPageContent ('page_main_code', PageCompMainCode());
  30. $oTemplate->getPageCode();
  31. /**
  32. * page code function
  33. */
  34. function PageCompMainCode()
  35. {
  36. ob_start();
  37. $oPage = BxDolPage::getObjectInstance('sample'); // it automatically creates instance of default or custom class by object name
  38. if ($oPage)
  39. echo $oPage->getCode(); // print page
  40. else
  41. echo '"sample" page is missing.';
  42. return ob_get_clean();
  43. }
  44. /** @} */