WB: Droplet: newsQuote

PHP
Posted by BeA (KonTrax) on 25 May 2009
Scripts >> PHP


Lets you extract clickable quote from random news long text

Just put <!--siteQuote--> before and after the part of the longtext you want to be quoted (in source mode)

go to www.kontrax.net for example of use. (upper right corner)

Use class "siteQuote" for css

All groups Example:
[[ newsQuote ]]

One group Example:
[[ newsQuote?group=2 ]]

Multi group Example: ( seperate groups with , )
[[ newsQuote?group=2,5 ]]

 

 

Code :

if(isset($group)){
     if(stripos($group, ',') === false){
          $group =" AND group_id=".$group;
     }else{
          $mod_params = explode(',', $group);
          $group =" AND group_id IN (".$mod_params[0];
          for($i=1; $i<count($mod_params); $i++){
                    $group .=", ".$mod_params[$i];
          }
          $group .=")";
     }
}else{
     $group = '';
}
global $database, $wb;
$mod_query = $database->query("SELECT title, link, content_long FROM ".TABLE_PREFIX.
"mod_news_posts WHERE active='1'".$group.
" ORDER BY RAND() LIMIT 1");
$mod_list = " ";

while ( $row =& $mod_query->fetchRow()){
  
  $mod_randomQuote = explode('<!--siteQuote-->', $row["content_long"]);
  
  if(isset($mod_randomQuote[1])){
     $mod_list = '<a class="siteQuote" href="'.WB_URL.PAGES_DIRECTORY.$row["link"].PAGE_EXTENSION.'" ';
     $mod_list .= 'title="'.$row["title"].'">';
     $mod_list .= $mod_randomQuote[1];
     $mod_list .= '</a>';
  }
}
return $mod_list;

 



Last changed: 16 Jun 2009 at 21:25

Back




Comments

Ingen funnet

Add Comment
Mouse Eye Tracking by PicNet Software Development Services