Changeset 610 for trunk/include/functions_html.inc.php
- Timestamp:
- Nov 20, 2004, 6:23:42 PM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/functions_html.inc.php
r593 r610 198 198 199 199 /** 200 * returns the list of categories as a HTML string, with cache of names 201 * 202 * categories string returned contains categories as given in the input 203 * array $cat_informations. $uppercats is the list of category ids to 204 * display in the right order. If url input parameter is empty, returns only 205 * the categories name without links. 206 * 207 * @param string uppercats 208 * @param string separator 209 * @param string url 210 * @param boolean replace_space 211 * @return string 212 */ 213 function get_cat_display_name_cache($uppercats, 214 $separator, 215 $url = 'category.php?cat=', 216 $replace_space = true) 217 { 218 global $cat_names; 219 220 if (!isset($cat_names)) 221 { 222 $query = ' 223 SELECT id,name 224 FROM '.CATEGORIES_TABLE.' 225 ;'; 226 $result = pwg_query($query); 227 while ($row = mysql_fetch_array($result)) 228 { 229 $cat_names[$row['id']] = $row['name']; 230 } 231 } 232 233 $output = ''; 234 $is_first = true; 235 foreach (explode(',', $uppercats) as $category_id) 236 { 237 $name = $cat_names[$category_id]; 238 239 if ($is_first) 240 { 241 $is_first = false; 242 } 243 else 244 { 245 $output.= $separator; 246 } 247 248 if ($url == '') 249 { 250 $output.= $name; 251 } 252 else 253 { 254 $output.= ' 255 <a class="" 256 href="'.add_session_id(PHPWG_ROOT_PATH.$url.$category_id).'">'.$name.'</a>'; 257 } 258 } 259 if ($replace_space) 260 { 261 return replace_space($output); 262 } 263 else 264 { 265 return $output; 266 } 267 } 268 269 /** 200 270 * returns the HTML code for a category item in the menu (for category.php) 201 271 *
Note: See TracChangeset
for help on using the changeset viewer.