
12-13-2011, 10:47 AM
|
|
Junior Guru Wannabe
|
|
Join Date: Mar 2010
Posts: 76
|
|
new question about stripslashes
Hello friends,
I started this week learning PHP reading some tutorials, so Im very newbie in this...
Can someone tell me how can I display full title inside the title="" ?
I tried change this:
PHP Code:
title=\"" . stripslashes( $title ) . "\"
to this:
PHP Code:
title=\"" . $title . "\"
but didnt work...
what I am doing wrong?
Here is the complete code:
PHP Code:
if( dle_strlen( $row['title'], $config['charset'] ) > 30 ) $title = dle_substr( $row['title'], 0, 30, $config['charset'] ) . " ...";
else $title = $row['title'];
$link = "<a href=\"" . $full_link . "\" title=\"" . stripslashes( $title ) . "\">" . stripslashes( $title ) . "</a>";
$topnews .= "<li>" . $link . "</li>";
}
Thank you 
|

12-13-2011, 11:03 AM
|
|
Web Hosting Master
|
|
Join Date: Nov 2011
Location: EU
Posts: 609
|
|
the stripslashes function just remove the slashes added by the addslashes function... as i can see from your complete code section, i believe that you're getting that info from a database... did you change something above that section that is preventing the title variable to be populated?
__________________
SpiderVPS
Cheap, but HUGE... (usually UNManaged VPS)
|

12-13-2011, 11:05 AM
|
|
Junior Guru Wannabe
|
|
Join Date: Mar 2010
Posts: 76
|
|
thank you for your reply silasistefan.
hmmm here is the full code:
PHP Code:
<?php
if( ! defined( 'DATALIFEENGINE' ) ) {
die( "Hacking attempt!" );
}
$topnews = dle_cache( "topnews", $config['skin'] );
if( $topnews === false ) {
$this_month = date( 'Y-m-d H:i:s', $_TIME );
$db->query( "SELECT id, title, date, alt_name, category, flag FROM " . PREFIX . "_post WHERE approve='1' AND date >= '$this_month' - INTERVAL 1 MONTH AND date < '$this_month' ORDER BY rating DESC, comm_num DESC, news_read DESC, date DESC LIMIT 0,10" );
while ( $row = $db->get_row() ) {
$row['date'] = strtotime( $row['date'] );
$row['category'] = intval( $row['category'] );
if( $config['allow_alt_url'] == "yes" ) {
if( $row['flag'] and $config['seo_type'] ) {
if( $row['category'] and $config['seo_type'] == 2 ) {
$full_link = $config['http_home_url'] . get_url( $row['category'] ) . "/" . $row['id'] . "-" . $row['alt_name'] . ".html";
} else {
$full_link = $config['http_home_url'] . $row['id'] . "-" . $row['alt_name'] . ".html";
}
} else {
$full_link = $config['http_home_url'] . date( 'Y/m/d/', $row['date'] ) . $row['alt_name'] . ".html";
}
} else {
$full_link = $config['http_home_url'] . "index.php?newsid=" . $row['id'];
}
if( dle_strlen( $row['title'], $config['charset'] ) > 30 ) $title = dle_substr( $row['title'], 0, 30, $config['charset'] ) . " ...";
else $title = $row['title'];
$link = "<a href=\"" . $full_link . "\" title=\"" . stripslashes( $title ) . "\">" . stripslashes( $title ) . "</a>";
$topnews .= "<li>" . $link . "</li>";
}
$db->free();
create_cache( "topnews", $topnews, $config['skin'] );
}
?>
|

12-13-2011, 11:11 AM
|
|
Web Hosting Master
|
|
Join Date: Nov 2011
Location: EU
Posts: 609
|
|
i would do the following change in order to further debug:
instead of
Quote:
|
$db->query( "SELECT id, title, date, alt_name, category, flag FROM " . PREFIX . "_post WHERE approve='1' AND date >= '$this_month' - INTERVAL 1 MONTH AND date < '$this_month' ORDER BY rating DESC, comm_num DESC, news_read DESC, date DESC LIMIT 0,10" );
|
i would put this
Quote:
$tmpquery = "SELECT id, title, date, alt_name, category, flag FROM " . PREFIX . "_post WHERE approve='1' AND date >= '$this_month' - INTERVAL 1 MONTH AND date < '$this_month' ORDER BY rating DESC, comm_num DESC, news_read DESC, date DESC LIMIT 0,10";
echo $tmpquery;
$db->query( $tmpquery );
|
in the webpage you should get the SQL query that you're executing. Copy & paste that in an MySQL console and see if you have the title in the table... if you don't, you found your issue...
__________________
SpiderVPS
Cheap, but HUGE... (usually UNManaged VPS)
|

12-13-2011, 11:17 AM
|
|
Junior Guru Wannabe
|
|
Join Date: Mar 2010
Posts: 76
|
|
thank you 
|
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Linear Mode
|
| Postbit Selector |
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
|
|
| Login: |
|
|
| Advertisement: |
|
|
| Web Hosting News: |
|
|
|