如何在指向光标时隐藏真实的URL并仅显示漂亮的URL?

时间:2014-05-11 20:00:23

标签: php apache .htaccess url

我有一个图库,其中漂亮的网址在浏览器栏上工作(www.rajeevthomas.com/photos/Distant-Lands/Intensity-Of-Red/)。但是当光标指向它们时,图像和按钮(下一个和上一个图像按钮)显示真实的URL(xyz.com/viewgallery.php?cname=Distant-Lands&pcaption=Layers-Of-Light-II)页面底部)。当光标指向图像时,如何才能显示漂亮的URL?

您可以在http://rajeevthomas.com/photos/Distant-Lands/Intensity-Of-Red/

看到此信息

大图像代码是

// display previous and next links if more than one photo 

else if( $pcaption ) 
{   

mysql_query("UPDATE gallery_photos SET photo_caption = REPLACE(photo_caption,'\\\','') ");

$pcaption = str_replace("-", " ",$pcaption);
$pcaption = str_replace("%27", "'",$pcaption);
$pcaption = str_replace("\\", "",$pcaption);


$result = mysql_query( "SELECT photo_caption, photo_description, photo_filename,photo_keywords FROM gallery_photos WHERE photo_caption='".addslashes($pcaption)."'" ); 

list($photo_caption, $photo_description, $photo_filename, $photo_keywords) = mysql_fetch_array( $result ); 

$nr = mysql_num_rows( $result ); 
mysql_free_result( $result );     

$p_caption = $photo_caption;
$p_description = $photo_description;
$p_keywords = $photo_keywords;

//fill caption_array with sorted pids in current category 

$caption_array = array();
$result = mysql_query( "SELECT photo_caption FROM gallery_photos WHERE category_name='".addslashes($cname)."' " ); 
$ct = mysql_num_rows( $result ); 

while ($row = mysql_fetch_array($result)) { 

$row[0]= trim($row[0]);
$row[0] = str_replace(" ","-",$row[0]);
$row[0] = str_replace("'","%27",$row[0]);
$caption_array[] = trim($row[0]); 
} 

mysql_free_result( $result ); 

if( empty($nr ) ) 
{ 
$result_final = "\t<tr><td>***No Photo found*******</td></tr>\n"; 
} 
else 
{ 
$category_name = $cname; 
$cname = str_replace(" ", "-", $cname); 
$result_final = "
<div class=limagePage>
<div class=llink><a href=/viewgallery.php>ALBUMS</a><span class=arrow>&gt;&gt</span><a href=/viewgallery.php?cname=$cname>$category_name</a></div>
";

// display previous and next links if more than one photo 
$next=0;
$prev=0;

if ($ct > 1) 
{ 
$pcaption = trim($pcaption);
$pcaption = str_replace(" ","-",$pcaption);
$pcaption = str_replace("'","%27",$pcaption);
$key = array_search($pcaption , $caption_array); 
$prev = $key - 1; 
if ($prev < 0) $prev = $ct - 1; 
$next = $key + 1; 
if ($next == $ct) $next = 0; 
$total_count= count($caption_array);
$result_final .= "<div class='prevnext'>"; 
$result_final .= "<span class='prev'><a href=/viewgallery.php?cname=$cname&pcaption=".$caption_array[$next]."><img src=/photos/assets/left.png  border=0 ></a></span>"; 
$result_final .= "<span class='next'><a href=/viewgallery.php?cname=$cname&pcaption=".$caption_array[$prev].">
<img src=/photos/assets/right.png  border=0 ></a></span>"; 
$result_final .= "</div>";  

}            
}
$cname = str_replace(" ", "-", $cname);
$images_dir =str_replace(".","",$images_dir);
#$result_final .= "<div class=limage><table><tr><td><table class=image><tr>\n\t<td><a href=/viewgallery.php?cname=$cname&pcaption=".$caption_array[$next].">
#<img   src='".$images_dir."/".$photo_filename."' border='0' alt='".$photo_keywords."' /></a>
#<div class=caption>".$photo_caption."</div> 
#<div class='excerpt'>".$photo_description."</div> 
#</td>                    
#</tr></table></td></tr></table><div class=underline></div></div>
#<!-- .limagePage --></div> ";  

$result_final .= "<div class=limage><table><tr><td><table class=image><tr>\n\t<td><a href=/viewgallery.php?cname=$cname&pcaption=".$caption_array[$next].">
<img src='".$images_dir."/".$photo_filename."' border='0' alt='".$photo_keywords."'/></a>
<div class=caption>".$photo_caption."</div> 
<div class='excerpt'>".$photo_description."</div> 
</td>                    
</tr></table></td></tr></table><div class=underline></div></div>
<!-- .limagePage --></div>  ";  

1 个答案:

答案 0 :(得分:3)

首先链接到漂亮的网址。