Go Back   Pligg Forum > Pligg Help > Pligg Tutorials
Reply
 
LinkBack Thread Tools Display Modes
  #31 (permalink)  
Old 09-30-2007, 02:02 PM
AnAlienHolakres3's Avatar
AnAlienHolakres3 AnAlienHolakres3 is offline
Send a message via ICQ to AnAlienHolakres3
Pligg Developer
 
Join Date: Jul 2007
Location: Prague
Posts: 117
Downloads: 24
Uploads: 1
Thanks: 7
Thanked 111 Times in 40 Posts
Customized code contributing mechanism

Quote:
Originally Posted by plador View Post
Is there any mechanism by which users can contribute customized code ?
I dont think there is something like this, but to be honest I can not say certainly.
There is something else - if you contribute some (unspecific) value of money we will know you do something for community. Then you can expect we will be more willing to provide specific code for you. One way or another it is our goodwill:)
__________________
=Everything that has a beginnig has an end=
=Nevere stop fighting=

Site: http://www.vselink.org
Reply With Quote
Sponsored Links
Check out the New Templates at the Pligg Pro Shop.
  #32 (permalink)  
Old 10-13-2007, 03:50 PM
SoapTaco's Avatar
SoapTaco SoapTaco is offline
Send a message via Skype™ to SoapTaco
Casual Pligger
Pligg Version: 9.9.0
Pligg Template: All
 
Join Date: Nov 2006
Location: Detroit, MI
Posts: 80
Downloads: 11
Uploads: 0
Thanks: 11
Thanked 2 Times in 2 Posts
This is a great addition!

But,
Has anyone noticed the alignment issue in IE for the RSS and arrow icons? It shows fine in FF but IE places a gap before the first listing, at least it has on any site I have tried to use it.

I went through all of the code trying to find out what it could be and I can't figure it out.
Reply With Quote
  #33 (permalink)  
Old 10-13-2007, 11:32 PM
not2serious's Avatar
not2serious not2serious is offline
Pligg Donor
Pligg Version: v0.96 w/modifications
Pligg Template: Yget w/modifications
 
Join Date: Apr 2007
Location: East Coast, USA
Posts: 226
Downloads: 29
Uploads: 0
Thanks: 16
Thanked 16 Times in 15 Posts
Quote:
Originally Posted by SoapTaco View Post
This is a great addition!

But,
Has anyone noticed the alignment issue in IE for the RSS and arrow icons? It shows fine in FF but IE places a gap before the first listing, at least it has on any site I have tried to use it.

I went through all of the code trying to find out what it could be and I can't figure it out.
I have noticed this problem with several sites that have upgraded to v0.98. Search the threads and you will see the posts. I do not think it is specifically caused by this mod. I have not implement this ... yet. But, plan to in the near future.
__________________
My Pligg Site: Critique My Art
My Arts Directory: Links 2 Arts
Reply With Quote
  #34 (permalink)  
Old 10-22-2007, 12:46 PM
jatboy26 jatboy26 is offline
New Pligger
 
Join Date: Oct 2007
Posts: 10
Downloads: 20
Uploads: 0
Thanks: 0
Thanked 1 Time in 1 Post
Disable Counts?

Is there a way to disable counts for categories and subcategories? Basically if I use your code I get to see for example Entertainment [5/12]

I would like to disable the [5/12] as it may be increasing my server load and slowing down my site. Kindly suggest.


Quote:
Originally Posted by AnAlienHolakres3 View Post
Hello people. Today i would like to tell you something about sidebar categories addon. This tutorial is suitable especially for people who would like to have many categories and they want to have them in sidebar.

Basically there are 2 problems:
- too many categories = too much worthspace in sidebar, despite the fact user can scroll categories down it is still not good
- if you use background in categories sidebar (default=yes), then you have to resize this background when you use many categories

My solution is simple to understand and resolve both problems above. Every root category (which is category that has at least one subcategory) has a button (next to the rss button). With this button is possible to show and to hide subcategories. All right, stop talking, there is an example:



As you can see in the picture, there are some categories level1. When we click on the button on the right side (the button with arrow) on category level1_b, subcategories will show.

Subcategory can be also root category - if you like to have more-level subcategories.


Summary features:
- hiding subcategories as a default, possibility quickly show them just with mouse click on button
- multi subcategories supported
- possibility to change icon of hiding button (come on guys, be a little creative:))
- EASY implementation

Requirements:
- Notepad++ or any good app to edit smarty (tpl) file in it
- Pligg v97 or v98.
- yget template (but it may be possible to implement with a little customization into another).

