Welcome, Guest. Please login or register.
Did you miss your activation email?
May 25, 2012, 12:43:46 PM

Login with username, password and session length
Search:     Advanced search
Interested in joining the WebsiteBaker team?
For more Information read here or on our new website.
155504 Posts in 21710 Topics by 7736 Members
Latest Member: deenangle
* Home Help Search Login Register
Pages: [1]   Go Down
Print
Author Topic: Droplet : newsQuote  (Read 1082 times)
KonTrax

Offline Offline

Posts: 21



WWW
« on: May 25, 2009, 04:59:19 PM »

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;


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
« Last Edit: May 29, 2009, 02:08:40 AM by KonTrax » Logged

Once you go Droplets you never go back
mr-fan

Offline Offline

Posts: 1556


WWW
« Reply #1 on: May 26, 2009, 10: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
Logged

 
KonTrax

Offline Offline

Posts: 21



WWW
« Reply #2 on: May 27, 2009, 02:32:46 AM »

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
Logged

Once you go Droplets you never go back
KonTrax

Offline Offline

Posts: 21



WWW
« Reply #3 on: May 29, 2009, 02:10:22 AM »

Added some more features. check top post.

Martin: Is that what you meant by css?
Logged

Once you go Droplets you never go back
Pages: [1]   Go Up
Print
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.16 | SMF © 2011, Simple Machines Valid XHTML 1.0! Valid CSS!