2 of 21
2
Plugin: Child Categories
Posted: 22 August 2008 12:51 PM   [ Ignore ]   [ # 19 ]  
Grad Student
Rank
Total Posts:  71
Joined  02-19-2007

Damn, so many plugins around that I didn’t even know of. Thanks again for your help! I got it to work!

Profile
 
 
Posted: 23 August 2008 03:20 PM   [ Ignore ]   [ # 20 ]  
Grad Student
Rank
Total Posts:  41
Joined  09-05-2007

It works as advertised, and I appreciate it. But I tried to format it by adding
div sections around the variable pairs and they were removed from the final code:

<div>
{child_category_start}

{child_category_start}
</div>
<ul>
<entries-start>
<entries-end>
</ul>

Is there a remedy?

Profile
 
 
Posted: 24 August 2008 01:23 AM   [ Ignore ]   [ # 21 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1156
Joined  02-02-2007

Hi odspi,

It is by intention that only that code is rendered which is included between variable pairs.

If you need to wrap the output of {child_category_start}{child_category_start} or {parent_category_start}{parent_category_end}  variable pair with <div> tag, then this tag should be inside that variable pair:

{parent_category_start}
<div>
Some code
</div>
{parent_category_end}

{child_category_start}
<div>
Some code
</div>
{child_category_start} 

If you need to wrap the output of {entries-start}{entries-end} variable pair with <ul> tag, then ... it seems that this is not possible currently.

I will think about this problem.

One possible solution would be to introduce a new parameter, say “entries_wrapper”, which could accept such values as “div”, “ul”, etc., or even values with pipe character as “div|ul”.

Another solution would be to introduce two new variable pairs, say {entries_wrapper_top_start}{entries_wrapper_top_end} and {entries_wrapper_bottom_start}{entries_wrapper_bottom_end}.

 Signature 

Full list of add-ons here

Child Categories
Browser Sniff
Category Id
Entries Number

Profile
 
 
Posted: 24 August 2008 04:49 AM   [ Ignore ]   [ # 22 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1156
Joined  02-02-2007

Hi oldspi and all,

Just uploaded version 1.3 of Child Categories plugin. Grab it using the link in the first post of this thread.

New thing is introduction of two variable pairs:

{entries_wrapper_top_start}{entries_wrapper_top_end} 

and

{entries_wrapper_bottom_start}{entries_wrapper_bottom_end} 

The variable pair {entries_wrapper_top_start}{entries_wrapper_top_end} allows you to specify top part of the code with which you would like to wrap output of {entries_start}{entries_end} variable pair.
 
The variable pair {entries_wrapper_bottom_start}{entries_wrapper_bottom_end} allows you to specify bottom part of the code with which you would like to wrap output of {entries_start}{entries_end} variable pair.

Exxample:

{exp:child_categories parent="18|29" child_categories_sort_by="custom" child_categories_sort_direction="asc" show_empty="yes" entries_sort_by="date" entries_sort_direction="asc" entries_limit="3" site="1"}

{child_category_start}
<div class="my_category_div">
{child_category_name}
</div>
{child_category_end}

{entries_wrapper_top_start}
<div class="my_entries_div">
<
ul class="my_entries_ul">
{entries_wrapper_top_end}

  {entries_start}
  
<li><a href="{weblog_url}{url_title}/">{title}</aWeblog{weblog_name}posted{entry_date}</li>
  
{entries_end}

{entries_wrapper_bottom_start}
</ul>
</
div>
{entries_wrapper_bottom_end}

  {
/exp:child_categories} 

Such code will output something like this:

<div class="my_category_div">
some child_category_name
</div>

<
div class="my_entries_div">
<
ul class="my_entries_ul">
<
li><a href="some_href">some_title_1</aWeblogsome_weblog_namepostedsome_entry_date</li>
<
li><a href="some_href">some_title_2</aWeblogsome_weblog_namepostedsome_entry_date</li>
<
li><a href="some_href">some_title_3</aWeblogsome_weblog_namepostedsome_entry_date</li>
<
li><a href="some_href">some_title_4</aWeblogsome_weblog_namepostedsome_entry_date</li>
</
ul>
</
div>

<
div class="my_entries_div">
<
ul class="my_entries_ul">
<
li><a href="some_href">some_title_1</aWeblogsome_weblog_namepostedsome_entry_date</li>
<
li><a href="some_href">some_title_2</aWeblogsome_weblog_namepostedsome_entry_date</li>
<
li><a href="some_href">some_title_3</aWeblogsome_weblog_namepostedsome_entry_date</li>
</
ul>
</
div>

<
div class="my_category_div">
some child_category_name
</div>

<
div class="my_entries_div">
<
ul class="my_entries_ul">
<
li><a href="some_href">some_title_1</aWeblogsome_weblog_namepostedsome_entry_date</li>
</
ul>
</
div

Try it and give me to know if something goes wrong.

 Signature 

Full list of add-ons here

Child Categories
Browser Sniff
Category Id
Entries Number

Profile
 
 
Posted: 24 August 2008 06:05 AM   [ Ignore ]   [ # 23 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  111
Joined  04-14-2006

Laisvunas & oldspi I was getting the same, strange tags were being removed.

It was late friday and I wanted a beer by that point. I’ll test 1.3 and let you know how we get on.

Laisvunas again, such a great plugin!

Profile
 
 
Posted: 24 August 2008 01:21 PM   [ Ignore ]   [ # 24 ]  
Grad Student
Rank
Total Posts:  41
Joined  09-05-2007

Laisvunas, I appreciate your support here very much.

I tried the upgrade. It doesn’t seem to work. I cut&pasted;from this thread the new variable pairs and put them around the entries tags. The stuff inside isn’t rendered.

On a more general level.

I don’t know how difficult it is to implement,but the best option would be to render the stuff inside the plugin tags but outside the variable pairs as it is. This would be consistent with how normal ee tags work and will be the least surprising behavior for the coder and also be the most flexible.

But your solution should solve the biggest problem.

Thanks, hope the bug is shallow!

Profile
 
 
Posted: 24 August 2008 01:47 PM   [ Ignore ]   [ # 25 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1156
Joined  02-02-2007

Hi odspi,

Can you post your code in which you added inside {entries_wrapper_top_start}{entries_wrapper_top_end} and {entries_wrapper_bottom_start}{entries_wrapper_bottom_end} variable pairs some stuff which did not render?

It should not be the case that the code inside those variable pairs does not render at all; it may not be rendered something in some places where it should be, but not anything at all.

 Signature 

Full list of add-ons here

Child Categories
Browser Sniff
Category Id
Entries Number

Profile
 
 
Posted: 25 August 2008 03:43 AM   [ Ignore ]   [ # 26 ]  
Grad Student
Rank
Total Posts:  41
Joined  09-05-2007
<div class="entry" id="catlist">        
{exp:child_categories parent="23" child_categories_sort_by="custom" 
child_categories_sort_direction="asc" show_empty="yes" entries_sort_by="date" 
 
entries_sort_direction="asc" entries_limit="3" site="1"}

  {parent_category_start}
  
<h1><a href="{path={my_group}/C{parent_category_id}}">
         
{parent_category_description}</a>
  </
h1>
  
{parent_category_end}

  {child_category_start}
   
<div class="entry-title">    
   <
h3><a href="{path={my_group}/C{child_category_id}}">
           
{child_category_name}</a></h3>
   </
div><!--  entry-title -->
   <
div class="entry-footer">   Total entries{entries_total}</div>

  
{child_category_end}


{entries_wrapper_bottom_start}
  
<ul>
{entries_wrapper_bottom_end}
  {entries_start}
              
<li><a href="{path={my_group}/{url_title}}">{title}</a></li>
  
{entries_end}
{entries_wrapper_bottom_start}
  
</ul>
{entries_wrapper_bottom_end}


  {
/exp:child_categories} 

</div><!-- entry --> 
Profile
 
 
Posted: 25 August 2008 04:11 AM   [ Ignore ]   [ # 27 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1156
Joined  02-02-2007

Hi odspi,

It’s easy to see where you have made simple oversight - you included variable pair {entries_wrapper_bottom_start}{entries_wrapper_bottom_end} two times.

That is, instead of this

{entries_wrapper_bottom_start}
  
<ul>
{entries_wrapper_bottom_end}

  {entries_start}
              
<li><a href="{path={my_group}/{url_title}}">{title}</a></li>
  
{entries_end}

{entries_wrapper_bottom_start}
  
</ul>
{entries_wrapper_bottom_end} 

there should be

{entries_wrapper_top_start}
  
<ul>
{entries_wrapper_top_end}

  {entries_start}
              
<li><a href="{path={my_group}/{url_title}}">{title}</a></li>
  
{entries_end}

{entries_wrapper_bottom_start}
  
</ul>
{entries_wrapper_bottom_end} 

It is by design - wrapper code is being rendered only in case there are both {entries_wrapper_top_start}{entries_wrapper_top_end} and {entries_wrapper_bottom_start}{entries_wrapper_bottom_end} variable pairs.

 Signature 

Full list of add-ons here

Child Categories
Browser Sniff
Category Id
Entries Number

Profile
 
 
Posted: 25 August 2008 04:34 AM   [ Ignore ]   [ # 28 ]  
Grad Student
Rank
Total Posts:  41
Joined  09-05-2007

Yes, I spotted it the moment I read my own post!!!

Shallow bug indeed! THANKS!

Profile
 
 
Posted: 26 August 2008 11:39 AM   [ Ignore ]   [ # 29 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1156
Joined  02-02-2007

Hi,

I have released a version 1.4 of Child Categories plugin.

In this release parameter “invalid_input” was added. This parameter accepts two values: “alert” and “silence”. Default value is “silence”. If the value is “alert”, then in cases when some parameter’s value is invalid plugin exits and PHP alert is being shown;
if the value is “silence”, then in cases when some parameter’s value
is invalid the plugin finishes its work without any alert being shown.
Set this parameter to “alert” for development, and to “silence” - for deployment.

Since the plugin does not do comprehensive validation of parameters’ values, you cannot be absolutely sure that in cases no alert was thrown the input was really valid.

 Signature 

Full list of add-ons here

Child Categories
Browser Sniff
Category Id
Entries Number

Profile
 
 
Posted: 26 August 2008 11:50 AM   [ Ignore ]   [ # 30 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1757
Joined  03-26-2006

Wow, this looks really interesting. Don’t know how I missed this thread. This may come in real handy on my next build, which is category-heavy *shudders*. Thank you!

 Signature 

ryan masuga
—————
Masuga Design | devot:ee
@masuga | @masugadesign | @devot_ee

Profile
 
 
Posted: 01 September 2008 02:25 AM   [ Ignore ]   [ # 31 ]  
Summer Student
Total Posts:  17
Joined  08-17-2006

Hi, Like everyone else, I am very grateful for this new plugin! It seems to be exactly what I need, however, I am having a little difficulty making the links to the Entries work.

I have a project where a Law Office has several “Areas of Practices” and each Area of Practice can have 0 - 30 Services associated with it (in other words, subcategories).

There is a page that will list all of these out, and the “Areas of Practice” and “Services” need to link to their respective details pages if content exists in their description field, otherwise they need to just display on the listing page with no link. Oh, and there will never be a “Services” entry without a description, though there my be an “Area of Practice” entry without description.

I have set up my Categories as such:

Area of Practice 1
- Service for 1

Area of Practice 2
- Service for 2

Area of Practice 3
- Service for 3

Area of Practice 4
- Service for 4

Area of Practice 5
- Service for 5

Area of Practice 6
- Service for 6

And so on…

When inputting content, there is a weblog called hr_areas_of_practice_and_services with the “title” field and a custom field called “description”.

My problem is that I cannot figure out a way to make the links work for the entries generated by your plugin. I fear that it may be because I am a novice, so please have mercy wink

I have tried category_archive, but cannot get it to do what I want. I feel like I just don’t have the hang of it.

I have tried entries, but they don’t get me the nesting capabilities I require, though the links are correct.

And I have tried your code. It’s by far the closest to what I need. It’s just that the links aren’t correct. In the code below you will see what I am TRYING to do with the links.

Here is my code:

<h2>category_archive</h2>

{exp:weblog:category_archive weblog="hr_areas_of_practice_and_services" style="nested"}

  {entry_titles}
    
<a href="{path=''SITE_INDEX''}">{title}</a>
  
{/entry_titles}
                    
{
/exp:weblog:category_archive}
                
<h2>entries has the right linksbut doesn&rsquo;t have the right nesting</h2>

<
ul>
  
{exp:weblog:entries weblog="hr_areas_of_practice_and_services" sort="asc"}
    {if description 
== ""}
      
<li>{title}</li>
    
{if:else}
      
<li><a href="{permalink=hr/areas_of_practice_services_2}">{title}</a></li>
    
{/if}
  {
/exp:weblog:entries}
</ul>

<
h2>child_categories plugin has workable nestingbut doesn&rsquo;t have the right links</h2>

{exp:child_categories weblog="hr_areas_of_practice_and_services" parent="50|51|52|53|54|55" child_categories_sort_by="custom" child_categories_sort_direction="asc" show_empty="yes" entries_sort_by="date" entries_sort_direction="asc" entries_limit="6"}

  {parent_category_start}
    
<h3><a href="{permalink=hr/areas_of_practice_services_2}">{parent_category_name}</a></h3>
  
{parent_category_end}
                        
  {child_category_start}
  {child_category_end}
    
  {entries_wrapper_top_start}
    
<ul>
  
{entries_wrapper_top_end}
                    
  {entries_start}
    
<li><a href="{permalink=hr/areas_of_practice_services_2}">{title}</a></li>
  
{entries_end}
                    
  {entries_wrapper_bottom_start}
    
</ul>
  
{entries_wrapper_bottom_end}
                        
{
/exp:child_categories} 

A working sample (using the code above) can be found at http://hruhpa.com.s18903.gridserver.com/index.php/hr/areas_of_practice_listing/

I think the problem is centered around the fact that the {permalink} tag won’t work without being inside of the {exp:weblog:entries} tag, but I have exhausted my brain power trying locate it properly, so my code above has it not wrapping the permalinks. The way the loops are constructing when I put it in different places is driving me nuts!

If I need to create the links a different way, please tell me the best way to go about it. I’m sort of a newb.

If you are able to offer any help, that would be fantastic!!! Let me know if you need more details from me. And thank you very much.

Profile
 
 
Posted: 01 September 2008 05:32 AM   [ Ignore ]   [ # 32 ]  
Summer Student
Total Posts:  3
Joined  02-13-2006

Hi there,

Lovely plugin… but i’ve got a problem making an expandable navigation.

<ul class="navigation_main">
                                
                                
{exp:weblog:categories weblog="{embed:my_weblog}" category_group="1" show="not 8|13|14|15|16|17" style="linear"}
                                
                                
<li>
                                
                                    <
a href="{path=SITE_INDEX}">{category_name}</a>
                                    
{if segment_2 == "print"}
                                        {if category_id 
== "4"}
                                        
<li>
                                            <
ul class="navigation_subsub">
                                        
                                            
{exp:child_categories parent="4" child_categories_sort_by="custom" child_categories_sort_direction="asc" show_empty="yes" entries_sort_by="date" entries_sort_direction="asc" entries_limit="3" site="1"}
                                            
                                            {child_category_start}
                                                
<li><a href="{homepage}/category/{child_category_url_title}/">{child_category_name}</a></li>
                                            
{child_category_end}
                                            
                                            {
/exp:child_categories} 
                                        
                                            
</ul>
                                        </
li>
                                        
{/if}
                                    {
/if}
                                
</li>
                                
                            
{/exp:weblog:categories}
                            
                            
</ul

In this case i have 4 main category buttons:

Print
Web
Motion
Wall

The Print button contains subcategories:

Projects
Graphic designers
Illustrators
Typographers
Visualisers

Now with this if statement i try to figure out when the print category button was clicked:

{if segment_2 == "print"}
  {if category_id 
== "4"

But the problem is that when i click on a subcategory segment_2 doesn’t contain the “print” parameter anymore (cause it’s set to the subcategory) and my subnavigation will not appear.

I thought i would solve it by using:

{homepage}/category/{parent_category_url_title}/{child_category_url_title} 
instead of
{homepage}/category/{child_category_url_title} 

Now the subnavigation doesn’t disappear but the subcategory content won’t show.

How do i solve this problem??

Profile
 
 
Posted: 01 September 2008 05:33 AM   [ Ignore ]   [ # 33 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1156
Joined  02-02-2007

Hi jdgraffam,

Yes, {permalink} variable will not work inside {exp:child_categories} tag.

To get links working you may write one of the several possible versions of code.

First, you may use {path=some_segment/some_segment/some_segment} global variable together with {url_title} variable of Child Categories plugin:

{entries_start}
<li><a href="{path=hr/areas_of_practice_services_2}{url_title}/">{title}</a></li>
{entries_end} 

Alternatively, you can go Control Panel Home >  Admin >  Weblog Administration >  Weblog Management >  Edit Weblog > Path Preferences and set path preference for your weblog “hr_areas_of_practice_and_services”. Then you can use variable {weblog_url} together with {url_title} variable of Child Categories plugin:

{entries_start}
<li><a href="{weblog_url}/{url_title}/">{title}</a></li>
{entries_end} 

Yet alternatively you can use your word triggering categories (which by default is “category”) together with {homepage} global variable and {child_category_url_title} and {url_title} variables of Child Categories plugin:

{entries_start}
<li><a href="{homepage}/category/{child_category_url_title}/{url_title}/">{title}</a></li>
{entries_end} 

Use any version you like.

 Signature 

Full list of add-ons here

Child Categories
Browser Sniff
Category Id
Entries Number

Profile
 
 
Posted: 01 September 2008 05:48 AM   [ Ignore ]   [ # 34 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1156
Joined  02-02-2007

Hi phrz,

You should not wonder that something does not work when you use such complex nesting.

You place
1){if segment_2 == “print”} conditional inside {exp:weblog:categories} tag, and then you place
2) {if category_id == “4”} conditional which is part of {exp:weblog:categories} tag inside {if segment_2 == “print”} conditional.

Try to simplify your nesting and things should start to work.

If you nest some tags, build your nesting step-by-step checking every step if it works.

 Signature 

Full list of add-ons here

Child Categories
Browser Sniff
Category Id
Entries Number

Profile
 
 
Posted: 01 September 2008 06:22 AM   [ Ignore ]   [ # 35 ]  
Summer Student
Total Posts:  3
Joined  02-13-2006

Hi Laisvunas,

Thanks for your quick reply. I’m quite new to EE and i thought this was a pretty basic nesting solution..

Is there a simple way to achieve a categorie -> click -> show subcategorie navigation in EE?

I mean it’s likely been done before, can you give me some directions (i’ve searched trough a lot of wiki posts and eeDocs)

Cheers!

Profile
 
 
Posted: 01 September 2008 09:42 AM   [ Ignore ]   [ # 36 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1156
Joined  02-02-2007

Hi phrz,

Is there a simple way to achieve a categorie -> click -> show subcategorie navigation in EE?

Speaking generally, ExpressionEngine and most its plugins does not presuppose any HTML, CSS or Javascript. That is, what HTML, CSS or Javascript to include in your pages is entirely up to you.

Concerning your problem this implies that you should try to solve it in 2 steps:

1) you should find navigation menu script you like

2) you should find ExpressionEngine’s tag(s) or plugin(s) which would allow to pull data you need from database and insert it into your menu’s HTML.

Concerning the second step you may consider such ExpressionEngine’s tags as {exp:weblog:categories} or {exp:weblog:category_archive} or such plugins as Child Categories or Subcategories.

It seems that there is no simpler way to achieve what you need.

Hope that helps.

 Signature 

Full list of add-ons here

Child Categories
Browser Sniff
Category Id
Entries Number

Profile
 
 
   
2 of 21
2