2011-07-26 10 views
1

このコードでタイトルをリンクするにはどうすればよいですか?タイトルをリンクする方法

echo "<div id='vblock'>"; 
     echo "<div style='width:130px;height:95px;float:left'>"; 
      echo '<a class="bloc_ca" href="'.$video['video_id'].'_'.str_replace(" ","-",substr(html_entity_decode($video['video_title']),0,20)).'.html"><img src="'.$thumb.'" alt="'.$vtit.'" width="120" height="90"></a></div>'; 
    echo "<div class='cvtitle'> 
     <div><b>".html_entity_decode(substr($video['video_title'],0,100))."..</b></div> 
     <div class='cvdisc'><span style='word-break:wrap'>".html_entity_decode(substr($video['video_desc'],0,100))."</span></div> 
     <div class='cvviews'> View Count: <b>".$video['views']."</b></div></div></div>"; 

これは別のコードにリンクされています。その作業

echo '<a class="a_bloc" href="'.$video['video_id'].'_'.str_replace(" ","-",substr(html_entity_decode($video['video_title']),0,20)).'.html"> 
       <div class="bloc"> 
       <img src="'.$thumb.'" alt="'.$vtit.'" height="60" width="80"> 
       <div class="txt">'.$video['video_title'].'</div> 
       </div></a>'; 
    } 
    ?>  

ありがとうございます。

+0

あなたは何を求めていますか?文字通りアンカータグを使用する方法はあなたのコードの他の部分...私はあなたの質問に従っていません。 – Brad

答えて

0
echo "<div id='vblock'>"; 
echo "<div style='width:130px;height:95px;float:left'>"; 
echo '<a class="bloc_ca" href="'.$video['video_id'].'_'.str_replace(" ","-",substr(html_entity_decode($video['video_title']),0,20)).'.html"><img src="'.$thumb.'" alt="'.$vtit.'" width="120" height="90"></a></div>'; 
echo "<div class='cvtitle'><div><a class="bloc_ca" href="'.$video['video_id'].'_'.str_replace(" ","-",substr(html_entity_decode($video['video_title']),0,20)).'.html"><b>".html_entity_decode(substr($video['video_title'],0,100))."..</b></a></div><div class='cvdisc'><span style='word-break:wrap'>".html_entity_decode(substr($video['video_desc'],0,100))."</span></div><div class='cvviews'> View Count: <b>".$video['views']."</b></div></div></div>"; 

かなりかかります。

<a class="bloc_ca" href="'.$video['video_id'].'_'.str_replace(" ","-",substr(html_entity_decode($video['video_title']),0,20)).'.html">YOUR LINK TEXT</a> 

文字列内のタイトルの周りにアンカーをラップするだけです。あなたはアンカーhrefを再利用しているので、かなり長いものですが、変数をhref値に設定してから、明快にするために変数を使用することをお勧めします。

+0

このコードを試してみましたが、ここではclass = "bloc_ca"がコードとして動作しています.Dreamweaverを置くと "bloc_caは黒で強調表示されます" – maxlk

+0

echoステートメントで一重引用符を使用しましたか? –

関連する問題