Project

General

Profile

« Previous | Next » 

Revision 51

Added by stefan about 19 years ago

Added new frontend class attribute no_default_content which controls what is shown in other blocks on pages like search, login,... and corrected implementation

View differences:

class.frontend.php
38 38

  
39 39
class frontend extends wb {
40 40
	// defaults
41
	var	$default_link,$default_page_id;
41
	var $default_link,$default_page_id;
42
	// when multiple blocks are used, show home page blocks on 
43
	// pages where no content is defined (search, login, ...)
44
	var $no_default_content=false;
42 45

  
43 46
	// page details
44 47
	// page database row
......
90 93
			if($default_num_rows > 0) {
91 94
				$fetch_default = $get_default->fetchRow();
92 95
				$this->default_link = $fetch_default['link'];
93
				$default_page_id = $fetch_default['page_id'];
96
				$this->default_page_id = $fetch_default['page_id'];
94 97
				// Check if we should redirect or include page inline
95 98
				if(HOMEPAGE_REDIRECTION) {
96 99
					// Redirect to page
......
98 101
					exit();
99 102
				} else {
100 103
					// Include page inline
101
					$this->page_id = $default_page_id;
104
					$this->page_id = $this->default_page_id;
102 105
				}
103 106
			} else {
104 107
		   		// No pages have been added, so print under construction page
......
111 114
		// Get default page link
112 115
		if(!isset($fetch_default)) {
113 116
		  	$fetch_default = $get_default->fetchRow();
114
	 		$this->default_link = $fetch_default['link'];
117
	 		$this->default_link = $fetch_default['link'];
118
			$this->default_page_id = $fetch_default['page_id'];
115 119
		}
116 120
		return true;
117 121
	}
......
416 420
		}
417 421
		if(isset($globals) AND is_array($globals)) { foreach($globals AS $global_name) { global $$global_name; } }
418 422
		// Make sure block is numeric
419
		if(!is_numeric($block)) { $block = 1; }

423
		if(!is_numeric($block)) { $block = 1; }
420 424
		// Include page content
421
		if(!defined('PAGE_CONTENT') OR $block!=1) {
425
		if(!defined('PAGE_CONTENT') OR $block!=1) {
426
			if ($this->page_id==0) {
427
				if ($block != 1 AND $this->no_default_content==true) {
428
					return;
429
				}
430
				$page_id=$this->default_page_id;
431
			} else {
432
				$page_id=$this->page_id;
433
			}
422 434
			// First get all sections for this page
423
			$query_sections = $database->query("SELECT section_id,module FROM ".TABLE_PREFIX."sections WHERE page_id = '".PAGE_ID."' AND block = '$block' ORDER BY position");
435
			$query_sections = $database->query("SELECT section_id,module FROM ".TABLE_PREFIX."sections WHERE page_id = '".$page_id."' AND block = '$block' ORDER BY position");
424 436
			if($query_sections->numRows() > 0) {
425 437
				// Loop through them and include there modules file
426 438
				while($section = $query_sections->fetchRow()) {
......
430 442
				}
431 443
			}
432 444
		} else {
433
			require(PAGE_CONTENT);
445
			if($block == 1) {
446
				require(PAGE_CONTENT);
447
			}
434 448
		}
435 449
	}
436 450

  

Also available in: Unified diff