How to Make Block Categories

Discussion in 'PHP' started by ruberr2002, Dec 14, 2008.

  1. #1
    Hi
    Please see the 2 attachments. Currently I have drop down menu for categories, but I need to have simple blocked categories like the one shown in image 2.
    This is the code I have in my template file. Could someone please suggest what changes to make in this code to get the categories as shown in image 2.
    <select name="category">
    			{section name=thecat loop=$cat_array}
    			   <option value = "{$cat_array[thecat].auto_id}">
    				  {if $cat_array[thecat].spacercount lt $lastspacer}{$cat_array[thecat].spacerdiff|repeat_count:''}{/if}
    				  {if $cat_array[thecat].spacercount gt $lastspacer}{/if}
    				  {$cat_array[thecat].spacercount|repeat_count:'&nbsp;&nbsp;&nbsp;'}
    				  {$cat_array[thecat].name} 
    				  &nbsp;&nbsp;&nbsp;       
    				  {assign var=lastspacer value=$cat_array[thecat].spacercount}
    			  </option>
    			{/section}
    		</select>
    
    Code (markup):
    thanks
     

    Attached Files:

    ruberr2002, Dec 14, 2008 IP
  2. chopsticks

    chopsticks Active Member

    Messages:
    565
    Likes Received:
    20
    Best Answers:
    0
    Trophy Points:
    60
    #2
    This what you mean?
    <div class="your-style-class">
    			{section name=thecat loop=$cat_array}
    			   <a href="link/?id={$cat_array[thecat].auto_id}">
    				  {$cat_array[thecat].name}
    			  </a>
    			{/section}
    		</div>
    Code (markup):
     
    chopsticks, Dec 14, 2008 IP
  3. ruberr2002

    ruberr2002 Peon

    Messages:
    463
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #3
    thanks, but it is not working. returns 404 page.
     
    ruberr2002, Dec 14, 2008 IP
  4. chopsticks

    chopsticks Active Member

    Messages:
    565
    Likes Received:
    20
    Best Answers:
    0
    Trophy Points:
    60
    #4
    That would be something to do with your site, not the code.
     
    chopsticks, Dec 15, 2008 IP