Hi,
I’m a total newbie to the EE. I’m trying to do such thing with this engine, however I need your advice.
I wan’t to create the site about different diseases. I need to creat mechanism that will allow reader to find his own type.
Page 1:
F.ex.
A Ankle pain Abdominal pain H Headache Heartache
The list of different diseases A-Z.
Page 2:
If the reader pick one of them he will see three different stauses of diseases. For example. Ankle pain one RED Ankle pain two RED
Ankle pain three YELLOW
Ankle pain four BLUE
And then after clicking on this he will be able to read the article. I did create three channels for this three colours RED, YELLOW, BLUE and ascribe cateogories of the diseases to each channel.
I used for page 2 this code:
<div class="blue">
{exp:channel:entries channel="BLUE" status="open"}<ul>
<li>
<a href="http://{title_permalink=site/page3}">_
{title}</a></li></ul>{/exp:channel:entries}
</div>
<div class="yellow">
{exp:channel:entries channel="YELLOW" status="open"}<ul>
<li>
<a href="http://{title_permalink=site/page3}">_
{title}</a></li></ul>{/exp:channel:entries}
</div>
<div class="red">{exp:channel:entries channel="RED" status="open"}<ul>
<li>
<a href="http://{title_permalink=site/page3}">_
{title}
</a></li></ul>
{/exp:channel:entries}</div>QUESTION: How to generate on page two list of the categories for all channels grouped by category group ID. Is it possible with the EE or I need to buy some plugins (which one?).
I have already purchased the Category ID plugin, however it’s not what I need I guess…
I really appreciate your help.
Hi nicomsw
How does a Blue entry differ from a Red or Yellow entry? The reason I ask is that if the structure is the same i.e. they use the same custom fields, then it may be better to just have a single Channel called “Diseases” and use multiple category groups instead.
Category Group 1 “ColourStatus” contains the categories: Red, Blue, Yellow etc. Category Group 2 “Ankle Pain, Wrist Pain etc…”
to attempt an answer of your question:
QUESTION: How to generate on page two list of the categories for all channels grouped by category group ID. Is it possible with the EE or I need to buy some plugins (which one?).
{exp:channel:categories channel="RED|BLUE|YELLOW" show_empty="no" category_group="1|2|3"}
{category_name}
{/exp:channel:categories}The tag above renders a hierarchical list of categories parented by category groups. See here: http://ellislab.com/expressionengine/user-guide/modules/channel/categories.html
You can render plain text too if you use the parameter: style=”linear”
If you wanted to break the formatting and show the Category Groups in their own divs for example, you could use…
<div class="categoriesBox">
{exp:channel:categories channel="RED|BLUE|YELLOW" show_empty="no" category_group="1"}
{category_name}
{/exp:channel:categories}
</div>
<div class="categoriesBox">
{exp:channel:categories channel="RED|BLUE|YELLOW" show_empty="no" category_group="2"}
{category_name}
{/exp:channel:categories}
</div>
<div class="categoriesBox">
{exp:channel:categories channel="RED|BLUE|YELLOW" show_empty="no" category_group="3"}
{category_name}
{/exp:channel:categories}
</div>Hi Matt,
thank you for your help. I really appreciate it.
Well, the Blue Red and Yellow entry has to be presented in different divs, that’s why I’ve used the different channels for them. Maybe it is problem with my thinking…
I’ve tried the
{exp:channel:categories channel="RED|BLUE|YELLOW" show_empty="no" category_group="2"}however it does not working… It generates empty space for some reason. If use only one channel
{exp:channel:categories channel="RED" show_empty="no" category_group="2"}it works fine. What is the problem?
OK, let’s turn this on it’s head and use an ENTRIES tag instead. We know that Entries tags can look at more than one Channel…
{exp:channel:entries channel="RED|BLUE|YELLOW"}
{categories}
{category_image} <a href="http://{path=channel/index}">{category_name}</a>
{/categories}
{/exp:channel:entries}Here’s more info: http://ellislab.com/expressionengine/user-guide/modules/channel/variable_pairs.html#var_categories
Ok, if I’ll use:
Category Group 1 “ColourStatus” contains the categories: Red, Blue, Yellow etc. Category Group 2 “Ankle Pain, Wrist Pain etc…”
as you have mentiond. Will I be able to differ it on the last page. For example If I will Publish post in:
Category Group1 Blue Group 2 Ankle Pain
And then another post: Category Group1 Red Group 2 Ankle Pain
will I be able to get:
Ankle Pain post 1 Ankle Pain post 2
using different divs?
Using your objective…
Assuming you have a single Wrist Pain entry and TWO Ankle pain entries.
Category Group 1 contains these Categories: Red “id:1), Blue (id:2), Yellow (id:3” Category Group 2 contains these Categories: Ankle Pain (id:4), Wrist Pain (id:5)
<div id="redDiseases"><!-- render diseases in the Red group -->
{exp:channel:entries channel="disease" category="1"}
{title} post {count}
{/exp:channel:entries}
</div>would display: Ankle Pain post 1 Ankle Pain post 2
and…
<div id="blueDiseases"><!-- render diseases in the blue and wrist pain groups -->
{exp:channel:entries channel="disease" category="2|5"}
{title} post {count}
{/exp:channel:entries}
</div>would display: Wrist Pain post 1
Unfortunatelly I think it won’t do…
In this case it should look like that:
Category Group 1 contains these Categories: Red (id:1), Blue (id:2), Yellow (id:3) Category Group 2 contains these Categories: Ankle Pain (id:4), Wrist Pain (id:5)
but it should generate on the second page entries from the same Category Group (in your exaple it’s two). but it should has different colours depends on what the post.
F. ex.
Page one:
A.
Ankle pain
W.
Wrist pain.
Then if you click on the Ankle pain it should go to page 2.
Page two:
(post number 1) Ankle Pain and fewer. (post number 2) Anke Pain and headache without the fewer.
Moreover: I will be adding the categories not now, but though the time. So it can’t be specified by id (becasue there is no catetories in group 2 for now). And I don’t wan’t to edit template for every new category…
Oh, a what a mess…
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.