| [ PHPXref.com ] | [ Generated: Sun Jul 20 16:35:25 2008 ] | [ bBlog 0.7.6 ] |
| [ Index ] [ Variables ] [ Functions ] [ Classes ] [ Constants ] [ Statistics ] | ||
[Summary view] [Print] [Text view]
1 <?php 2 3 // function.links.php - a smarty function for displaying bBlog links 4 // Copyright (C) 2003 Mario Delgado <mario@seraphworks.com> 5 // function.links.php - a plug-in written for bBlog Weblog 6 /* 7 ** bBlog Weblog http://www.bblog.com/ 8 ** Copyright (C) 2003 Eaden McKee <email@eadz.co.nz> 9 ** 10 ** This program 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 ** This program 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 this program; if not, write to the Free Software 22 ** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 23 */ 24 25 function identify_function_links () { 26 $help = ' 27 <p>Links is a Smarty function to be used in templates. 28 <p>Example usage 29 <ul><li>To return a list of links, one per line :<br> 30 {links}</li> 31 <li>To return a list, seperated by a # <br> 32 {links sep=#}</li> 33 <li>To return a list for the category humor <br> 34 {links cat=humor}</li> 35 <li>To return a list without the category stores <br> 36 {links notcat=stores}</li> 37 <li>To limit the number of links returned <br> 38 {links num=5}</li> 39 <li>The default behavior is to return the list in <br> 40 or as set in the admin panel. This <br> 41 can be changed with one of the following key words <br> 42 <br> 43 {links ord=nicename} <br> 44 {links ord=category}</li> 45 <li>To return a list in descending order <br> 46 {links desc=TRUE}</li> 47 <li>cat and notcat are mutually exclusive and cannot <br> 48 be used together. They can both be used with sep, <br> 49 ord, num and desc which can all be used together. <br> 50 Category names and ord key words are case sensative.</li> 51 </ul>'; 52 53 return array ( 54 'name' =>'links', 55 'type' =>'function', 56 'nicename' =>'Links', 57 'description' =>'Make a list of links', 58 'authors' =>'Mario Delgado <mario@seraphworks.com>', 59 'licence' =>'GPL', 60 'help' => $help 61 ); 62 63 64 } 65 66 function smarty_function_links($params, &$bBlog) { 67 68 $markedlinks = ''; 69 70 if(!isset($params['sep'])) { 71 $sep = "<br />"; 72 } else { 73 $sep = $params['sep']; 74 } 75 76 if(isset($params['presep'])) $presep = $params['presep']; // use this for lists 77 78 if(isset($params['desc'])) { 79 $asde = "DESC"; 80 } else { 81 $asde = ""; 82 } 83 84 if(isset($params['ord'])) { 85 $order = $params['ord']; 86 } else { 87 $order = "position"; 88 } 89 90 if(isset($params['num'])) { 91 $max = $params['num']; 92 } else { 93 $max = "20"; 94 } 95 96 if(isset($params['cat'])) { 97 $cat = $bBlog->get_var("select categoryid from ".T_CATEGORIES." where name='".$params['cat']."'"); 98 } 99 100 if(isset($params['notcat'])) { 101 $notcat = $bBlog->get_var("select categoryid from ".T_CATEGORIES." where name='".$params['notcat']."'"); 102 } 103 104 if ($cat) { 105 $links = $bBlog->get_results("select * from ".T_LINKS." where category='".$cat."' order by ".$order." ".$asde." limit ".$max); 106 } elseif ($notcat) { 107 $links = $bBlog->get_results("select * from ".T_LINKS." where category !='".$notcat."' order by ".$order." ".$asde." limit ".$max); 108 } else { 109 $links = $bBlog->get_results("select * from ".T_LINKS." order by ".$order." ".$asde." limit ".$max); 110 } 111 112 113 if(!empty($links)) { 114 foreach ($links as $link) { 115 $url = $link->url; 116 $nicename = $link->nicename; 117 $markedlinks .= $presep.'<a href="'.$url.'">'.$nicename.'</a>'.$sep; 118 } 119 } 120 121 return $markedlinks; 122 } 123 124 ?>
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| [ Powered by PHPXref - Served by Debian GNU/Linux ] |