Improved categories function
Posted: 25 March 2009 04:05 AM   [ Ignore ]
Newbie
Rank
Total Posts:  25
Joined  2008-11-04

Loving the form helper plugin. Really useful. I discovered, though, as others have, that the “categories” function is broken, because now you can have more than one category group assigned to a weblog. I really needed this function, so I’ve tweaked it.

It now has a “category group” parameter, so you can restrict it to displaying only certain categories from your list. (I’m afraid I didn’t add support for “not 4” or similar, but you can specify multiple categories with a | as usual).

I also modified the function so if you specify a category_group but not an entry_id, it just lists all the categories in that group - for when you only want to display certain category groups in your SAEF (ENTRY form, as opposed to EDIT).

I’ve provided the modified function here, without warranty - hopefully the Solspace guys may pick this up, tidy it up and add it to the next release. Any comments or queries, do let me know…

File Attachments
new_categories_function.txt  (File Size: 5KB - Downloads: 149)
Profile
 
 
Posted: 25 March 2009 08:51 AM   [ Ignore ]   [ # 1 ]
Administrator
Avatar
RankRankRankRankRank
Total Posts:  8264
Joined  2006-10-18

Thank you very much Paul smile

We may or may not have very big plans for Form Helper, but we’re waiting on the release of EE 2.0 wink

 Signature 
Profile
 
 
Posted: 25 March 2009 08:54 AM   [ Ignore ]   [ # 2 ]
Newbie
Rank
Total Posts:  25
Joined  2008-11-04

Quite understand, Kelsey. I have a few plans, and I’m also waiting on 2.0. Hope this fix helps someone though anyway!

Profile
 
 
Posted: 29 June 2009 07:31 AM   [ Ignore ]   [ # 3 ]
Newbie
Rank
Total Posts:  6
Joined  2009-04-13

This fix worked great!  Thank you!!

Profile
 
 
Posted: 29 June 2009 07:41 AM   [ Ignore ]   [ # 4 ]
Newbie
Rank
Total Posts:  25
Joined  2008-11-04

No probs, glad this has helped someone!

Profile
 
 
Posted: 02 November 2009 11:34 PM   [ Ignore ]   [ # 5 ]
Jr. Member
RankRank
Total Posts:  51
Joined  2008-04-14

How do I use this function? do I replace the function in the original file or add this one.

UPDATED

I figured it out, it’s a replacement for the function in the original formhelper pi.

When used with this code below (found on this forum as well), I am able to successfully use an edit form
that shows a dropdown of categories with the previously chosen category selected.

<select name="category">
{categories}{if parent_id != 0}<? $selected_category "{category_id}"?>{/if}{/categories}
{exp
:weblog:categories weblog="your_weblog" style="linear"}
<option value="{category_id}"<? if($selected_category == "{category_id}"echo " selected"} ?>>
{if parent_id != 0}{/if}{category_name}
</option>
{/exp:weblog:categories}
</select
Profile
 
 
Posted: 05 November 2009 07:01 AM   [ Ignore ]   [ # 6 ]
Newbie
Rank
Total Posts:  1
Joined  2006-09-04

This would be just simple now after the tweak, I used the form helper tags below and it worked ! wink

{exp:form_helper:categories entry_id=”{entry_id}” category_group=“6”}<input type=“checkbox” name=“category[]”  {checked} />{cat_name}
{/exp:form_helper:categories}

Profile
 
 
Posted: 04 January 2010 09:02 PM   [ Ignore ]   [ # 7 ]
Newbie
Rank
Total Posts:  2
Joined  2009-08-29

Works great!  Much thanks Paul!

Profile
 
 
Posted: 24 February 2010 01:18 AM   [ Ignore ]   [ # 8 ]
Jr. Member
RankRank
Total Posts:  42
Joined  2008-07-08

this fix is excellent!
thanks!

stefan

Profile