Keyword

Different add/edit form for each category

More
10 years 7 months ago #125711 by Jade
Hi guys, I have several categories and have set up overrides for each category as each category displays the information differently.

So at the moment I have it like so -

Mytemplate/HTML/com_k2/ and then my category override folders like so:

Essay
Crossword
Notes

Etc

I need a different add/edit form for each category as they are for different resources to be in each category.

Is this possible? To have a 'custom' imteform.php in each category, I.e essay, crossword, notes etc?

If so where do I put the itemform.php? It doesn't work just placed in the folder (essays/itemform.php), and it doesn't work if I do essays/default/itemform.php

My changes do show up if it is in mytemplate/html/com_k2/default/itemform.php however it shows the changes on ALL categories, which isn't what I want as I need individualised forms for each category.

If someone could help that would be great.

Ty

Please Log in or Create an account to join the conversation.

More
10 years 7 months ago #125712 by Lefteris
Replied by Lefteris on topic Re: Different add/edit form for each category
Hi. You cannot do this like that. The only way to do this is to create three different menu links to item form and set at the menu link setting the desired template.

JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)

Please Log in or Create an account to join the conversation.

More
10 years 7 months ago #125713 by Jade
Thank you for the reply.

So were does itemform.php actually need to go so that I can have it customised for each category? I get the menu links, so can i just place itemform.php in my override categories, select it as a menu item and it will use that custom itemform.php?

So it would be:
mytemplate/html/com_k2/essay/itemform.php
mytemplate/html/com_k2/notes/itemform.php
mytemplate/html/com_k2/crossword/itemform.php

And then just make the selection using the menu links?

Please Log in or Create an account to join the conversation.

More
10 years 7 months ago #125714 by Jade
Its ok I've figured that out and now have custom add forms for each category.

What about the edit form? Which php files is and how can I show a individual edit form for each category. This in short will be the same as the add form for each category.

I have no problem hard coding the urls into the category files so I don';t have to use menu links, which is what I've jus done for the add form for each category.

Please Log in or Create an account to join the conversation.

More
10 years 7 months ago #125715 by Lefteris
Replied by Lefteris on topic Re: Different add/edit form for each category
It's not that simple. The code that generates the edit links can be found at line 104 of /components/com_k2/models/item.php. I strongly suggest that instead of hacking code you make template overrides for those categories and hardcode the edit link in the layouts.

JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)

Please Log in or Create an account to join the conversation.


Powered by Kunena Forum