Downloads:
There are the neccessary icons, you can copy them in your yget/images folder:
http://vselink.org/downloads/scroll_down.ico
http://vselink.org/downloads/scroll_down_hover.ico
http://vselink.org/downloads/scroll_up.ico
http://vselink.org/downloads/scroll_up_hover.ico
You are also welcome to change them if you like.


Steps to do:
1) Please backup and open file categories.tpl in your ../templates/yget/sidebar_modules/ folder. Replace ALL code with this:

[Version 0.97]
There is a difference between version 0.98 and 0.97. I use 0.97 (but i added some pictures descriptions as in v 0.98,this definitely will not appear in functionality changes) so there is code for version 0.97 of Pligg:
PHP Code:
   {php}  
//********************************************************************************************
// This file is for VERSION 0.97 ONLY!. (categories.tpl)
//Customized by AnAlienHolakres3 for Pligg Comunity. No warranty,Free of charge
//********************************************************************************************
       
function set_root_smart() {
       global 
$main_smarty;
        
$root_id=Array();
        
$array tree_to_array(0table_categories);
            
//get array of categories
            
foreach ($array as $cat) {
                
$cat_id[]=$cat['auto_id'];
                
            }     
           
//get array of subcategories 
            
foreach ($array as $subcat) {              
                
$cat_parent[]=$subcat['parent'];
                
            }   
             
//compare and set root ids  
             
foreach ($cat_id as $category_id){
              foreach (
$cat_parent as $category_parent){
                if (
$category_id && $category_parent) {      
                 if (
$category_id==$category_parent) {      
                   if(!
in_array($category_id,$root_id)) {
                   
$root_id[] = $category_id;
                
                 }
               }
             }        
           }              
       }
            
       
$main_smarty->assign('root_id',$root_id);
       return 
$root_id;
     }
     
     
set_root_smart(); 
     
   {/
php}   
   
   
<
div class="tlb">
    {
php}
        echo 
"<span><a onclick=\"new Effect.toggle('cats','blind', {queue: 'end'}); \"> <img src=\"".my_pligg_base."/templates/".The_Template."/images/expand.png\"></a></span>";
    {/
php}
    <
