开发者

How to Link the title

开发者 https://www.devze.com 2023-03-23 14:38 出处:网络
How can i link the title in this code. echo \"<div id=\'vblock\'>\"; echo \"<div style=\'width:130px;height:95px;float:left\'>\";

How can i link the title in this code.

 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>";

this is another code linked. its working

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">
                开发者_JAVA百科<div class="txt">'.$video['video_title'].'</div>
                </div></a>';
    }
    ?>    

Thanks in advance.


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>";

It aint pretty though. All you need to do is wrap the anchor:

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

Around the title in the string. Because you are reusing the anchor href and it's quite a long one I would favour setting a variable to the href value then using the variable for clarity.

0

精彩评论

暂无评论...
验证码 换一张
取 消