| [ Index ] | PHP Cross Reference of Mambo 4.6.5 |
|
| [ Variables ] [ Functions ] [ Classes ] [ Constants ] [ Statistics ] | ||
[Summary view] [Print] [Text view]
1 <?php 2 /** 3 * @package Mambo 4 * @author Mambo Foundation Inc see README.php 5 * @copyright (C) 2000 - 2009 Mambo Foundation Inc. 6 * See COPYRIGHT.php for copyright notices and details. 7 * @license GNU/GPL Version 2, see LICENSE.php 8 * 9 * Redistributions of files must retain the above copyright notice. 10 * 11 * Mambo is free software; you can redistribute it and/or 12 * modify it under the terms of the GNU General Public License 13 * as published by the Free Software Foundation; version 2 of the License. 14 */ 15 16 /** ensure this file is being included by a parent file */ 17 defined( '_VALID_MOS' ) or die( 'Direct Access to this location is not allowed.' ); 18 19 $option = trim( mosGetParam( $_REQUEST, 'option', null ) ); 20 $task = trim( mosGetParam( $_REQUEST, 'task', null ) ); 21 $id = intval( mosGetParam( $_REQUEST, 'id', null ) ); 22 $moduleclass_sfx = $params->get( 'moduleclass_sfx' ); 23 24 if ($option == 'com_content' && $task == 'view' && $id) { 25 26 // select the meta keywords from the item 27 $query = "SELECT metakey FROM #__content WHERE id='$id'"; 28 $database->setQuery( $query ); 29 30 if ($metakey = trim( $database->loadResult() )) { 31 // explode the meta keys on a comma 32 $keys = explode( ',', $metakey ); 33 $likes = array(); 34 35 // assemble any non-blank word(s) 36 foreach ($keys as $key) { 37 $key = trim( $key ); 38 if ($key) { 39 $likes[] = $database->getEscaped( $key ); 40 } 41 } 42 43 if (count( $likes )) { 44 // select other items based on the metakey field 'like' the keys found 45 $query = "SELECT id, title" 46 . "\nFROM #__content" 47 . "\nWHERE id<>$id AND state=1 AND access <=$my->gid AND (metakey LIKE '%"; 48 $query .= implode( "%' OR metakey LIKE '%", $likes ); 49 $query .= "%')"; 50 51 $database->setQuery( $query ); 52 if ($related = $database->loadObjectList()) { 53 echo "<ul>\n"; 54 foreach ($related as $item) { 55 if ($option="com_content" && $task="view") { 56 $Itemid = $mainframe->getItemid($item->id); 57 } 58 $href = sefRelToAbs( "index.php?option=com_content&task=view&id=$item->id&Itemid=$Itemid" ); 59 echo " <li><a href=\"$href\">$item->title</a></li>\n"; 60 } 61 echo "</ul>\n"; 62 } 63 } 64 } 65 } 66 ?>
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated: Wed Feb 8 00:05:01 2012 | Cross-referenced by PHPXref 0.7 |
| Mambo API: Mambo is Free software released under the GNU/General Public License, Version 2 |