Zadejte hledaný výraz...

Problem so znakmi v linku, nadpise a anotacii

Mam jeden subor kde predpokladam sa nachadza to, co mi robi vrasky. Sedim nad tym chvilu a premyslam, kde je chyba ze mi nezobrazuje znaky čšžťýá a to v:
  • Link inzeratu
  • Nadpis inzeratu
  • Anotacia k inzeratu
Ak by niekto vedel, co a kde zmenit prikladam cely subor.
Vdaka.
class itemManager{
public function getNewItems($data,$page){
$pagination = new paginationManager();
$page = $page;
$limit = 15;
if($data > 0){
$result = mysql_query("select count(*) FROM items WHERE itemStatus = 'For Sale' AND itemLocationID = '$data'");
}else{
$result = mysql_query("select count(*) FROM items WHERE itemStatus = 'For Sale'");
}//end if
$total = mysql_result($result, 0, 0);
if($total == 0){
return 'no results';
}else{
// work out the pager values
$pager = $pagination->getPagerData($total, $limit, $page);
$offset = $pager->offset;
$limit = $pager->limit;
$page = $pager->page;
$items = '';
$sub_query = "(SELECT pictureFile FROM items_pictures WHERE itemID = iID ORDER BY itemID DESC LIMIT 1) AS itemPicture";
$location_query = "(SELECT locationName FROM locations WHERE locationID = itemLocationID LIMIT 1) AS locationName";
if($data > 0){
$q = mysql_query("SELECT
itemID AS iID,
itemName,
itemLocationID,
itemAskingPrice,
itemDetails,
itemDateAdded,
$sub_query,
$location_query,
itemStatus
FROM items WHERE itemLocationID = '$data' AND itemStatus = 'For Sale' ORDER BY itemID DESC LIMIT $offset, $limit")
or die(mysql_error());
}else{
$q = mysql_query("SELECT
itemID AS iID,
itemName,
itemLocationID,
itemAskingPrice,
itemDetails,
itemDateAdded,
$sub_query,
$location_query,
itemStatus
FROM items WHERE itemStatus = 'For Sale' ORDER BY itemID DESC LIMIT $offset, $limit")
or die(mysql_error());
}//end if
while($r = mysql_fetch_array($q)){
extract($r);
if($itemPicture == ''){
$itemPicture = ''.$itemName.'';
}else{
$itemPicture = 'http://xxx/thumbnail.php?im=item_images/'.$itemPicture;
$itemPicture = ''.$itemName.'';
}//end if
$itemAskingPrice = str_replace('£','',$itemAskingPrice);
$itemName = preg_replace('//', '', $itemName);
$item_link = $this->post_slug($itemName);
//$itemDetails = strip_tags($itemDetails);
//$itemDetails = $this->post_tslug($itemDetails);
$items .= '
'.$itemPicture.'
  • '.$itemName.'
  • '.substr(strip_tags(utf8_encode($itemDetails)),0,200).'...
  • € '.$itemAskingPrice.''.$locationName.' '.date( "j. n. Y", strtotime($itemDateAdded) ).'
';
}//end while
$items .= 'Strana:
';
// output paging system (could also do it before we output the page content)
for ($i = 1; $i <= $pager->numPages; $i++) {
$items .= ' ';
if ($i == $pager->page)
$items .= ''.$i.'';
else
$items .= ''.$i.'';
};
$items .= '
';
return utf8_encode($items);
}//end if total empty
}//end function
public function remove_accent($str){
$a = array('À', 'Á', 'Â', 'Ã', 'Ä', 'Å', 'Æ', 'Ç', 'È', 'É', 'Ê', 'Ë', 'Ì', 'Í', 'Î', 'Ï', 'Ð', 'Ñ', 'Ò', 'Ó', 'Ô', 'Õ', 'Ö', 'Ø', 'Ù', 'Ú', 'Û', 'Ü', 'Ý', 'ß', 'à', 'á', 'â', 'ã', 'ä', 'å', 'æ', 'ç', 'è', 'é', 'ê', 'ë', 'ì', 'í', 'î', 'ï', 'ñ', 'ò', 'ó', 'ô', 'õ', 'ö', 'ø', 'ù', 'ú', 'û', 'ü', 'ý', 'ÿ', 'Ā', 'ā', 'Ă', 'ă', 'Ą', 'ą', 'Ć', 'ć', 'Ĉ', 'ĉ', 'Ċ', 'ċ', 'Č', 'č', 'Ď', 'ď', 'Đ', 'đ', 'Ē', 'ē', 'Ĕ', 'ĕ', 'Ė', 'ė', 'Ę', 'ę', 'Ě', 'ě', 'Ĝ', 'ĝ', 'Ğ', 'ğ', 'Ġ', 'ġ', 'Ģ', 'ģ', 'Ĥ', 'ĥ', 'Ħ', 'ħ', 'Ĩ', 'ĩ', 'Ī', 'ī', 'Ĭ', 'ĭ', 'Į', 'į', 'İ', 'ı', 'IJ', 'ij', 'Ĵ', 'ĵ', 'Ķ', 'ķ', 'Ĺ', 'ĺ', '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 'i', 'I', 'i', 'I', 'i', 'I', 'i', 'IJ', 'ij', 'J', 'j', 'K', 'k', 'L', 'l', 'L', 'l', 'L', 'l', 'L', 'l', 'l', 'l', 'N', 'n', 'N', 'n', 'N', 'n', 'n', 'O', 'o', 'O', 'o', 'O', 'o', 'OE', 'oe', 'R', 'r', 'R', 'r', 'R', 'r', 'S', 's', 'S', 's', 'S', 's', 'S', 's', 'T', 't', 'T', 't', 'T', 't', 'U', 'u', 'U', 'u', 'U', 'u', 'U', 'u', 'U', 'u', 'U', 'u', 'W', 'w', 'Y', 'y', 'Y', 'Z', 'z', 'Z', 'z', 'Z', 'z', 's', 'f', 'O', 'o', 'U', 'u', 'A', 'a', 'I', 'i', 'O', 'o', 'U', 'u', 'U', 'u', 'U', 'u', 'U', 'u', 'U', 'u', 'A', 'a', 'AE', 'ae', 'O', 'o');
return str_replace($a, $b, $str);
}//end function
public function post_slug($str){
return strtolower(preg_replace(array('//', '/+/', '/^-|-$/'),array('', '-', ''), $this->remove_accent($str)));
}//end function
public function post_tslug($str){
return strtolower(preg_replace(array('//', '/+/', '/^-|-$/'),array('', ' ', ''), $this->remove_accent($str)));
}//end function
public function getParentCategoryItems($categoryID,$data,$page){
$pagination = new paginationManager();
$page = $page;
$limit = 15;
if($data > 0){
$result = mysql_query("select count(*) FROM items WHERE itemCategoryID = '$categoryID' AND itemStatus = 'For Sale' AND itemLocationID = '$data'");
}else{
$result = mysql_query("select count(*) FROM items WHERE itemCategoryID = '$categoryID' AND itemStatus = 'For Sale'");
}//end if
$total = mysql_result($result, 0, 0);
if($total == 0){
return 'no results';
}else{
// work out the pager values
$pager = $pagination->getPagerData($total, $limit, $page);
$offset = $pager->offset;
$limit = $pager->limit;
$page = $pager->page;
$items = '';
$sub_query = "(SELECT pictureFile FROM items_pictures WHERE itemID = iID ORDER BY itemID DESC LIMIT 1) AS itemPicture";
$location_query = "(SELECT locationName FROM locations WHERE locationID = itemLocationID LIMIT 1) AS locationName";
if($data > 0){
$q = mysql_query("SELECT
itemID AS iID,
itemName,
itemLocationID,
itemAskingPrice,
itemDetails,
itemDateAdded,
$sub_query,
$location_query,
itemStatus
FROM items WHERE itemLocationID = '$data' AND itemCategoryID = '$categoryID' AND itemStatus = 'For Sale' ORDER BY itemID DESC LIMIT $offset, $limit")
or die(mysql_error());
}else{
$q = mysql_query("SELECT
itemID AS iID,
itemName,
itemLocationID,
itemAskingPrice,
itemDetails,
itemDateAdded,
$sub_query,
$location_query,
itemStatus
FROM items WHERE itemCategoryID = '$categoryID' AND itemStatus = 'For Sale' ORDER BY itemID DESC LIMIT $offset, $limit")
or die(mysql_error());
}//end if
while($r = mysql_fetch_array($q)){
extract($r);
if($itemPicture == ''){
$itemPicture = ''.$itemName.'';
}else{
$itemPicture = 'http://xxx/thumbnail.php?im=item_images/'.$itemPicture;
$itemPicture = ''.$itemName.'';
}//end if
$itemName = preg_replace('//', '', $itemName);
$item_link = $this->post_slug($itemName);
$itemAskingPrice = str_replace('£','',$itemAskingPrice);
//$itemDetails = strip_tags($itemDetails);
//$itemDetails = $this->post_tslug($itemDetails);
$items .= '
'.$itemPicture.'
  • '.$itemName.' in '.$locationName.'
  • '.substr(strip_tags(utf8_encode($itemDetails)),0,280).'...
  • € '.$itemAskingPrice.''.$locationName.' '.date( "j. n. Y", strtotime($itemDateAdded) ).'
';
}//end while
$items .= 'Strana:
';
// output paging system (could also do it before we output the page content)
for ($i = 1; $i <= $pager->numPages; $i++) {
$items .= ' ';
if ($i == $pager->page)
$items .= ''.$i.'';
else
$items .= ''.$i.'';
};
$items .= '
';
return utf8_encode($items);
}//end if mysql_num_rows
}//end function
public function getSubCategoryItems($categoryID,$data,$page){
$pagination = new paginationManager();
$page = $page;
$limit = 15;
if($data > 0){
$result = mysql_query("select count(*) FROM items WHERE itemSubCategoryID = '$categoryID' AND itemStatus = 'For Sale' AND itemLocationID = '$data'");
}else{
$result = mysql_query("select count(*) FROM items WHERE itemSubCategoryID = '$categoryID' AND itemStatus = 'For Sale'");
}//end if
$total = mysql_result($result, 0, 0);
if($total == 0){
return 'no results';
}else{
// work out the pager values
$pager = $pagination->getPagerData($total, $limit, $page);
$offset = $pager->offset;
$limit = $pager->limit;
$page = $pager->page;
$items = '';
$sub_query = "(SELECT pictureFile FROM items_pictures WHERE itemID = iID ORDER BY itemID DESC LIMIT 1) AS itemPicture";
$location_query = "(SELECT locationName FROM locations WHERE locationID = itemLocationID LIMIT 1) AS locationName";
if($data > 0){
$q = mysql_query("SELECT
itemID AS iID,
itemName,
itemLocationID,
itemAskingPrice,
itemDetails,
itemDateAdded,
$sub_query,
$location_query,
itemStatus
FROM items WHERE itemLocationID = '$data' AND itemSubCategoryID = '$categoryID' AND itemStatus = 'For Sale' ORDER BY itemID DESC LIMIT $offset, $limit")
or die(mysql_error());
}else{
$q = mysql_query("SELECT
itemID AS iID,
itemName,
itemLocationID,
itemAskingPrice,
itemDetails,
itemDateAdded,
$sub_query,
$location_query,
itemStatus
FROM items WHERE itemSubCategoryID = '$categoryID' AND itemStatus = 'For Sale' ORDER BY itemID DESC LIMIT $offset, $limit")
or die(mysql_error());
}//end if
while($r = mysql_fetch_array($q)){
extract($r);
if($itemPicture == ''){
$itemPicture = ''.$itemName.'';
}else{
$itemPicture = 'http://xxx/thumbnail.php?im=item_images/'.$itemPicture;
$itemPicture = ''.$itemName.'';
}//end if
$itemName = preg_replace('//', '', $itemName);
$item_link = $this->post_slug($itemName);
//$itemDetails = strip_tags($itemDetails);
//$itemDetails = $this->post_tslug($itemDetails);
$itemAskingPrice = str_replace('£','',$itemAskingPrice);
$items .= '
'.$itemPicture.'
  • '.$itemName.' in '.$locationName.'
  • '.substr(strip_tags(utf8_encode($itemDetails)),0,280).'...
  • € '.$itemAskingPrice.''.$locationName.' '.date( "j. n. Y", strtotime($itemDateAdded) ).'
';
}//end while
$items .= 'Strana:
';
// output paging system (could also do it before we output the page content)
for ($i = 1; $i <= $pager->numPages; $i++) {
$items .= ' ';
if ($i == $pager->page)
$items .= ''.$i.'';
else
$items .= ''.$i.'';
};
$items .= '';
return utf8_encode($items);
}//end if mysql_num_rows
}//end function
public function getItemDetails($itemID){
$return_array = array();
$q = mysql_query("SELECT * FROM items WHERE itemID = '$itemID' ORDER BY itemID DESC LIMIT 1")
or die(mysql_error());
$r = mysql_fetch_array($q);
$r = preg_replace('//', '', utf8_encode($r));
$r = $this->post_slug($r);
$r = $r.'_'.$r.'.html';
$r = date( "j. n. Y", strtotime($r));
$pictures = '';
$r = str_replace('£','',$r);
$q = mysql_query("SELECT * FROM items_pictures WHERE itemID = '$itemID' ORDER BY pictureID ASC")
or die(mysql_error());
if(mysql_affected_rows() == 0){
}else{
while($j = mysql_fetch_array($q)){
extract($j);
$itemPicture = 'http://xxx/thumbnail.php?im=item_images/'.$pictureFile;
$itemPicture = '';
$pictures .= $itemPicture;
}//end while
}//end if
$location_manager = new locationManager();
$r = $location_manager->getLocationName($r);
$r = $pictures;
//$r = strip_tags($r);
//$r = $this->post_tslug($r);
$uri = $_SERVER;
$t = mysql_query("SELECT COUNT(*) FROM logs WHERE REQUEST_URI = '$uri'");
$total = mysql_result($t, 0, 0);
$r = $total;
return $r;
}//end function
public function doSearch($data){
$q = $data;
$pagination = new paginationManager();
if(isset($data)){
$page = $data;
}else{
$page = 0;
}//end if
if($data > 0){
$l = $data;
$location = " AND itemLocationID = '$l' ";
}else{
$location = "";
}//end if
if($data > 0){
$c = $data;
$category = " AND itemCategoryID = '$c' OR itemSubCategoryID = '$c'";
}else{
$category = "";
}//end if
$limit = 15;
$cq = "select count(*) FROM items WHERE itemStatus = 'For Sale' AND itemName LIKE '%$q%' $location $category ";
$result = mysql_query($cq);
$total = mysql_result($result, 0, 0);
if($total == 0){
return 'no internal results maybe google has a link to what your looking for below. ';
}else{
// work out the pager values
$pager = $pagination->getPagerData($total, $limit, $page);
$offset = $pager->offset;
$limit = $pager->limit;
$page = $pager->page;
$items = '';
$sub_query = "(SELECT pictureFile FROM items_pictures WHERE itemID = iID ORDER BY itemID DESC LIMIT 1) AS itemPicture";
$location_query = "(SELECT locationName FROM locations WHERE locationID = itemLocationID LIMIT 1) AS locationName";
if($location > 0){
$q = mysql_query("SELECT
itemID AS iID,
itemName,
itemLocationID,
itemAskingPrice,
itemDetails,
itemDateAdded,
$sub_query,
$location_query,
itemStatus
FROM items WHERE itemStatus = 'For Sale' AND itemName LIKE '%$q%' $location $category ORDER BY itemID DESC LIMIT $offset, $limit")
or die(mysql_error());
}else{
$q = mysql_query("SELECT
itemID AS iID,
itemName,
itemLocationID,
itemAskingPrice,
itemDetails,
itemDateAdded,
$sub_query,
$location_query,
itemStatus
FROM items WHERE itemStatus = 'For Sale' AND itemName LIKE '%$q%' $location $category ORDER BY itemID DESC LIMIT $offset, $limit")
or die(mysql_error());
}//end if
while($r = mysql_fetch_array($q)){
extract($r);
if($itemPicture == ''){
$itemPicture = ''.$itemName.'';
}else{
$itemPicture = 'http://xxx.sk/thumbnail.php?im=item_images/'.$itemPicture;
$itemPicture = ''.$itemName.'';
}//end if
$itemAskingPrice = str_replace('£','',$itemAskingPrice);
$itemName = preg_replace('//', '', $itemName);
//$itemDetails = strip_tags($itemDetails);
$item_link = $this->post_slug($itemName);
$items .= '
'.$itemPicture.'
  • '.$itemName.' in '.$locationName.'
  • '.substr(strip_tags(utf8_encode($itemDetails)),0,280).'...
  • € '.$itemAskingPrice.''.$locationName.' '.date( "j. n. Y", strtotime($itemDateAdded) ).'
';
}//end while
$items .= 'Strana: ';
// output paging system (could also do it before we output the page content)
for ($i = 1; $i <= $pager->numPages; $i++) {
$items .= ' ';
if ($i == $pager->page)
$items .= ''.$i.'';
else
$items .= ''.$i.'';
};
$items .= '';
return utf8_encode($items);
}//end if total empty
}//end function
}//end class
?>
9. 12. 2012 15:40:38
https://webtrh.cz/diskuse/problem-so-znakmi-v-linku-nadpise-a-anotacii/#reply840201
Na letmy pohled funkce remove_accent ... by ti mela odstranit diakritiku. Zacal bych tedy s ni...
9. 12. 2012 16:56:22
https://webtrh.cz/diskuse/problem-so-znakmi-v-linku-nadpise-a-anotacii/#reply840200
Napsal winexec;880090
Na letmy pohled funkce remove_accent ... by ti mela odstranit diakritiku. Zacal bych tedy s ni...
Skusal som odstranit tie riadky a hned error. Ja sa v php nevyznam preto som sa pytal ci niekto nevie co kde odstranit.
---------- Příspěvek doplněn 09.12.2012 v 19:24 ----------
Dakujem @winexec za pomoc. Lock
9. 12. 2012 17:07:46
https://webtrh.cz/diskuse/problem-so-znakmi-v-linku-nadpise-a-anotacii/#reply840199
Pro odpověď se přihlašte.
Přihlásit