Keyword

How to set k2 custom template for frontend editing button

  • hooman hamedifar
  • hooman hamedifar's Avatar Topic Author
  • Offline
  • New Member
More
9 years 3 months ago #134978 by hooman hamedifar
Hi All,
I enabled frontend editing in k2 and it works fine. but I have problem in K2 template. I made an template for k2 by overriding "itemform.php". when user clicks on "add new item" menu, a popup opens for adding item and it uses my template, and user can add item . but when it is finished and user browse k2 category and see that item, he can click on "edit this item" button on top right corner of item. and there is a popup open for editing item with K2 default template, not my own template. Now my problem is that how can set it to use my own template.
thanks

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

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
9 years 3 months ago #134998 by Krikor Boghossian
Replied by Krikor Boghossian on topic How to set k2 custom template for frontend editing button
Hello,

Did you follow this tutorial?
getk2.org/documentation/tutorials/174-templating-with-k2-and-the-concepts-of-sub-templates

If you need to use two or more custom itemforms then you need to map them to menu items. In all other cases the default (or its override) will be shown.

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

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

More
8 years 11 months ago #142688 by barryP
Krikor

I have the same problem. I need to have custom itemform.php for certain k2 categories but assigning a new subtemplate to these categories & editting their itemform.php files does nothing. I still get the default itemform !

"If you need to use two or more custom itemforms then you need to map them to menu items. "

How ???

Regards

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

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
8 years 11 months ago #142694 by Krikor Boghossian
Replied by Krikor Boghossian on topic How to set k2 custom template for frontend editing button
Simply create a new menu item (same way as you did with your categories, just select the item edit form) and select the template you want to use.

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

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

More
8 years 11 months ago #142701 by barryP
Krikor

Thanks

This just gives me a way to ADD a new item to the selected category but how about Editting an existing item with my new itemform ?

Also, itemform appears in a full screen window - not a modal window - and CLOSE button does nothing

Barry

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

More
8 years 11 months ago - 8 years 11 months ago #142704 by barryP
How about

1. Create my own item subtemplate but add "&catid=$this->category->id" to $this->addLink
This will pass the category id to addform
2. Override default/itemform.php with
<?php
switch($this->row->catid) {
case 3:
include dirname(__FILE__)."/itemform3.php";
break;
case 4:
include dirname(__FILE__)."/itemform4.php";
break;
default:
include dirname(__FILE__)."/itemformDefault.php";
}

?>

Barry
Last edit: 8 years 11 months ago by barryP. Reason: typo

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

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
8 years 11 months ago #142713 by Krikor Boghossian
Replied by Krikor Boghossian on topic How to set k2 custom template for frontend editing button
That could work.
You can also use jInput ( docs.joomla.org/Retrieving_request_data_using_JInput ) or JRequest::getCmd() to perform these checks.

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

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

More
8 years 11 months ago - 8 years 11 months ago #142780 by Jack Hughes
I am running into the same problem.

Can Joomlaworks confirm that we cannot create a layout override for itemform.php using the standard Joomla/K2 sub template approach?

Is this a bug or feature? Is there a work around?

We need to create customized itemform.php layouts for different k2 category branches. We need to be able to use the "Edit Item" button from the K2 item. The menu item, create K2 Item solution I have seen mentioned on these boards is not a solution.

We are working with clients who require much more elegant and customized content forms. We have been touting the power of K2 and now we seem to keep bumping up against K2 issues.
Last edit: 8 years 11 months ago by Jack Hughes.

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

More
8 years 11 months ago #142788 by barryP
Jack

You could try my suggested solution above

That's what I'm doing & it seems to work.

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

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
8 years 11 months ago #142796 by Krikor Boghossian
Replied by Krikor Boghossian on topic How to set k2 custom template for frontend editing button

Can Joomlaworks confirm that we cannot create a layout override for itemform.php using the standard Joomla/K2 sub template approach?


You can if you map this form into a menu item.

If you do not want to use different menu item then you can try barry's solution.

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