baslik.php?kategori=<?php echo $row_goster['kategori']; ?>
şeklinde linklerim var yani baslik.php?kategori=test şeklinde görünüyor linklerim
mesela kategorite Türkçe karakter varsa onları nasıl silebilirim ?
Türkçe karakterleri eleme
10
●847
- 25-08-2010, 13:34:54
$row_goster[kategori] = array( 'Č' => 'c', 'č' => 'c', 'Ğ' => 'g', 'Ğ' => 'g', 'ğ' => 'g', 'Ş' => 's', 'ş' => 's', 'Ö' => 'o', 'ö' => 'o', 'Ü' => 'u', 'ü' => 'u', '"' => '', 'ğ' => 'g', 'Ş' => 's', 'ş' => 's', 'İ' => 'i', 'ı' => 'i', 'Ç' => 'c', 'ç' => 'c', 'Ü' => 'u', 'ü' => 'u', 'Ö' => 'o', 'ö' => 'o', 'ı' => 'i', 'İ' => 'i', 'é' => 'i', 'â' => 'a', 'Ê' => 'e', 'Â' => 'a', '?' => '', '*' => '', '.' => '', ',' => '', ';' => '', ')' => '', '(' => '', '{' => '', '}' => '', '[' => '', ']' => '', '!' => '', '+' => '', '"' => '', '%' => '', '&' => '', '#' => '', '$' => '', '=' => '', 'ê' => 'e');
dene bakalım şunu vbseo için yapılmış birşey.. - 25-08-2010, 13:58:18Üyeliği durduruldu
<?php require_once('Connections/baglanti.php'); ?> <?php require_once('Connections/baglanti.php'); ?> <?php function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") { $theValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) : $theValue; switch ($theType) { case "text": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "long": case "int": $theValue = ($theValue != "") ? intval($theValue) : "NULL"; break; case "double": $theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL"; break; case "date": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "defined": $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue; break; } return $theValue; } $editFormAction = $_SERVER['PHP_SELF']; if (isset($_SERVER['QUERY_STRING'])) { $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']); } if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) { $insertSQL = sprintf("INSERT INTO makaleler (id, baslik, icerik, kategori, keywords) VALUES (%s, %s, %s, %s, %s)", GetSQLValueString($_POST['id'], "int"), GetSQLValueString($_POST['baslik'], "text"), GetSQLValueString($_POST['icerik'], "text"), GetSQLValueString($_POST['kategori'], "text"), GetSQLValueString($_POST['keywords'], "text")); mysql_select_db($database_baglanti, $baglanti); $Result1 = mysql_query($insertSQL, $baglanti) or die(mysql_error()); $insertGoTo = "kategoriler.php"; if (isset($_SERVER['QUERY_STRING'])) { $insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?"; $insertGoTo .= $_SERVER['QUERY_STRING']; } header(sprintf("Location: %s", $insertGoTo)); } mysql_select_db($database_baglanti, $baglanti); $query_goster = "SELECT kategori,max(id) id FROM makaleler GROUP BY kategori"; $goster = mysql_query($query_goster, $baglanti) or die(mysql_error()); $row_goster = mysql_fetch_assoc($goster); $totalRows_goster = mysql_num_rows($goster); ?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>kategoriler</title> </head> <body> <p> </p> <table border="1"> <?php do { ?> <tr> <td><a href="baslik.php?kategori=<?php echo $row_goster['kategori']; ?>"><?php echo $row_goster['kategori']; ?></a></td> </tr> <?php } while ($row_goster = mysql_fetch_assoc($goster)); ?> </table> <p> </p> <p> </p> <p> </p> </body> </html> <?php mysql_free_result($goster); ?>
sayfanın tüm kodları bu dediğiniz kodları nereye yapıştıracağım? 0 - 25-08-2010, 14:16:05sadece türkçe karakterleri temizlemen yetmez. özel karakterleride temizlemen gerek. şu fonk. baglanti.php nin içine at.
function permayap($deger) { $turkce=array("ş","Ş","ı","(",")","'","ü","Ü","ö","Ö","ç","Ç"," ","/","*","?","ş","Ş","ı","ğ","Ğ","İ","ö","Ö","Ç","ç","ü","Ü"); $duzgun=array("s","S","i","","","","u","U","o","O","c","C","-","-","-","","s","S","i","g","G","I","o","O","C","c","u","U"); $deger=str_replace($turkce,$duzgun,$deger); $deger = preg_replace("@[^A-Za-z0-9\-_]+@i","",$deger); return $deger; }
daha sonra bu şekilde kullanabilirsin.
<a href="baslik.php?kategori=<?php echo permayap($row_goster['kategori']); ?>"><?php echo $row_goster['kategori']; ?></a></td> </tr>
ancak id üzerinden çalışmanı tavsiye ederim. bu şekilde sorun çıkar - 25-08-2010, 14:47:01Üyeliği durduruldudediğiniz gibi yaptım linkler http://localhost/baslik.php?kategori=c-o-u-287-351-305
şeklinde oldu ama içerik görünmüyor türkçe karakter kullanılanlarda diğerlernde görünüyor - 25-08-2010, 14:50:29Görünmez çünkü Dbde Kategorini Orj. ismini Sorgulatman gerek Türkçe karekterleri silersen çalışmaz o yüzden en mantıklısın dbye ya kategori için seflink tablosu açcaksın yada idle sorgulatcaksın.semidos adlı üyeden alıntı: mesajı görüntüle