- Timestamp:
- 01/18/12 23:41:12 (4 months ago)
- Location:
- trunk/inc/classes
- Files:
-
- 2 edited
-
BxDolPage.php (modified) (4 diffs)
-
BxDolTemplate.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/inc/classes/BxDolPage.php
r15893 r15897 19 19 * Pages. 20 20 * 21 * It allows to display pages build from studio. 21 * It allows to display pages build from studio. 22 * 23 * The new system has the following page features: 24 * - layouts: page can have any page structure, not just columns. 25 * - SEO: page can have own SEO options, like meta tags and meta keywords, as well as instructions for search bots. 26 * - cache: page can be cached on server or in client's browser. 27 * - visibility: page access can be controlled using member levels. 28 * 29 * 30 * 31 * @section page_create Creating the Page object: 32 * 33 * 1. add record to 'sys_objects_page' table: 34 * 35 * - object: name of the page object, in the format: vendor prefix, underscore, module prefix, underscore, internal identifier or nothing; for example: bx_profiles_view - profile view page. 36 * - title: title to display as page title. 37 * - module: the module this page belongs to. 38 * - layout_id: page layout to use, it is id of the record from 'sys_pages_layouts' table. 39 * - visibile_for_levels: bit field with set of member level ids. To use member level id in bit field - the level id minus 1 as power of 2 is used, for example: 40 * - user level id = 1 -> 2^(1-1) = 1 41 * - user level id = 2 -> 2^(2-1) = 2 42 * - user level id = 3 -> 2^(3-1) = 4 43 * - user level id = 4 -> 2^(4-1) = 8 44 * - visibile_for_levels_editable: it determines if 'visibile_for_levels' field is ediable from page builder, visibility options can be overriden by custom class and shouldn't editable in this case. 45 * - url: the page url, if it is static page. 46 * - meta_description: meta description of the page. 47 * - meta_keywords: meta keywords of the page. 48 * - meta_robots: instructions for search bots. 49 * - cache_server: number of seconds to store cache for on the server. 50 * - cache_editable: it determines if cache can be edited from page builder. 51 * - deletable: it determines if page can be deleted from page builder. 52 * - override_class_name: user defined class name which is derived from BxTemplPage. 53 * - override_class_file: the location of the user defined class, leave it empty if class is located in system folders. 54 * 55 * Page layout are stored in 'sys_pages_layouts' table: 56 * - name: inner unique layout name. 57 * - icon: layout icon to display in page builder, it should represent basic view of the layout to help studio operator determine the layout structure. 58 * - title: layout name to display in page builder. 59 * - template: template name to use to display page with certain layout. 60 * - cells_number: number of areas in the layout, page blocks can be places into this areas(cells). 61 * To define areas in the layout they should be named as '__cell_N__', where N is cell number, starting from 1. 62 * 63 * 64 * 2. Add page blocks to 'sys_pages_blocks' table: 65 * - object: page object name this block belongs to. 66 * - cell_id: cell number in page layout to place block to. 67 * - module: module name this block belongs to. 68 * - title: block title. 69 * - designbox_id: design box to use to diplay page block, it is id of the record from 'sys_pages_blocks' table. 70 * - visibile_for_levels: bit field with set of member level ids. To use member level id in bit field - the level id minus 1 as power of 2 is used, for example: 71 * - user level id = 1 -> 2^(1-1) = 1 72 * - user level id = 2 -> 2^(2-1) = 2 73 * - user level id = 3 -> 2^(3-1) = 4 74 * - user level id = 4 -> 2^(4-1) = 8 75 * - type: block type 76 * - raw: HTML block, displayed in page builder as HTML textarea. 77 * - html: HTML block, displayed in page builder as visual editor, line TinyMCE. 78 * - lang: translatable language string, displayed in page builder as editable language key. 79 * - image: just an image, displayed in page builder as HTML upload form. 80 * - rss: RSS block, displayed in page builder as editable URL to RSS resource, along with number of displayed items. 81 * - menu: menu block, displayed as menu selector. 82 * - service: to display block content, the provided serice method is used. 83 * - content: depending on 'type' field: 84 * - raw: HTML string. 85 * - html: HTML string. 86 * - lang: language key. 87 * - image: image id in the storage. 88 * - rss: URL to RSS with number of displayed items, for example: http://www.example.com/rss#4 89 * - menu: menu object name. 90 * - service: serialized array of service call parameters: module - module name, method - service method name, params - array of parameters. 91 * - deletable: is block deletable from page builder 92 * - copyable: is block can be copied to any other page from page builder. 93 * - order: block order in some cell. 94 * 95 * Block design boxes are stored in 'sys_pages_design_boxes' table: 96 * - id: consistent id, there are the following defines can be used in the code for each system block style: 97 * - 0 - BX_DB_CONTENT_ONLY: design box with content only - no borders, no background, no caption. 98 * - 1 - BX_DB_DEF: default design box with content, borders and caption. 99 * - 2 - BX_DB_EMPTY: just empty design box, without anything. 100 * - 3 - BX_DB_NO_CAPTION: design box with content, like BX_DB_DEF but without caption. 101 * - 10 - BX_DB_PADDING_CONTENT_ONLY: design box with content only wrapped with default padding - no borders, no background, no caption; it can be used to just wrap content with default padding. 102 * - 11 - BX_DB_PADDING_DEF: default design box with content wrapped with default padding, borders and caption. 103 * - 13 - BX_DB_PADDING_NO_CAPTION: design box with content wrapped with default padding, like BX_DB_DEF but without caption. 104 * - title: block name which is displayed in studio, describes block styles. 105 * - template: template name to use to display page block. 106 * 107 * 108 * 3. Display Page. 109 * Use the following sample code to display page: 110 * @code 111 * bx_import('BxDolPage'); 112 * $oPage = BxDolPage::getObjectInstance('sample'); // 'sample' is 'object' field from 'sys_objects_page' table, it automatically creates instance of default or custom class by object name 113 * if ($oPage) 114 * echo $oPage->getCode(); // print page 115 * @endcode 116 * 22 117 */ 23 118 24 /*25 119 26 CREATE TABLE IF NOT EXISTS `sys_objects_page` (27 `id` int(11) NOT NULL AUTO_INCREMENT,28 `object` varchar(32) COLLATE utf8_unicode_ci NOT NULL,29 `title` varchar(255) COLLATE utf8_unicode_ci NOT NULL,30 `module` varchar(32) COLLATE utf8_unicode_ci NOT NULL,31 `layout_id` int(11) NOT NULL,32 `visibile_for_levels` int(11) NOT NULL,33 `visibile_for_levels_editable` tinyint(4) NOT NULL DEFAULT '1',34 `url` varchar(255) COLLATE utf8_unicode_ci NOT NULL,35 `meta_description` text COLLATE utf8_unicode_ci NOT NULL,36 `meta_keywords` text COLLATE utf8_unicode_ci NOT NULL,37 `meta_robots` varchar(255) COLLATE utf8_unicode_ci NOT NULL,38 `cache_server` int(11) NOT NULL,39 `cache_server_params` varchar(255) COLLATE utf8_unicode_ci NOT NULL,40 `cache_client` int(11) NOT NULL,41 `cache_editable` tinyint(4) NOT NULL,42 `deletable` tinyint(1) NOT NULL,43 PRIMARY KEY (`id`),44 UNIQUE KEY `object` (`object`)45 ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;46 47 -- --------------------------------------------------------48 49 CREATE TABLE IF NOT EXISTS `sys_pages_blocks` (50 `id` int(11) NOT NULL AUTO_INCREMENT,51 `object` varchar(32) COLLATE utf8_unicode_ci NOT NULL,52 `cell_id` int(11) NOT NULL,53 `module` varchar(32) COLLATE utf8_unicode_ci NOT NULL,54 `title` varchar(255) COLLATE utf8_unicode_ci NOT NULL,55 `designbox_id` int(11) NOT NULL,56 `visibile_for_levels` int(11) NOT NULL,57 `type` enum('raw','html','lang','image','rss','menu','service') COLLATE utf8_unicode_ci NOT NULL DEFAULT 'raw',58 `content` text COLLATE utf8_unicode_ci NOT NULL,59 `deletable` tinyint(4) NOT NULL,60 `copyable` tinyint(4) NOT NULL,61 `order` int(11) NOT NULL,62 PRIMARY KEY (`id`)63 ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;64 65 -- --------------------------------------------------------66 67 CREATE TABLE IF NOT EXISTS `sys_pages_design_boxes` (68 `id` int(11) NOT NULL,69 `title` varchar(255) COLLATE utf8_unicode_ci NOT NULL,70 `template` varchar(255) COLLATE utf8_unicode_ci NOT NULL,71 PRIMARY KEY (`id`)72 ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;73 74 INSERT INTO `sys_pages_design_boxes` (`id`, `title`, `template`) VALUES75 (0, '_sys_designbox_0', 'designbox_0.html'),76 (1, '_sys_designbox_1', 'designbox_1.html'),77 (2, '_sys_designbox_2', 'designbox_2.html'),78 (3, '_sys_designbox_3', 'designbox_3.html'),79 (10, '_sys_designbox_10', 'designbox_10.html'),80 (11, '_sys_designbox_11', 'designbox_11.html'),81 (13, '_sys_designbox_13', 'designbox_13.html');82 83 -- --------------------------------------------------------84 85 CREATE TABLE IF NOT EXISTS `sys_pages_layouts` (86 `id` int(11) NOT NULL AUTO_INCREMENT,87 `icon` varchar(255) COLLATE utf8_unicode_ci NOT NULL,88 `title` varchar(255) COLLATE utf8_unicode_ci NOT NULL,89 `template` varchar(255) COLLATE utf8_unicode_ci NOT NULL,90 `cells_number` int(11) NOT NULL,91 PRIMARY KEY (`id`)92 ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=2 ;93 94 INSERT INTO `sys_pages_layouts` (`id`, `icon`, `title`, `template`, `cells_number`) VALUES95 (1, 'layout_bar_left.png', '_sys_layout_bar_left', 'layout_bar_left.html', 2);96 97 */98 120 99 121 class BxDolPage extends BxDol { … … 144 166 } 145 167 168 /** 169 * Check if page block is visible. 170 */ 146 171 protected function _isVisibleBlock ($a) { 147 172 bx_import('BxDolAcl'); … … 149 174 } 150 175 176 /** 177 * Check if page is visible. 178 */ 151 179 protected function _isVisiblePage ($a) { 152 180 bx_import('BxDolAcl'); … … 154 182 } 155 183 156 public function getCode () {157 158 }159 184 } 160 185 -
trunk/inc/classes/BxDolTemplate.php
r15890 r15897 290 290 'keywords' => array(), 291 291 'description' => '', 292 'robots' => '', 292 293 'css_name' => array(), 293 294 'css_compiled' => array(), … … 406 407 407 408 /** 409 * Set page meta robots. 410 * 411 * @param string $s page meta robots. 412 */ 413 function setPageMetaRobots($s) { 414 $this->aPage['robots'] = $s; 415 } 416 417 /** 408 418 * Set page content for some variable. 409 419 * @param string $sVar name of content variable … … 805 815 case 'page_charset': 806 816 $sRet = 'UTF-8'; 817 break; 818 case 'page_robots': 819 if(!empty($this->aPage['robots']) && is_string($this->aPage['robots'])) 820 $sRet = '<meta name="robots" content="' . bx_html_attribute($this->aPage['robots']) . '" />'; 807 821 break; 808 822 case 'page_keywords':
Note: See TracChangeset
for help on using the changeset viewer.