- Posts: 5
COMMUNITY FORUM
"Edit Item" only thru component area?
- isnard
- Topic Author
- Offline
- New Member
Less
More
12 years 2 months ago #101621
by isnard
"Edit Item" only thru component area? was created by isnard
Hello,
For a while, I couldn't figure out why my "Edit Item" button wasn't showing on my frontend.
It seems "Edit Item" works only through component type editable region.
And actually, I wouldn't use this type of region because it doesn't let me have multiple regions.
The story is quite simple.
For a fanzine website, I need writers to edit their own block on the same page.
When adding <jdoc:include type="component">, I have one single region.
So I started using K2, because I can set multiple K2 Content for different Articles.
Which is great.
But alas, those K2 Content modules don't let have the "Edit Item" button on frontend.
Please, I need your help!
Whether to create multiple frontend editable regions for my fanzine.
Or sort the "Edit Item" issue out..
Cheers!
Laurent
For a while, I couldn't figure out why my "Edit Item" button wasn't showing on my frontend.
It seems "Edit Item" works only through component type editable region.
And actually, I wouldn't use this type of region because it doesn't let me have multiple regions.
The story is quite simple.
For a fanzine website, I need writers to edit their own block on the same page.
When adding <jdoc:include type="component">, I have one single region.
So I started using K2, because I can set multiple K2 Content for different Articles.
Which is great.
But alas, those K2 Content modules don't let have the "Edit Item" button on frontend.
Please, I need your help!
Whether to create multiple frontend editable regions for my fanzine.
Or sort the "Edit Item" issue out..
Cheers!
Laurent
Please Log in or Create an account to join the conversation.
- william white
- Offline
- Platinum Member
Less
More
- Posts: 3722
12 years 2 months ago #101622
by william white
Replied by william white on topic Re: "Edit Item" only thru component area?
You might try overriding mod_k2_content and adding the lines of code which you will find in
the components item.php. I havent tried this, it may or may not work
Search for
<?php if(isset($this->item->editLink)): ?>
in your normal item view and get the code from there
Move it to the override for mod_k2_content file tmpl/default/default.php and see if the edit link will show
the components item.php. I havent tried this, it may or may not work
Search for
<?php if(isset($this->item->editLink)): ?>
in your normal item view and get the code from there
Move it to the override for mod_k2_content file tmpl/default/default.php and see if the edit link will show
Please Log in or Create an account to join the conversation.
- Matthew Cowan
- Offline
- New Member
Less
More
- Posts: 4
12 years 2 months ago #101623
by Matthew Cowan
Replied by Matthew Cowan on topic Re: "Edit Item" only thru component area?
If you are trying to edit the mod_k2_content/tmlp/Default/default.php file you will also need to steal some code from components/mod_k2/models/item.php. I was able to acheive this by inserting the following into default.php, right after the itemTitle:
//stolen from components/com_k2/models/item.php
<?php if (K2HelperPermissions::canEditItem($item->created_by, $item->catid))
$item->editLink = JRoute::_('index.php?option=com_k2&view=item&task=edit&cid='.$item->id.'&tmpl=component'); ?>
//stolen from components/com_k2/templates/default/item.php
<?php if(isset($item->editLink)): ?>
<!-- Item edit link -->
<span class="itemEditLink">
<a class="modal" rel="{handler:'iframe',size:{x:990,y:550}}" href="<?php echo $item->editLink; ?>">
<?php echo JText::_('K2_EDIT_ITEM'); ?>
</a>
</span>
<?php endif; ?>
Please Log in or Create an account to join the conversation.
- isnard
- Topic Author
- Offline
- New Member
Less
More
- Posts: 5
12 years 2 months ago #101624
by isnard
Replied by isnard on topic Re: "Edit Item" only thru component area?
Brilliant! Works perfectly.
Thanks a lot.
I've used Matt's overriding code,
Well, I'm really happy! xx
:cheer: :cheer:
Thanks a lot.
I've used Matt's overriding code,
Well, I'm really happy! xx
:cheer: :cheer:
Please Log in or Create an account to join the conversation.