Keyword

My Feature Requests (Wish List) for K2 v3

More
8 years 7 months ago #146877 by Kumar Sara
Replied by Kumar Sara on topic My Feature Requests (Wish List) for K2 v3
One of the really great feature of K2 is its simple coding override, so much of what you desire can be achieved in both front and back end using template overrides.

You can change the default display method of the extra fields by directly grabbing the values from the item objects, thereby giving you the ability to make any website type. I tend to keep all extra fields in a single group and use accordion tabs reduce visual clutter. I have written an article about this. See it at cmsenergizer.com/website-energy-guide/94-make-the-most-of-k2-content-construction-kit

When you see the images of the backend editor tabs, you will notice the Media tab is missing. This was done for the reason you mentioned about avoiding user confusion. An admin template override was used. components/com_k2/views/item/default.php

Maximizing the Power of K2 to cut third party extension dependency and increase website efficiency. cmsenergizer.com

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

  • Joe Campbell
  • Joe Campbell's Avatar Topic Author
  • Offline
  • Platinum Member
More
8 years 7 months ago #146879 by Joe Campbell
Replied by Joe Campbell on topic My Feature Requests (Wish List) for K2 v3
Hi Kumar,

It looks like we both feel the same away about K2 Extra Fields, as I too use it t populate the majority of my website (metadata, images, modal content, etc.)

I also keep all of the Extra Fields in one group (looking forward to multiple extra field group capabilities in v3)

Here are a few questions...

How did you execute the accordion feature?

Is there really a Admin Template Override or do you have to modify the core file?


Thanks,

Joe Campbell

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

More
8 years 7 months ago #146881 by Kumar Sara
Replied by Kumar Sara on topic My Feature Requests (Wish List) for K2 v3
Yes there really is an admin override for K2. It is exactly as with the frontend template override. Thanks to JW's insistence on sticking with the MVC system for all their extensions.

Copy administrator/components/com_k2/views/item/default.php
to administrator/templates/isis/html/com_k2/item
if you use a different default admin template, copy the file there.

For the accordion tabs, I used K2's 'Header' extra field type then implemented a jQuery plugin from Dynamic Drive called ddaccordion.js, but any accordion javascript will do. The script is called in the file using Joomla's JFactory::getDocument()->addScript()

From there it was just a matter of adding the trigger classes (tabhandle and tabcontent) to the Header and the fieldset elements. I had to remove table cells and use divs, and since the fields are dynamically created within a foreach loop, the divs had to be applied a bit funky as you will notice in the code below

Find the code block that is nicely commented as --Tab Extra Fields--
<?php if ($this->params->get('showExtraFieldsTab')): ?>

	<div class="simpleTabsContent" id="k2Tab5">
		<div id="extraFieldsContainer">
			<?php if (count($this->extraFields)): ?>
			<table class="admintable table" id="extraFields"><tr>
				<td>
				<?php foreach($this->extraFields as $extraField): ?>

					<?php if($extraField->type == 'header'): ?>
					</div>
					<div class="tabhandle"><h4 class="k2ExtraFieldHeader"><?php echo $extraField->name; ?></h4></div>
					<div class="tabcontent">

					<?php else: ?>

						<label class="fieldlbl"><?php echo '<h5 style="margin-bottom: 1px;">'.$extraField->name.'</h5>'; ?></label>
						<?php
							$descr = explode("\r\n", $extraField->descr);
							foreach($descr as $description) {
							echo '<span style="display: block; font-size: 12px; font-family: courier, monospace; line-height: normal;">
							'.$description.'</span>';
							}

						 echo $extraField->element;
						 ?>
				<?php endif; ?>

				<?php endforeach; ?></td></tr>
			</table>

			<?php else: ?>

				<div class="alert">
					<h4 class="alert-heading"><?php echo JText::_('K2_NOTICE'); ?></h4>
					<div>
						<p><?php echo JText::_('K2_PLEASE_SELECT_A_CATEGORY_FIRST_TO_RETRIEVE_ITS_RELATED_EXTRA_FIELDS'); ?></p>
					</div>
				</div>

			<?php endif; ?>
		</div>
		<?php if (count($this->K2PluginsItemExtraFields)): ?>
		<div class="itemPlugins">
			<?php foreach($this->K2PluginsItemExtraFields as $K2Plugin): ?>
			<?php if(!is_null($K2Plugin)): ?>
			<fieldset>
				<legend><?php echo $K2Plugin->name; ?></legend>
				<?php echo $K2Plugin->fields; ?>
			</fieldset>
			<?php endif; ?>
			<?php endforeach; ?>
		</div>
		<?php endif; ?>
	</div>
<?php endif; ?>

You will also notice a variable called $descr. That is not part of the original file. That is what outputs the description and instructions per field as seen at the article I published. That required another template override of com_k2/views/extrafield/default.php and an alteration of the database table #_k2_extrafield to add a row named descr

