Droplet : newsQuote

KonTrax

Added some more features. check top post.

Martin: Is that what you meant by css?
Once you go Droplets you never go back

KonTrax

Quote from: mr-fan on May 26, 2009, 11:35:35 PM
hi Kontrax,

your Droplets are great!

i've tested both!

This one is a very goog idea! Just a few hints

1. is it possible to get random texts from all groups per default?
2. is it possible to set the css for this a href of the linked quote you can put the css in the template like in the droplet Showad? then the Linkformats are different from the template link and can styled in the droplet itself not in the template css... i don't know if this make sense?

I've set up a quick and dirty testpage online with a few entries in some news it works very well!

regards martin

Thanks martin

both features are in my notes. I'll see what can be done tomorrow. Have a lot of work to do with my site so i added it to the forum a little early just to spread the idea. I think its a great way to help visitors find content that they may not have found only by reading headlines and shorts
Once you go Droplets you never go back

mr-fan

hi Kontrax,

your Droplets are great!

i've tested both!

This one is a very goog idea! Just a few hints

1. is it possible to get random texts from all groups per default?
2. is it possible to set the css for this a href of the linked quote you can put the css in the template like in the droplet Showad? then the Linkformats are different from the template link and can styled in the droplet itself not in the template css... i don't know if this make sense?

I've set up a quick and dirty testpage online with a few entries in some news it works very well!

regards martin

KonTrax

#1
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]]



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;



FIX : Error fix when quote is not set

FIX : Now group is optional, if not supplied it will get all groups

FIX : Added multiple or all groups

PS. I will probably add more small fixes and features to this droplet later so drop back for updates
Once you go Droplets you never go back