a href="#">{#PLIGG_Visual_Category_Title#}</a>
</div>

<
div id="cats" style="padding-bottom:1px">
    <
ul class="nav-secondary">  
        {
section name=thecat loop=$cat_array start=1}

            {if 
$cat_array[thecat].spacercount lt $lastspacer}{$cat_array[thecat].spacerdiff|repeat_count:'</ul>''</div>'}{/if}
            {if 
$cat_array[thecat].spacercount gt $lastspacer}<ul>{/if}

            <
a href="{$URL_rsscategory, $cat_array[thecat].auto_id}" target="_blank" style="border:none;">      
            <
img src="{$my_pligg_base}/templates/{$the_template}/images/rss.gif" border="0" style="float:right;padding-right:7px;"></a>
                    
                        
                        {
section name=root2 loop=$root_id start=0}
                        {if 
$cat_array[thecat].auto_id eq $root_id[root2]}   
                          
                       <
img id="picroot{$cat_array[thecat].auto_id}"style="float:right;padding-right:7px;margin-top:1px;width:18px;height:14px" src="../templates/yget/images/scroll_down.ico" width="18" height="14" 
                        
onmouseover="this.src='../templates/yget/images/scroll_down_hover.ico';this.width='18';this.height='14'" onmouseout="this.src='../templates/yget/images/scroll_down.ico';this.width='18';this.height='14'" onmousedown="document.getElementById('subcat{$cat_array[thecat].auto_id}').style.display='';document.getElementById('picrootU{$cat_array[thecat].auto_id}').style.display='';this.style.display='none'"
                       
                       <
img id="picrootU{$cat_array[thecat].auto_id}"style="float:right;padding-right:7px;margin-top:1px;display:none;width:18px;height:14px" src="../templates/yget/images/scroll_up.ico" width="18" height="14" 
                        
onmouseover="this.src='../templates/yget/images/scroll_up_hover.ico';this.width='18';this.height='14'" onmouseout="this.src='../templates/yget/images/scroll_up.ico';this.width='18';this.height='14'" onmousedown="document.getElementById('subcat{$cat_array[thecat].auto_id}').style.display='none';document.getElementById('picroot{$cat_array[thecat].auto_id}').style.display='';this.style.display='none'"
                          {/if}                                     
                          {/
section}   
                        
                            
            
                    {if 
$pagename eq "published"
                       
                       
                    
                        {
section name=root loop=$root_id start=0}
                        {if 
$cat_array[thecat].auto_id eq $root_id[root]}                                                                                                
                        <
a href="{$URL_maincategory, $cat_array[thecat].safename}" style="padding-bottom:5px;">{$cat_array[thecat].name}</a
                        <
div id="subcat{$cat_array[thecat].auto_id}" style="display:none">   
                        {
assign var=root_category value=$cat_array[thecat].auto_id}      
                        {/if}                       
                        {/
section}  
                        
             
                        {if 
$cat_array[thecat].auto_id neq $root_category}  
                         <
a href="{$URL_maincategory, $cat_array[thecat].safename}" style="padding-bottom:5px">{$cat_array[thecat].name}</a>  
                         {/if}
                      
                     
                        {else}  
                        
                        {
section name=root loop=$root_id start=0}
                        {if 
$cat_array[thecat].auto_id eq $root_id[root]}                                                                                                
                        <
a href="{$URL_queuedcategory, $cat_array[thecat].safename}" style="padding-bottom:5px;">{$cat_array[thecat].name}</a
                        <
div id="subcat{$cat_array[thecat].auto_id}" style="display:none">   
                        {
assign var=root_category value=$cat_array[thecat].auto_id}      
                        {/if}                       
                        {/
section}  
                        
             
                        {if 
$cat_array[thecat].auto_id neq $root_category}  
                         <
a href="{$URL_queuedcategory, $cat_array[thecat].safename}" style="padding-bottom:5px">{$cat_array[thecat].name}</a>  
                         {/if}
                        
                  
                        {/if}
               
                                                   
                    
                    
                    
                    </
li>      
            
            {
assign var=lastspacer value=$cat_array[thecat].spacercount}
        {/
section}
    </
ul>
</
div
[PART 2 OF THIS TUTORIAL IN NEXT POST]
Reply With Quote
  #35 (permalink)  
Old 10-23-2007, 07:18 PM
jatboy26 jatboy26 is offline
New Pligger
 
Join Date: Oct 2007
Posts: 10
Downloads: 20
Uploads: 0
Thanks: 0
Thanked 1 Time in 1 Post
Fixed it myself.

I guess I am learning PHP and learning it well now (I am not even missing PERL anymore). Well I commented out all the code shown before. Now I am back in control. While it was a great feature it really killed the performance on my site. So I had to get rid of it. I am still using the categories/subcategories feature and it works like charm. Now only I wish if I could figure out how to take the background color out of this table since I am getting some whitespace :)

//get num of links in root category (and its subcats) (ALL-ALWAYS)
// foreach ($roots as $roots_id){
// $root_count_array_total[$roots_id->category_id]=
// $db->get_var("SELECT count(link_id) FROM ".table_links." WHERE link_category=".$roots_id->category_id.
// " OR link_category IN (SELECT distinct subcat.category_id FROM ".table_categories.
// " JOIN ".table_categories." subcat ON subcat.category_parent=".table_categories.
// ".category_id WHERE ".table_categories.".category_id=".$roots_id->category_id.
// " UNION SELECT distinct subcat2.category_id FROM ".table_categories.
// " JOIN ".table_categories." subcat ON subcat.category_parent=".table_categories.".catego ry_id".
// " JOIN ".table_categories." subcat2 ON subcat2.category_parent=subcat.category_id".
// " WHERE ".table_categories.".category_id=".$roots_id->category_id.")");

//the same,but only PUBLISHED
// if ($status_mode=="published"){
// $root_count_array[$roots_id->category_id]=
// $db->get_var("SELECT count(link_id) FROM ".table_links." WHERE link_status=3 AND (link_category=".$roots_id->category_id.
// " OR link_category IN (SELECT distinct subcat.category_id FROM ".table_categories.
// " JOIN ".table_categories." subcat ON subcat.category_parent=".table_categories.
// ".category_id WHERE ".table_categories.".category_id=".$roots_id->category_id.
// " UNION SELECT distinct subcat2.category_id FROM ".table_categories.
// " JOIN ".table_categories." subcat ON subcat.category_parent=".table_categories.".catego ry_id".
// " JOIN ".table_categories." subcat2 ON subcat2.category_parent=subcat.category_id".
// " WHERE ".table_categories.".category_id=".$roots_id->category_id."))");

//the same,but only QUEUED
// }elseif ($status_mode=="queued"){
// $root_count_array[$roots_id->category_id]=
// $db->get_var("SELECT count(link_id) FROM ".table_links." WHERE link_status=2 AND (link_category=".$roots_id->category_id.
// " OR link_category IN (SELECT distinct subcat.category_id FROM ".table_categories.
// " JOIN ".table_categories." subcat ON subcat.category_parent=".table_categories.
// ".category_id WHERE ".table_categories.".category_id=".$roots_id->category_id.
// " UNION SELECT distinct subcat2.category_id FROM ".table_categories.
// " JOIN ".table_categories." subcat ON subcat.category_parent=".table_categories.".catego ry_id".
// " JOIN ".table_categories." subcat2 ON subcat2.category_parent=subcat.category_id".
// " WHERE ".table_categories.".category_id=".$roots_id->category_id."))");

//all
// }else {
// $root_count_array=$root_count_array_total;
// }
// }
//compare and set root ids with subcats




Quote:
Originally Posted by jatboy26 View Post
Is there a way to disable counts for categories and subcategories? Basically if I use your code I get to see for example Entertainment [5/12]

I would like to disable the [5/12] as it may be increasing my server load and slowing down my site. Kindly suggest.
Reply With Quote
  #36 (permalink)  
Old 10-30-2007, 12:03 PM
Divisive Cotton's Avatar
Divisive Cotton Divisive Cotton is offline
Pligg Donor
 
Join Date: Sep 2007
Posts: 221
Downloads: 15
Uploads: 0
Thanks: 2
Thanked 12 Times in 7 Posts
Quote:
Originally Posted by not2serious View Post
I have noticed this problem with several sites that have upgraded to v0.98. Search the threads and you will see the posts. I do not think it is specifically caused by this mod. I have not implement this ... yet. But, plan to in the near future.
Has anybody managed to find a solution to this yet.

The code has, slightly but noticeably, broken the layout in the sidebar in both ie and firefox.
Reply With Quote
  #37 (permalink)  
Old 10-30-2007, 12:22 PM
Divisive Cotton's Avatar
Divisive Cotton Divisive Cotton is offline
Pligg Donor
 
Join Date: Sep 2007
Posts: 221
Downloads: 15
Uploads: 0
Thanks: 2
Thanked 12 Times in 7 Posts
Added to that - I've just changed the order of the sidebar and fixed the Firefox problem, but still getting problems in IE as laid out above.
Reply With Quote
  #38 (permalink)  
Old 10-30-2007, 01:11 PM
Divisive Cotton's Avatar
Divisive Cotton Divisive Cotton is offline
Pligg Donor
 
Join Date: Sep 2007
Posts: 221
Downloads: 15
Uploads: 0
Thanks: 2
Thanked 12 Times in 7 Posts
Sorted the problems.

Added "px" to all the values and for Opera I changed the ICO files to PNG - obviously Opera doesn't like ICOn files just as much as IE6 doesn't like the inclusion of image files without fixed dimensions.

Edit: Same IE6 problems again. Ahhhhh!
Reply With Quote
  #39 (permalink)  
Old 10-31-2007, 10:54 AM
Divisive Cotton's Avatar
Divisive Cotton Divisive Cotton is offline
Pligg Donor
 
Join Date: Sep 2007
Posts: 221
Downloads: 15
Uploads: 0
Thanks: 2
Thanked 12 Times in 7 Posts
ahhh... this is too buggy... gonna have to kiss it good bye...
Reply With Quote
  #40 (permalink)  
Old 11-02-2007, 08:56 AM
AnAlienHolakres3's Avatar
AnAlienHolakres3 AnAlienHolakres3 is offline
Send a message via ICQ to AnAlienHolakres3
Pligg Developer
 
Join Date: Jul 2007
Location: Prague
Posts: 117
Downloads: 24
Uploads: 1
Thanks: 7
Thanked 111 Times in 40 Posts
Quote:
Originally Posted by jatboy26 View Post
Is there a way to disable counts for categories and subcategories? Basically if I use your code I get to see for example Entertainment [5/12]

I would like to disable the [5/12] as it may be increasing my server load and slowing down my site. Kindly suggest.
If you havent hunderts of categories there is no reason why this could affect your server significantly. If you preffer having this without displaying count of links, try to use lower version 0.2 Sidebar Categories Enhancement AddOn

Please do not quote the whole post if it is long
__________________
=Everything that has a beginnig has an end=
=Nevere stop fighting=

Site: http://www.vselink.org
Reply With Quote
Reply



Thread Tools