16/01/2013, 19:47
|
| | Fecha de Ingreso: marzo-2008
Mensajes: 228
Antigüedad: 16 años, 8 meses Puntos: 12 | |
Respuesta: Ignorar caracter de un termino de busqueda en un buscador php Music.php
Código:
<?php include('header_music.php');?>
<div class="container">
<div class="left">
<?php
$mp3name = preg_replace("![^a-z0-9]+!i", "_", $search);
$mp3name = strtolower($mp3name);
include('includes/simple_html_dom.php');
$html = file_get_html('http://mp3skull.com/mp3/'.$mp3name.'.html');
$list = array();
foreach ( $html->find('div#song_html ') as $e ) {
$song = array();
$song['bit'] = preg_replace('!\s+!', ' ',$e->find('div', 0)->plaintext);
$song['title'] = preg_replace('!\s+!', ' ',$e->find('div', 1)->plaintext);
$song['url'] = preg_replace('!\s+!', ' ',$e->find('a', 0)->href);
$list[] = $song;
}
echo'<div class="search-title">'.$search.'</div>';
echo'<ul id="items">';
if ($list==NULL){
echo '<div class="song-list">';
echo '<div class="error">We could not find any music for the term <strong>'.$search.'</strong>. This content maybe removed due to copyrights owners request.</div>';
echo '</div>';
}else{
$remove = array("mp3", "Download", "Play", "Embed", "Send Ringtone");
foreach ($list as $p){
$mTitle = str_replace($remove, "", $p['title']);
$str = strlen ($mTitle);
if ($str > 50) {
$MusicTitle = substr($mTitle,0,50).'...';
}else{
$MusicTitle = $mTitle;}
?>
<li>
<div class="song-list">
<div class="songInfo"><?php echo $p['bit'];?></div>
<div class="songTitle"><?php echo $MusicTitle;?></div>
<div class="bttomBar">
<div class="btns">
<a href="<?php echo $p['url'];?>" target="_blank" class="orange">Download</a>
</div>
<div class="mplayer">
<object type="application/x-shockwave-flash" data="dewplayer.swf?mp3=<?php echo $p['url'];?>" width="200" height="20" id="dewplayer"><param name="wmode" value="transparent" /><param name="movie" value="dewplayer.swf?mp3=<?php echo $p['url'];?>" /></object>
</div>
</div><!--bttomBar-->
</div><!--song-list-->
</li>
<?php }
}
$addSearch = mysql_real_escape_string($search);
mysql_query("INSERT INTO search (term) VALUES('$addSearch') ")
or die(mysql_error());
?>
</ul>
<script type="text/javascript">
jQuery(function($){
$('ul#items').easyPaginate({
step:15
});
});
</script>
</div><!--left-->
<div class="right">
<div class="share-box">
<span class='st_facebook_large' displayText='Facebook'></span>
<span class='st_twitter_large' displayText='Tweet'></span>
<span class='st_myspace_large' displayText='MySpace'></span>
<span class='st_stumbleupon_large' displayText='StumbleUpon'></span>
<span class='st_email_large' displayText='Email'></span>
<span class='st_sharethis_large' displayText='ShareThis'></span>
</div>
<div class="clear"></div>
<div class="right-box"><?php echo $adrow['ad1'];?></div>
<div class="right-box">
<div class="facebookOuter">
<div class="facebookInner">
<div class="fb-like-box"
data-width="300" data-height="266"
data-href="<?php echo $settings['fbpage'];?>"
data-border-color="#F4F4F4" data-show-faces="true"
data-stream="false" data-header="false">
</div>
</div>
</div>
</div><!--end right-box-->
<div class="right-box"><?php echo $adrow['ad1'];?></div>
<div class="right-box">
<div class="followus">Follow Us On</div>
<a class="fb" href="<?php echo $settings['fbpage'];?>"><img src="images/facebook_normal.png" width="77" height="20"></a>
<a class="twit" href="<?php echo $settings['twitter'];?>"><img src="images/twitter_normal.png" width="77" height="20"></a>
<a class="gplus" href="<?php echo $settings['gplus'];?>"><img src="images/googleplus_normal.png" width="77" height="20"></a>
<div class="space"></div>
</div><!--end follow-->
</div><!--end right-->
</div><!--container-->
<?php include('footer.php');?>
|