Project

General

Profile

« Previous | Next » 

Revision 1946

Added by darkviper over 11 years ago

update Droplet iParentPageIcon

View differences:

branches/2.8.x/CHANGELOG
11 11
! = Update/Change
12 12
===============================================================================
13 13

  
14
03 Aug-2013 Build 1946 M.v.d.Decken(DarkViper)
15
! Droplet iParentPageIcon
14 16
03 Aug-2013 Build 1945 M.v.d.Decken(DarkViper)
15 17
! module/MultiLingual updated for make use of different graphics format
16 18
+ Droplet to use Multilingual in index.php of template
branches/2.8.x/wb/admin/interface/version.php
51 51

  
52 52
// check if defined to avoid errors during installation (redirect to admin panel fails if PHP error/warnings are enabled)
53 53
if(!defined('VERSION')) define('VERSION', '2.8.3');
54
if(!defined('REVISION')) define('REVISION', '1945');
54
if(!defined('REVISION')) define('REVISION', '1946');
55 55
if(!defined('SP')) define('SP', '');
branches/2.8.x/wb/modules/droplets/example/iParentPageIcon.php
1
//:search for icon in current page and parent pages if not found
1
//:search for an image in current page. If no image is present, the image of the parent page is inherited.
2 2
//:Use: [[iParentPageIcon?type=1]] Display the page-icon(0)(default) or menu_icon_0(1) or menu_icon_1(2) if found
3 3
// @author: Werner von der Decken
4 4
// @param int $type: 0=page_icon(default) | 1=menu_icon_0 | 2=menu_icon_1
5 5
// @param string $icon: name of a default image placed in WB_PATH/TEMPLATE/
6 6
// @return: a valid image-URL or empty string
7 7
//
8
global $wb, $database;
8

  
9
$oDb = WbDatabase::getInstance();
9 10
$type = !isset($type) ? 0 : (intval($type) % 3);
10 11
$icontypes = array( 0=>'page_icon', 1=>'menu_icon_0', 2=>'menu_icon_1');
11 12
$icon_url = '';
......
13 14
{
14 15
	$icon_url = WB_REL.'/templates/'.TEMPLATE.'/'.$icon;
15 16
}
16
$tmp_trail = $wb->page_trail;
17
$tmp_trail = array_reverse($tmp_trail);
17
$tmp_trail = array_reverse($GLOBALS['wb']->page_trail);
18 18
foreach($tmp_trail as $pid)
19 19
{
20 20
	$sql  = 'SELECT `'.$icontypes[$type].'` ';
21
	$sql .= 'FROM `'.TABLE_PREFIX.'pages` ';
21
	$sql .= 'FROM `'.$oDb->TablePrefix.'pages` ';
22 22
	$sql .= 'WHERE `page_id`='.(int)$pid;
23
	if( ($icon = $database->get_one($sql)) != false )
23
	if( ($icon = $oDb->get_one($sql)) != false )
24 24
	{
25 25
		if( file_exists(WB_PATH.$icon) )
26 26
		{

Also available in: Unified diff