I have a function to convert the url & hashtag into link
this is working fine.... But my problem is I have
in my database also URL-links + Iframes but those
are not completely visible how it should be
I tried things with call-back function
but I can not figure it out ????
So I can`t make my URL-links + Iframes visible
I hope you have some ideas ????
Code: Select all
<?php
//function to convert the url & hashtag into link
function convert_to_links($msg){
$final_message = preg_replace(array('/()#()/i'), array('<a href="$1" target="_blank">$1</a>', '$1<a href="">@$2</a>', '$1<a href="Read-Item.php?hashtag=$2">#$2</a>'), $msg);
return $final_message;
}
//if hashtag is requested
if(isset($_GET['hashtag']) && !empty($_GET['hashtag'])){
$hashtag = mysql_real_escape_string(strip_tags(trim($_GET['hashtag'])));
$query = mysql_query("SELECT * FROM politicsnucleus_item WHERE imore LIKE '%$hashtag%' ORDER BY inumber DESC");
$title = "Search Result For <span style='color:red;'>".$hashtag."</span> <a href='hashtag.php'>clear</a>";
}else{ // if not
$query = mysql_query("SELECT * FROM politicsnucleus_item ORDER BY inumber DESC LIMIT 15");
$title = "All Updates";
}
?>
<?php
echo $title;
//display the messages
if(mysql_num_rows($query) > 0){
while ($row = mysql_fetch_assoc($query)) {
$final_msg = convert_to_links($row['imore']);
echo '
<ul>
<li> '.$final_msg.'</li>
';
}
}
?>
<!--post will go here-->
</div>