[ Index ] |
|
Code source de Plume CMS 1.2.2 |
1 <?php 2 # ***** BEGIN LICENSE BLOCK ***** 3 # This file is part of Plume CMS, a website management application. 4 # Copyright (C) 2001-2005 Loic d'Anterroches and contributors. 5 # 6 # Plume CMS is free software; you can redistribute it and/or modify 7 # it under the terms of the GNU General Public License as published by 8 # the Free Software Foundation; either version 2 of the License, or 9 # (at your option) any later version. 10 # 11 # Plume CMS is distributed in the hope that it will be useful, 12 # but WITHOUT ANY WARRANTY; without even the implied warranty of 13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 # GNU General Public License for more details. 15 # 16 # You should have received a copy of the GNU General Public License 17 # along with this program; if not, write to the Free Software 18 # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 19 # 20 # ***** END LICENSE BLOCK ***** 21 22 /** 23 * Create the path to a resource from a resource object 24 * 25 * @param object resource 26 * @return string path to the resource 27 */ 28 function pathToResource($res) 29 { 30 global $_PX_context, $_PX_config; 31 // Absolute path to resource, print it like that. 32 if (ereg(':',$res->f('path'))) 33 return $res->f('path'); 34 35 if (isset($_PX_context['out'])) $base = $res->f('website_url'); 36 else $base = $res->f('website_reurl'); 37 if ($_PX_config['url_format'] == 'simple') $base .= '/?'; 38 39 // if type is xmedia the link is special 40 if ('xmedia' == $res->f('type_id')) 41 return $base.$res->f('website_xmedia_reurl').$res->f('path'); 42 if ('news' == $res->f('type_id')) 43 return $base.$res->f('category_path').$res->f('resource_id').'-'.textStr2url($res->f('title')); 44 // else standard link 45 return $base.$res->f('category_path').$res->f('path'); 46 } 47 48 49 /** 50 * Create the path to a category from the category object. 51 * 52 * @param object category 53 * @return string path to the category 54 */ 55 function pathToCategory($cat) 56 { 57 global $_PX_context, $_PX_config; 58 if (isset($_PX_context['out'])) $base = $res->f('website_url'); 59 else $base = $res->f('website_reurl'); 60 if ($_PX_config['url_format'] == 'simple') $base .= '/?'; 61 return $base.$cat->f('category_path'); 62 } 63 64 /** 65 * For the article it is possible to have multiple pages 66 * 67 * @param object resource 68 * @param int number of the page 69 * @return string path to the article page 70 */ 71 function pathToArticlePage($res, $page = 1) 72 { 73 global $_PX_context, $_PX_config; 74 if (isset($_PX_context['out'])) $base = $res->f('website_url'); 75 else $base = $res->f('website_reurl'); 76 if ($_PX_config['url_format'] == 'simple') $base .= '/?'; 77 if ($page == 1) $page = ''; 78 return $base.$res->f('category_path').$res->f('path').$page; 79 } 80 81 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Mon Nov 26 11:57:01 2007 | par Balluche grâce à PHPXref 0.7 |
![]() |