Re: [TF Solutions] Mutilple article edit views by category.

  • Archived  

By ross - January 28, 2007

Hi Tim

I actually just finished a post about this exact same thing [:)]. We have something for only showing certain fields for certain categories on our feature request list so it will be something our developers will be thinking about for a future version.

I am not quite sure of all the hows and whens just yet but we'll keep you up to date through newsletter.

Let me know if you wanted to have anything else added to our list [:)].
-----------------------------------------------------------
Cheers,
Ross Fairbairn - Consulting
consulting@interactivetools.com

Hire me! Save time by getting our experts to help with your project.
Template changes, advanced features, full integration, whatever you
need. Whether you need one hour or fifty, get it done fast with
Priority Consulting: http://www.interactivetools.com/consulting/

Re: [ross] Mutilple article edit views by category.

  • Archived  

By Toledoh - January 28, 2007

Thanks Ross!
Cheers,

Tim Forrest
Toledoh Enterprises
www.toledoh.com.au

Re: [TF Solutions] Mutilple article edit views by category.

  • Archived  

By kavrick - February 1, 2007

I came up with a way to do this, but it required some fiddling with the templates. I'd be happy to explain but you'd need to feel comfortable hacking around with the system.

Let me know if you'd like the explanation or if you want to wait on the next version.

David

Re: [kavrick] Mutilple article edit views by category.

  • Archived  

By Toledoh - February 1, 2007

Please! Would love to know what you did!

Cheers,
Tim
Cheers,

Tim Forrest
Toledoh Enterprises
www.toledoh.com.au

Re: [TF Solutions] Mutilple article edit views by category.

  • Archived  

By kavrick - March 4, 2007

Tim - Sorry for the wait on this. I meant to get back to you sooner. Also, this might take a while to explain, so bear with me...

A couple of notes first. The modifications I made, could really screw up your system. Be sure to back-up everything first... And, I have no idea how some of these changes might affect you ability to get support. Everybody here seems pretty friendly, but I would consider this like peeling the "Warranty Void if Removed" sticker on the back any device! :)

There are basically 4 parts to this.

First, go into the Database Editor and change the "categoryNum" field type to "textfield". It should already be stored as an integer.

Second you need to create some "field hiders"... At least that's what I call them... These are basically blank fields which hide / show the fields between them based on the category. Here's an example.

Start Hider...

<!-- templateIf : $categoryNum$ ne "19" -->
<tr><td colspan="2">
<table style="display: none;">
<!-- /templateIf -->

End Hider...

<!-- templateIf : $categoryNum$ ne "19" -->
</table>
</td></tr>
<!-- /templateIf -->

You create these "hiders" by creating a new field, adding a label and name, but don't select a field type. Leave it as none. Then copy one of the "hiders" above into the HTML section of the field separator (down at the bottom) and check HTML.

You have to have a "hider" start and end... and you'll see that these basically just hide / show any fields in between them based on the category. I read about this in a tutorial, but can't remember where it is right now. You can see the TemplateIF statement is really straightforward. If the category doesn't equal 19, it hides these fields. If it does, then it shows them.

A couple of caveats here which I ran into immediately, this is really just hiding the fields from view so if you're doing some validation on them, you'll run into trouble. Having the fields in between the "hiders" required, means that the system will throw them a "required" message when the user can't even see the fields. I worked around it by not having any required fields, but if that's something you need, then this might not be for you.

The last part was the simple part. You'll notice that you can pass some field values to the add article page through the URL. For example, if you tack on the category number to the default "add article" link on the homepage (like this admin.cgi?action=articleAdd&categoryNum=19) the category number will be pre-filled on the article page... and if you've got some "hiders" in place, the fields in between them will be shown / hidden based on that category number.

The final thing I did was to alter the actual admin templates so I could present users with the choices of what type of content they wanted to add. For me, it was adding a simple drop-down menu to both the homepage and the articles page. This menu is nothing more than a link which directs them to the add article URL but with different category numbers on the end.

At that point, you've given users the ability to add different types of content and only show the relevant fields required for that content. Make sense?

Here's a few remaining notes that will be helpful.

Any fields that aren't contained within a "hider" will be show... So, I always move the "Status" field to the end, outside of a "hider" so it will always be there.

I created a generic "hider" to always hide the categoryNum field. This way it won't get screwed up. I did this by using a <!-- templateIf : $categoryNum$ ne "0" --> for both the start and end "hiders". You can stick the Filename field in there too... Even though that field is hidden, the javascript will populate it.

I also learned through all of this that you can use the templateIF statements in the admin menus themselves. You can do stuff like hide the "erase" button unless they have admin privileges etc. I was able to create some really customized menus for my clients...

Oh, I almost forgot, one way you can get around having required fields is by adding a default value to the field. That way there something in it, even though the user can't see it.

Anyway, let me know if you have any questions. I've done some pretty major tweaking to all of my installs. I'll do my best to help.

David

Re: [kavrick] Mutilple article edit views by category.

  • Archived  

By jublack2000 - December 5, 2007

David,

This is an excellent excellent tutorial... i will try it out and let you know how it goes... it's brilliant!!!!

Juliana

Re: [kavrick] Mutilple article edit views by category.

  • Archived  

By samasmar - May 11, 2009

Hello,
Since I've done this step:

"First, go into the Database Editor and change the "categoryNum" field type to "textfield". It should already be stored as an integer. "

my AM2 automatically stopped working, and this is exactly what happened:
I changed the categoryNum field to into type "textfield". As expected, the field is shown now as number, instead of "Category name" it shows up "32" or "35" etc.
The big problem comes up when I try to set the field back to "custom >> article editor : Primary Category" as it comes up and error:
"You cannot have more than one 'Primary Category' field. "
I don't know what to do next. I've checked the database and the field categoryNum seems correct on every article. However the category shown at the list is "(No categories defined)" .
Any help is much appreciated
Regards,
Sam

Re: [samasmar] Mutilple article edit views by category.

  • Archived  

By Donna - May 14, 2009

Hi Sam,

Hmm, well, as David mentioned, that's sort of a "warranty voided if removed" situation, and a little beyond what our support can help with. I'd probably recommend just restoring from the backup at this point. :)
Donna

--
support@interactivetools.com