Revision 1233
Added by Dietmar almost 15 years ago
frontend.functions.php | ||
---|---|---|
1 | 1 |
<?php |
2 |
/**************************************************************************** |
|
3 |
* SVN Version information: |
|
4 |
* |
|
5 |
* frontend.functions.php 1181 2009-11-24 18:42:19Z Luisehahne $ |
|
6 |
* |
|
7 |
* |
|
8 |
* |
|
9 |
***************************************************************************** |
|
10 |
* WebsiteBaker |
|
11 |
* |
|
12 |
* WebsiteBaker Project <http://www.websitebaker2.org/> |
|
13 |
* Copyright (C) 2009, Website Baker Org. e.V. |
|
14 |
* http://start.websitebaker2.org/impressum-datenschutz.php |
|
15 |
* Copyright (C) 2004-2009, Ryan Djurovich |
|
16 |
* |
|
17 |
* About WebsiteBaker |
|
18 |
* |
|
19 |
* Website Baker is a PHP-based Content Management System (CMS) |
|
20 |
* designed with one goal in mind: to enable its users to produce websites |
|
21 |
* with ease. |
|
22 |
* |
|
23 |
***************************************************************************** |
|
24 |
* |
|
25 |
***************************************************************************** |
|
26 |
* LICENSE INFORMATION |
|
27 |
* |
|
28 |
* WebsiteBaker is free software; you can redistribute it and/or |
|
29 |
* modify it under the terms of the GNU General Public License |
|
30 |
* as published by the Free Software Foundation; either version 2 |
|
31 |
* of the License, or (at your option) any later version. |
|
32 |
* |
|
33 |
* WebsiteBaker is distributed in the hope that it will be useful, |
|
34 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
35 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
|
36 |
* See the GNU General Public License for more details. |
|
37 |
* |
|
38 |
* You should have received a copy of the GNU General Public License |
|
39 |
* along with this program; if not, write to the Free Software |
|
40 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
|
41 |
**************************************************************************** |
|
42 |
* |
|
43 |
* WebsiteBaker Extra Information |
|
44 |
* |
|
45 |
* Version file |
|
46 |
* |
|
47 |
* This file is purely for ensuring compatibility with 3rd party |
|
48 |
* contributions made for WB version 2.5.2 or below |
|
49 |
* |
|
50 |
* |
|
51 |
* |
|
52 |
*****************************************************************************/ |
|
53 |
/** |
|
54 |
* |
|
55 |
* @category frontend |
|
56 |
* @package functions |
|
57 |
* @author Ryan Djurovich |
|
58 |
* @copyright 2004-2009, Ryan Djurovich |
|
59 |
* @copyright 2009-2010, Website Baker Org. e.V. |
|
60 |
* @version frontend.functions.php 1181 2009-11-24 18:42:19Z Luisehahne $ |
|
61 |
* @platform WebsiteBaker 2.8.x |
|
62 |
* @requirements >= PHP 4.3.4 |
|
63 |
* @license http://www.gnu.org/licenses/gpl.html |
|
64 |
* |
|
65 |
*/ |
|
2 | 66 |
|
3 |
// $Id$ |
|
4 |
|
|
5 |
/* |
|
6 |
|
|
7 |
Website Baker Project <http://www.websitebaker.org/> |
|
8 |
Copyright (C) 2004-2009, Ryan Djurovich |
|
9 |
|
|
10 |
Website Baker is free software; you can redistribute it and/or modify |
|
11 |
it under the terms of the GNU General Public License as published by |
|
12 |
the Free Software Foundation; either version 2 of the License, or |
|
13 |
(at your option) any later version. |
|
14 |
|
|
15 |
Website Baker is distributed in the hope that it will be useful, |
|
16 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
17 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
18 |
GNU General Public License for more details. |
|
19 |
|
|
20 |
You should have received a copy of the GNU General Public License |
|
21 |
along with Website Baker; if not, write to the Free Software |
|
22 |
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
23 |
|
|
24 |
*/ |
|
25 |
|
|
26 |
/* |
|
27 |
This file is purely for ensuring compatibility with 3rd party |
|
28 |
contributions made for WB version 2.5.2 or below |
|
29 |
*/ |
|
30 | 67 |
if(!defined('WB_URL')) { |
31 | 68 |
header('Location: ../index.php'); |
32 | 69 |
exit(0); |
... | ... | |
280 | 317 |
|
281 | 318 |
if (!function_exists('show_breadcrumbs')) |
282 | 319 |
{ |
283 |
function show_breadcrumbs($sep=' » ',$tier=1,$links=true,$depth=-1, $title='You are here: ')
|
|
320 |
function show_breadcrumbs($sep = ' » ',$level = 0, $links = true, $depth = -1, $title = 'You are here: ')
|
|
284 | 321 |
{ |
285 | 322 |
global $wb; |
286 |
$page_id=$wb->page_id; |
|
287 |
if ($page_id!=0) |
|
323 |
$page_id = $wb->page_id; |
|
324 |
|
|
325 |
if ($page_id != 0) |
|
288 | 326 |
{ |
289 | 327 |
global $database; |
290 |
$bca=$wb->page_trail; |
|
291 |
$counter=0; |
|
328 |
$counter = 0; |
|
329 |
// get links as array |
|
330 |
$bread_crumbs = $wb->page_trail; |
|
331 |
$count = sizeof($bread_crumbs); |
|
332 |
// level can't be greater than sum of links |
|
333 |
$level = ($count <= $level ) ? $count-1 : $level; |
|
334 |
// set level from which to show, delete indexes in array |
|
335 |
$crumbs = array_slice($bread_crumbs, $level ); |
|
336 |
// set depth of links -1 or 0 show all links |
|
337 |
$depth = ($depth <= 0) ? sizeof($crumbs) : $depth; |
|
338 |
// if empty array, set orginal links |
|
339 |
$crumbs = (!empty($crumbs)) ? $crumbs : $wb->page_trail; |
|
340 |
$total_crumbs = ( ($depth <= 0) OR ($depth > sizeof($crumbs)) ) ? sizeof($crumbs) : $depth; |
|
292 | 341 |
print '<div class="breadcrumb">'.$title; |
293 | 342 |
|
294 |
foreach ($bca as $temp) |
|
295 |
{ |
|
296 |
if ($counter>=($tier-1) AND ($depth<0 OR $tier+$depth>$counter)) |
|
297 |
{ |
|
298 |
if ($counter>=$tier) print '<span class="separator">'.$sep.'</span>'; |
|
299 |
$query_menu=$database->query("SELECT menu_title,link FROM ".TABLE_PREFIX."pages WHERE page_id=$temp"); |
|
300 |
$page=$query_menu->fetchRow(); |
|
301 |
if ($links==true AND $temp!=$page_id) |
|
343 |
foreach ($crumbs as $temp){ |
|
344 |
if($counter == $depth) { break; } |
|
345 |
// set separator |
|
346 |
$query_menu = $database->query("SELECT menu_title, link FROM ".TABLE_PREFIX."pages WHERE page_id = $temp"); |
|
347 |
$page = $query_menu->fetchRow(); |
|
348 |
if ( ($links == true) AND ($temp != $page_id) ) { |
|
302 | 349 |
print '<a href="'.page_link($page['link']).'">'.$page['menu_title'].'</a>'; |
303 |
else |
|
304 |
print '<span class="crumb">'.$page['menu_title'].'</span>'; |
|
305 |
} |
|
350 |
} else { |
|
351 |
print '<span class="crumb">'.$page['menu_title'].'</span>'; |
|
352 |
} |
|
353 |
if ( ( $counter <> $total_crumbs-1 ) ) { |
|
354 |
print '<span class="separator">'.$sep.'</span>'; |
|
355 |
} |
|
306 | 356 |
$counter++; |
307 |
}
|
|
357 |
}
|
|
308 | 358 |
print "</div>\n"; |
309 | 359 |
} |
310 | 360 |
} |
Also available in: Unified diff
recoded function show_breadcrumbs