Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
game descriptions ambersands
11-04-2009, 04:21 PM (This post was last modified: 11-04-2009 04:25 PM by manos2000.)
Post: #1
game descriptions ambersands
Hi,

In some games at description appear ambersand glyphs like:

Climb the world's tallest monuments and reach seventh heaven!

What have to change to appear correctly?


thank you
Here after copy past appear correctly

At site eg in word world's the "'" appears as
& # 39 ; (with no spaces)
thanks
Find all posts by this user
Quote this message in a reply
11-04-2009, 07:11 PM
Post: #2
RE: game descriptions ambersands
So you want to change ' to that? htmlspecialchars function should do this, open file.php and change both
PHP Code:
$file_row['description'
to
PHP Code:
htmlspecialchars($file_row['description'], ENT_QUOTES"UTF-8"
and then change
PHP Code:
$related_row['description'
to
PHP Code:
htmlspecialchars($related_row['description'], ENT_QUOTES"UTF-8"
and then in includes/functions.php change
PHP Code:
function shorten_description($description$length) {
    if (
strlen($description) > $length) {
        if (
function_exists('mb_strtolower')) {
            return 
mb_substr($description 0, ($length 3), 'UTF-8') .'...';
        } else {
            return 
substr($description 0, ($length 3)) .'...';
        }
    } else
        return 
$description;

to
PHP Code:
function shorten_description($description$length) {
    
$description htmlspecialchars($descriptionENT_QUOTES"UTF-8");
    if (
strlen($description) > $length) {
        if (
function_exists('mb_strtolower')) {
            return 
mb_substr($description 0, ($length 3), 'UTF-8') .'...';
        } else {
            return 
substr($description 0, ($length 3)) .'...';
        }
    } else
        return 
$description;

I think this should do it.
Visit this user's website Find all posts by this user
Quote this message in a reply
11-04-2009, 07:13 PM (This post was last modified: 11-04-2009 07:28 PM by manos2000.)
Post: #3
RE: game descriptions ambersands
thanks for fast reply, will try it today and will answer here

manos
Hm, not working
Maybe i did not write correctly the question

I want description at site to appear:
' and not & # 39 ;
! and not & # 33 ;
thanks
manos
Find all posts by this user
Quote this message in a reply
11-05-2009, 04:07 AM
Post: #4
RE: game descriptions ambersands
Although not an ideal solution (depends how many you have) select edit file and then simply click save, no need to change anything, the correct characters will be applied.

[Image: dazz_sig.gif]
Visit this user's website Find all posts by this user
Quote this message in a reply
11-05-2009, 04:18 AM (This post was last modified: 11-05-2009 04:33 AM by manos2000.)
Post: #5
RE: game descriptions ambersands
Thanks for response.
Actually the problem is in printing
Although & # 39 is the ampersand for ' , it prints the ambersand code and not '

thanks anyway

manos
Maybe i was not clear enough.
So i uploaded an image to see my problem with script
http://www.imagehack.biz/onarcade.jpg

should be ' and ! and not these codes.

Any help appreciated

manos
Maybe i was not clear enough.
So i uploaded an image to see my problem with script
[Image: onarcade.jpg]

should be ' and ! and not these codes.

Any help appreciated

manos
Find all posts by this user
Quote this message in a reply
11-05-2009, 05:00 PM
Post: #6
RE: game descriptions ambersands
where do these tags come from? onArcade does not strip HTML tags in descriptions, so they should be displayed right... or have you added nohtml() function to descriptions?
Visit this user's website Find all posts by this user
Quote this message in a reply
11-05-2009, 05:33 PM
Post: #7
RE: game descriptions ambersands
No i did not add anything.
But i saw also at other sites that at same games there are the same problems in description.

thanks
manos
Find all posts by this user
Quote this message in a reply
11-05-2009, 08:04 PM (This post was last modified: 11-05-2009 08:07 PM by manos2000.)
Post: #8
RE: game descriptions ambersands
Near to solution
The problem is the "amp;" 4 characters that should not exist.
Without this the ambersand code is printing ok eg # 3 9 ; without spaces is printed as '.
So need only to add at description printing something like replace(description,"amp;","") in asp.
How is this command in php?

thanks
If not available i will write an asp script to replace at mysql all amp; with blanc

manos
Find all posts by this user
Quote this message in a reply
11-06-2009, 07:34 PM
Post: #9
RE: game descriptions ambersands
Do you have that & in your database? In that case running this query should fix it:
Code:
UPDATE on_files SET description = REPLACE(description, '&', '&');
Visit this user's website Find all posts by this user
Quote this message in a reply
11-07-2009, 05:38 AM
Post: #10
RE: game descriptions ambersands
This works, thanks Hans
Find all posts by this user
Quote this message in a reply
Post Reply 


Forum Jump:


User(s) browsing this thread: 1 Guest(s)