viewing in a table 3 entries across and X down
Posted: 13 June 2007 05:05 AM   [ Ignore ]  
Research Assistant
RankRankRank
Total Posts:  432
Joined  05-21-2007

I hope this is dead easy and I just dont get it.
I am trying to view my categories on a page but i’d like them to view 3 across and then as many down as I need. At the moment I just get them in one frter the other vertically

many thanks

adam

Profile
 
 
Posted: 13 June 2007 07:56 AM   [ Ignore ]   [ # 1 ]  
Moderator
Avatar
RankRankRankRankRankRankRank
Total Posts:  29130
Joined  05-15-2004

Post some code. How are you going to display “3 across”. Look into the {count} variable.

 Signature 

ExpressionEngine 2.0 Downloads | Docs | Bugtracker

“If the English language made any sense, lackadaisical would have something to do with a shortage of flowers.” (Doug Larson)

Profile
MSG
 
 
Posted: 13 June 2007 08:40 AM   [ Ignore ]   [ # 2 ]  
Professor
Avatar
RankRankRankRankRankRankRank
Total Posts:  10797
Joined  04-15-2006

Hi there Adam,

You may not need to use the {count} variable depending on how you set up your page and if you use CSS.

Say you had a content container that is 450px wide. If you were to create a CSS box that was 100px wide to hold the category text or image or whatever you need and then have a clearing div of 50px or apply margins / padding (watch out for problems in IE though!!) then this would automatically spit out all the categories in groups of 3 to a row and then carry on with the next row and so on and so forth.

Hope that helps.

Regards,

Mark

 Signature 

Shopping Cart Plugin
Full list of add-ons
———————————————————-
Buy me a drink, or two if you like!!

Profile
 
 
Posted: 13 June 2007 08:47 AM   [ Ignore ]   [ # 3 ]  
Professor
Avatar
RankRankRankRankRankRankRank
Total Posts:  10797
Joined  04-15-2006

Sorry should have posted some code for you!!

Try this :

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<
html xmlns="http://www.w3.org/1999/xhtml">
<
head>
<
meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<
title>Category Columns</title>
<
style type="text/css">
<!--
.
content {
    width
: 450px;
    
border: 1px solid red;
    
float: left;
}
.category-div {
    width
: 98px;
    
margin: 0 50px 0 0;
    
float: left;
    
border: 1px solid blue;    
}
-->
</
style>

</
head>

<
body>
<
div class="content">

<
div class="category-div">Category 1</div>
<
div class="category-div">Category 2</div>
<
div class="category-div">Category 3</div>
<
div class="category-div">Category 4</div>
<
div class="category-div">Category 5</div>
<
div class="category-div">Category 6</div>
<
div class="category-div">Category 7</div>
<
div class="category-div">Category 8</div>

</
div>
</
body>
</
html>

You will then need to place the proper EE tags in there to make it spit out the categories for you but that should hopefully be a start for you.

Best wishes,

Mark

 Signature 

Shopping Cart Plugin
Full list of add-ons
———————————————————-
Buy me a drink, or two if you like!!

Profile
 
 
Posted: 14 June 2007 02:18 AM   [ Ignore ]   [ # 4 ]  
Research Assistant
RankRankRank
Total Posts:  432
Joined  05-21-2007

thank you mark and ingmar
I am not really a coder so this may be difficult, this is what I have and you both know what I need(by the looks of your answers)

http://www.ummedia.com/MY_SITES/fatlava/EE/index.php/intelart/categories/

I am using freeway to create the templates which is extremely easy but unfortunately let someone like me have the power of EE. Mark I like your way bit isnt similar to what I have now. Ingmar I am sorry but I didnt understand the {count} way could you please elaborate more.

many thanks

for your time

regards

Adam

Profile
 
 
Posted: 11 October 2007 05:13 AM   [ Ignore ]   [ # 5 ]  
Lab Assistant
RankRank
Total Posts:  284
Joined  05-26-2003

Adam, not really because each div has been set to float so will line up next to each other horizontally. The main containing column is 450px wide so only 3 columns will line up next to each other. The fourth will drop below and start a new row. There will be a problem if your rows are of unequal height.

<div class="content">
    
{exp:weblog:categories weblog="my_weblog"}
        
<div class="category-div">{category_name}
        {if category_description}
            
<p>{category_description}</p>
        
{/if}</div>
    
{/exp:weblog:categories}
</div>
 Signature 

ExpressionEngine 1.6.4 - Build:  20080808

Profile
 
 
Posted: 11 October 2007 09:42 AM   [ Ignore ]   [ # 6 ]  
Lab Assistant
RankRank
Total Posts:  284
Joined  05-26-2003

Just working through this trying to get an output like the EE knowledge base page. So I have a 3 column layout and use the floated divs to get my rows. Using a switch I can give a custom class to the third and final div in each row so that it does not have a left hand margin. I am not quite sure why this needs to be placed second in the switch parameters but it seems to work.

<style type="text/css">
<!--
#content {
    
width: 490px;
}
.category-div {
    width
: 154px;
    
margin: 0 14px 0 0;
    
float: left;    
}

.last {
    margin
: 0px;   
}
-->
</
style>


<
div class="content">
{exp:query sql="SELECT cat_name FROM exp_categories WHERE group_id = '6'"}

<div class="{switch="category-div|category-div last|category-div"}">

<
p>{cat_name}</p>

</
div>

{/exp:query}
</div>

This gives me

<div id="content">

<
div class="category-div">
    <
p>Category 1</p>
</
div>

<
div class="category-div">
    <
p>Category 2</p>
</
div>

<
div class="category-div last">
    <
p>Category 3</p>
</
div>

<
div class="category-div">
    <
p>Category 4</p>
</
div>

<
div class="category-div">
    <
p>Category 5</p>
</
div>

<
div class="category-div last">
    <
p>Category 6</p>
</
div>

</
div>
 Signature 

ExpressionEngine 1.6.4 - Build:  20080808

Profile
 
 
   
 
 
Post Marker Legend
New Topic New posts Hot Topic Hot Topic with new posts New Poll New Poll Moved Topic Moved Topic Sticky Topic Sticky topic
Old Topic No new posts Hot Old Topic Hot Topic with no new posts Old Poll Old Poll Closed Topic Closed Topic Announcement Announcements
Theme
Change Theme
Visitor Statistics
The most visitors ever was 1743, on December 02, 2009 03:47 PM
Total Registered Members: 120152 Total Logged-in Users: 61
Total Topics: 126293 Total Anonymous Users: 31
Total Replies: 664180 Total Guests: 329
Total Posts: 790473    
Members ( View Memberlist )