[MOD] Submit-step2 Digg like categories selection with radio button

Register an Account
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old 05-27-2007, 02:59 AM
dollars5's Avatar
Pligg Donor
 
Join Date: Dec 2006
Location: India
Posts: 1,960
If you want to select only sub-categories then this should help and get digg style categories selecting in step 2 - modify submit_step2.tpl to include this code instead of the old drop-down list code. This code is used live in Meme or Lame / Published News
Code:
<p class="l-mid">
			<label for="category" accesskey="1">{#PLIGG_Visual_Submit2_Category#}:</label>
			<span class="form-note">{#PLIGG_Visual_Submit2_CatInstruct#}</span>

			<div id="category">
				{assign var=test value=0}
				{section name=thecat loop=$cat_array}
			
					{if $cat_array[thecat].spacercount lt $lastspacer}{$cat_array[thecat].spacerdiff|repeat_count:'</ul></div>'}{/if}
					{if $cat_array[thecat].spacercount gt $lastspacer}{/if}
					{$cat_array[thecat].spacercount|repeat_count:'&nbsp;&nbsp;'}
					{if $cat_array[thecat].parent neq 0}
						{if $test eq 0}<li><input name="category" type="radio" id="select-i" value="{$cat_array[thecat].auto_id}" checked/>
							{$cat_array[thecat].name}
							{assign var=test value= $cat_array[thecat].parent}
							{elseif $test ne 0}
							<li><input name="category" type="radio" id="select-i" value="{$cat_array[thecat].auto_id}" />{$cat_array[thecat].name}
						{/if}
					{else}<div class="column-list"><ul><strong>{$cat_array[thecat].name}</strong>
					{/if}
					
					{assign var=lastspacer value=$cat_array[thecat].spacercount}
					
				{/section}
			<br/>
			</div>
		</p>
andd add to main.cs this code
Code:
#category ul{list-style:none}
#category ul li a{display:block;width:7em;text-decoration:none;list-style:none}
#category ul li a:hover{color:#FFF;background-color:#A52A2A}
div.column-list {float:left;width:10em}

Screenshot of final implementation (as seen on http://memeorlame.com):


A screenshot of how it looks at Digg:

Last edited by dollars5; 07-15-2007 at 11:25 AM.
Reply With Quote
  #2 (permalink)  
Old 05-28-2007, 04:39 PM
New Pligger
 
Join Date: Nov 2006
Posts: 29
Thanks a lot for the code. But my categories display one below the other.

I want the (in diggs case) technology, world & business, videos, sports, etc and their sub categories to display right beside each other horizontally, like in Digg.

Thanks in advance for any help.

Edit: Nevermind, i found it. Thanks again for the code

Last edited by rhythm; 05-28-2007 at 05:26 PM.
Reply With Quote
  #3 (permalink)  
Old 05-28-2007, 09:51 PM
dollars5's Avatar
Pligg Donor
 
Join Date: Dec 2006
Location: India
Posts: 1,960
Oops that is the CSS style that gives this appearance:
Code:
#category ul{list-style:none}
#category ul li a{display:block;width:7em;text-decoration:none;list-style:none}
#category ul li a:hover{color:#FFF;background-color:#A52A2A}
Reply With Quote
  #4 (permalink)  
Old 06-02-2007, 02:50 AM
Genghis's Avatar
Casual Pligger
 
Join Date: Mar 2007
Posts: 57
Dollars,

I really appreciate you sharing this with everyone. But I'm having a real hard time aligning the columns side-by-side like on digg and your site.

I feel like a total idiot going through the statements and not being able to understand a single bit of it. I can't seem to wrap my small brain around arrays and how their generated in the html.

In any case, it would really be great if you could share the correct css or smarty code for making the categories side-by-side. Thanks so much....
Reply With Quote
  #5 (permalink)  
Old 06-02-2007, 10:37 AM
not2serious's Avatar
Pligg Donor
Pligg Version: 1.1.5
Pligg Template: Westie
 
Join Date: Apr 2007
Location: East Coast, USA
Posts: 229
IS there any way to use something like this for a preset group of tags? Of course there would have to be the ability to add unique tags as well.

The user would then be encourage to use tags and the site/story would get more traffic. It could also be set to only commit with at least two tags checked. I am not a coder, so I would not know how to create this myself.
Reply With Quote
  #6 (permalink)  
Old 06-04-2007, 08:43 PM
New Pligger
 
Join Date: Jun 2007
Posts: 1
Great tip. I'd like to see this implemented into my site.
Reply With Quote
  #7 (permalink)  
Old 06-04-2007, 10:24 PM
dollars5's Avatar
Pligg Donor
 
Join Date: Dec 2006
Location: India
Posts: 1,960
Quote:
Originally Posted by Genghis View Post
Dollars,

I really appreciate you sharing this with everyone. But I'm having a real hard time aligning the columns side-by-side like on digg and your site.

I feel like a total idiot going through the statements and not being able to understand a single bit of it. I can't seem to wrap my small brain around arrays and how their generated in the html.

In any case, it would really be great if you could share the correct css or smarty code for making the categories side-by-side. Thanks so much....
Did you use the CSS I presented in the comment above your's?
Reply With Quote
  #8 (permalink)  
Old 06-06-2007, 09:18 AM
New Pligger
 
Join Date: Jun 2007
Posts: 1
Works PERFECT on my site thankxxxxxx
Reply With Quote
  #9 (permalink)  
Old 06-11-2007, 11:40 PM
P1mpPanther's Avatar
Constant Pligger
 
Join Date: Feb 2007
Posts: 277
is there an issue with this if a category doesn't have any subcategories?

for some reason, even with the updated CSS code my categories are stacked one on top of the other, and if the Cat is w/o a sub Cat - no radio button appears!
Reply With Quote
  #10 (permalink)  
Old 06-12-2007, 12:06 AM
dollars5's Avatar
Pligg Donor
 
Join Date: Dec 2006
Location: India
Posts: 1,960
Sure is - as the CSS will not allow you to select an category from level 1 (it behaves in that manner) as in 2 - level categories, most systems expect an user to select a category from level 2 and not parent level.

I am not sure - many people have got it successfully working on their site and have sent PM thanking me for that. Can you try flushing your templates_c folder and local broswer cache - maybe it is just loading the css from local cache.
Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to create button for blogger/wordpress like digg for submit new story aryan3 Questions and Comments 13 08-22-2010 11:11 AM
In 1.0RC5 - Digg like categories in Submit-step2 selection with radio button arif1999 Questions and Comments 1 07-02-2009 11:46 AM
[MOD] Categories in header like Digg (useful if you have subcategories) dollars5 Questions and Comments 142 06-01-2009 09:24 AM
Problem with categories - Submit new story plectori Questions and Comments 1 02-28-2009 06:09 AM
Profile links radio button is not filling argh2xxx Questions and Comments 0 02-25-2009 01:49 PM


Pligg Modules and Pligg Templates from Pligg Pro Find support on the Pligg CMS Forum - 24 hours a day! Make a donation to support Pligg CMS development