K2 has made life simpler for our clients because they now use only K2 for everything including video gallery, audio player and playlist, photo gallery, business directory, shopping cart (thanks to K2Store), event listing, contact form. Apart from Joomla's banner manager, our clients do not use any other extension.

As for your request for a module to show specific extra fields, a client made that request so a variation of mod_k2_content was developed to show selected fields. See it at fashion.websitedons.net/ . At the bottom left, titled Service Providers. It is sourcing from the Directory category and shows the phone extra field.

Maximizing the Power of K2 to cut third party extension dependency and increase website efficiency. cmsenergizer.com

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

  • Joe Campbell
  • Joe Campbell's Avatar Topic Author
  • Offline
  • Platinum Member
More
8 years 7 months ago #146882 by Joe Campbell
Replied by Joe Campbell on topic My Feature Requests (Wish List) for K2 v3
Thanks for providing such a detailed post.

As for banners, I am actually using K2 for that as well.

The core banner component has a limitation of only being able to be assigned to one category.

My banner categories mirror the content categories. Using K2 for banners, I am able to assign each banner to one or multiple categories by way of tags (Banner-Music, Banner-Shop, etc.)

I then randomly display one banner per module with the use of NoNumber Articles Anywhere.

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

More
8 years 7 months ago #146900 by Kumar Sara
Replied by Kumar Sara on topic My Feature Requests (Wish List) for K2 v3
My co-worker just pointed out that there was a core file hacked. Nothing major and not a problem if overwritten on upgrades. Just

The accordion works well once the item is saved or if the category is selected via the filter when in item list view. However, when in all items view and a new entry is being added, selecting the category while creating the item uses javascript to assign the associated extra fields. The fields are then called from administrator/com_k2/controllers/item.php which of course is not a template file that can be overidden. The changes done in the override file does not display.

To get the display during the js dynamic change required some display edits within the function extraFields code block
{     // MOD TO SHOW THE HEADERS
	$output .= '</div>
				<div class="tabhandle"><h4 class="k2ExtraFieldHeader">'.$extraField->name.'</h4></div>
				<div>';
}
else
{
// MOD TO DISPLAY FIELD DESCRIPTION AND INSTRUCTION
	//$output .= '<tr><td align="right" class="key"><label for="K2ExtraField_'.$extraField->id.'">'.$extraField->name.'</label></td>';
	//$output .= '<td>'.$extraFieldModel->renderExtraField($extraField, $itemID).'</td></tr>';
	$output .= '<label class="fieldlbl"><h5 style="margin-bottom: 1px;">'.$extraField->name.'</h5></label>';

	$descr = explode("\r\n", $extraField->descr);
		foreach($descr as $description) {
		$output .= '<span style="display: block; font-size: 12px; font-family: courier, monospace; line-height: normal;">'.$description.'</span>';
		}
	$output .= $extraFieldModel->renderExtraField($extraField, $itemID);
}

Maximizing the Power of K2 to cut third party extension dependency and increase website efficiency. cmsenergizer.com

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

  • Joe Campbell
  • Joe Campbell's Avatar Topic Author
  • Offline
  • Platinum Member
More
8 years 7 months ago #146902 by Joe Campbell
Replied by Joe Campbell on topic My Feature Requests (Wish List) for K2 v3
Thanks again - this is a bit over my skill level. I am not a developer (simply a problem solver and content creator)

Any thoughts on my K2 v3 Wish List and solution for using K2 to serve up banners?

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

More
8 years 7 months ago #146904 by Kumar Sara
Replied by Kumar Sara on topic My Feature Requests (Wish List) for K2 v3
I did not see that wish in the list.

You could just create a category and add items with just the intro image then display the images with the K2 content module. You may have search engine errors though since the pages may be cached and returned in search results. It could become quite chaotic, cumbersome and negate search scores so this may not be a good option.

I think banner management has to remain as a separate extension. What is needed is a function to tie into K2's tags

Maximizing the Power of K2 to cut third party extension dependency and increase website efficiency. cmsenergizer.com

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

  • Joe Campbell
  • Joe Campbell's Avatar Topic Author
  • Offline
  • Platinum Member
More
8 years 7 months ago #146905 by Joe Campbell
Replied by Joe Campbell on topic My Feature Requests (Wish List) for K2 v3
How would the banner items be visible if there is no link to them?

As a secondary caution I am going to use the .htaccess file to redirect to the homepage for when any page is accessed with that path: /extras/banners/

How could you solely use a K2 Content Module when it does not offer the option to display one random item?

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

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
8 years 7 months ago #146915 by Krikor Boghossian
Replied by Krikor Boghossian on topic My Feature Requests (Wish List) for K2 v3
I personally use DFP for banner requirements.
Based on Joomla!'s task or view you can hardcode module positions in your template which only affect categories or items.

Finally if a certain item needs different banners but mapping it into a menu is not an option then you can use the view and id to publish a specific module position for that item.

You can even combine DFP with com_banners and have Joomla!'s banner modules serve DFP's code.

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