- Posts: 7
COMMUNITY FORUM
- Forum
- K2 Community Forum
- English K2 Community
- How to set k2 custom template for frontend editing button
How to set k2 custom template for frontend editing button
- hooman hamedifar
-
Topic Author
- Offline
- New Member
Less
More
10 years 4 months ago #134978
by hooman hamedifar
How to set k2 custom template for frontend editing button was created 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
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
-
- Offline
- Platinum Member
Less
More
- Posts: 15920
10 years 4 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.
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.
Please Log in or Create an account to join the conversation.
- barryP
-
- Offline
- New Member
Less
More
- Posts: 13
10 years 1 month ago #142688
by barryP
Replied by barryP on topic How to set k2 custom template for frontend editing button
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
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
-
- Offline
- Platinum Member
Less
More
- Posts: 15920
10 years 1 month 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.
Please Log in or Create an account to join the conversation.
- barryP
-
- Offline
- New Member
Less
More
- Posts: 13
10 years 1 month ago #142701
by barryP
Replied by barryP on topic How to set k2 custom template for frontend editing button
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
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.
- barryP
-
- Offline
- New Member
Less
More
- Posts: 13
10 years 1 month ago - 10 years 1 month ago #142704
by barryP
Replied by barryP on topic How to set k2 custom template for frontend editing button
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
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: 10 years 1 month ago by barryP. Reason: typo
Please Log in or Create an account to join the conversation.
- Krikor Boghossian
-
- Offline
- Platinum Member
Less
More
- Posts: 15920
10 years 1 month 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.
You can also use jInput ( docs.joomla.org/Retrieving_request_data_using_JInput ) or JRequest::getCmd() to perform these checks.
Please Log in or Create an account to join the conversation.
- Jack Hughes
-
- Offline
- Junior Member
Less
More
- Posts: 29
10 years 1 month ago - 10 years 1 month ago #142780
by Jack Hughes
Replied by Jack Hughes on topic How to set k2 custom template for frontend editing button
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.
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: 10 years 1 month ago by Jack Hughes.
Please Log in or Create an account to join the conversation.
- barryP
-
- Offline
- New Member
Less
More
- Posts: 13
10 years 1 month ago #142788
by barryP
Replied by barryP on topic How to set k2 custom template for frontend editing button
Jack
You could try my suggested solution above
That's what I'm doing & it seems to work.
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
-
- Offline
- Platinum Member
Less
More
- Posts: 15920
10 years 1 month ago #142796
by Krikor Boghossian
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.
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.
Please Log in or Create an account to join the conversation.
- Forum
- K2 Community Forum
- English K2 Community
- How to set k2 custom template for frontend editing button