Go Back   Pligg CMS Forum > Pligg Development > Pligg Mods

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 01-06-2007, 11:40 AM
Casual Pligger
 
Join Date: Oct 2006
Posts: 33
Thanks: 1
Thanked 3 Times in 2 Posts
new category code - improvements?

Can someone please talk me through the new category selection/editing code in v0.9?

Here it is from the editlink_edit_center.tpl of mollio-beat:

Code:
<ul id="category" class="column-list">
  {section name=thecat loop=$cat_array}
    {if $cat_array[thecat].spacercount lt $lastspacer}{$cat_array[thecat].spacerdiff|repeat_count:'</ul>'}{/if}
    {if $cat_array[thecat].spacercount gt $lastspacer}<ul class="column-list">{/if}
    <li>{$cat_array[thecat].spacercount|repeat_count:'&nbsp;&nbsp;'}
      <input name="category" type="radio" id="select-i" value="{$cat_array[thecat].auto_id}"
        {if $cat_array[thecat].auto_id eq $submit_category} checked{/if}/>
        {$cat_array[thecat].name}
    </li>
    {assign var=lastspacer value=$cat_array[thecat].spacercount}
  {/section}
</ul>
I want to do 2 things, 1) clean up the code, and 2) remove the radio buttons from the parent categories.

The code when rendered is a mess - why are nonbreaking spaces being used for layout? Visually, the categories and sub categories are a list within a list, and the code really should reflect that.

What it should look like is this - excuse the pseudo code:

Code:
<ul>
  <li>Parent category
    <ul>
      <li>Sub category</li>
      <li>Sub category</li>
    </ul>
  </li>
  <li>Next Parent category
    <ul>
      <li>more sub cats</li>
      <li>and even more</li>
    </ul>
  </li>
</ul>
Then the amount of indent etc can be controlled with simple CSS, and everything is much cleaner.

Secondly, I dont want users to be able to submit stories into the top level categories. That is what the sub cats are for.

If I could get some help with the above code, I think I could figure that out myself, but at the moment the above is too hard for me to unpick.

For example, what are spacercount, $lastspacer and repeat_count? I know that something in there is adding 2 nonbreaking spaces for each level of the category (2 for top level, 4 for next etc), but I can't figure out what to change to remove the radio button for the top level.

If anyone can help me with this, it'd be greatly appreciated.
Reply With Quote
  #2 (permalink)  
Old 01-06-2007, 11:56 AM
kbeeveer46's Avatar
Pligg Developer/Admin
Pligg Version: 0
Pligg Template: none
 
Join Date: Jun 2006
Location: Muncie, Indiana
Posts: 3,579
Thanks: 255
Thanked 651 Times in 515 Posts
If you'd like to have a drop down box like digg check out the same file but in the digital nature template. When I get a chance I'll try and explain the code you pasted above.
__________________
I accept donations for my time helping users like you on the forum and IRC.
Reply With Quote
  #3 (permalink)  
Old 01-06-2007, 12:12 PM
Casual Pligger
 
Join Date: Oct 2006
Posts: 33
Thanks: 1
Thanked 3 Times in 2 Posts
Yeah, I had a look at digitalnature. It still seems a bit hacky to use nonbreaking spaces to pad things out.

And with the dropdown, how do I stop users selecting top level cats?

Radio buttons are preferable, because you can see all the cats at once.

I would love to have that code explained, infact, if you could explain ALL the pligg code, that would be great ;>
Reply With Quote
  #4 (permalink)  
Old 01-06-2007, 12:30 PM
kbeeveer46's Avatar
Pligg Developer/Admin
Pligg Version: 0
Pligg Template: none
 
Join Date: Jun 2006
Location: Muncie, Indiana
Posts: 3,579
Thanks: 255
Thanked 651 Times in 515 Posts
Quote:
Originally Posted by cruci View Post
Secondly, I dont want users to be able to submit stories into the top level categories. That is what the sub cats are for.
What if the sub category they want isn't listed? At least now they can choose the parent category that best applies.
__________________
I accept donations for my time helping users like you on the forum and IRC.
Reply With Quote
  #5 (permalink)  
Old 01-06-2007, 12:35 PM
Casual Pligger
 
Join Date: Oct 2006
Posts: 33
Thanks: 1
Thanked 3 Times in 2 Posts
Quote:
Originally Posted by kbeeveer46 View Post
What if the sub category they want isn't listed? At least now they can choose the parent category that best applies.
That doesn't apply for my site. If the link they are posting doesn't fit in any of the sub cats, then I don't want them posting it! The site is very niche, and we are trying to make the submitter strictly categories and tag their submissions to add value to the content.

www.commuso.net is the site in question, dev.commuso.net for the pligg9 version. Trying to get all the functionality we want sorted out before doing a complete reskin.

Login as devtest/devtest (on dev) so don't have to register to submit a link - and submitting a link is what you'll want to look at, that's where we've made the most changes.

Last edited by cruci; 01-06-2007 at 12:40 PM. Reason: login info added
Reply With Quote
Reply

Thread Tools
Display Modes
Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Similar Threads
Thread Thread Starter Forum Replies Last Post
Displaying Code On Page The Humanaught Pligg Templates 0 10-12-2006 02:23 AM
Karma and meneame code agiacosa Core Development 8 06-15-2006 12:49 PM
/var/log/httpd/error_log messages gr8rcake Bug Report 3 01-28-2006 08:28 PM
editlink.php show category id not category name fwebz Bug Report 0 01-28-2006 11:14 AM


Search Engine Friendly URLs by vBSEO 3.2.0