Keyword

My Feature Requests (Wish List) for K2 v3

More
9 years 8 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
9 years 8 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
9 years 8 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
9 years 8 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
9 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
9 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
9 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
9 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
9 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.

  • Joe Campbell
  • Joe Campbell's Avatar Topic Author
  • Offline
  • Platinum Member
More
9 years 7 months ago #146916 by Joe Campbell
Replied by Joe Campbell on topic My Feature Requests (Wish List) for K2 v3
What if you want to serve up your own banners (announcements), banners you sell and third-party banners?

In that case, could/should you use something like DFP?



Is this what you mean by hardcoding the modules...


<?php
// no direct access
defined('_JEXEC') or die;
$view = JRequest::getVar("view", "item");
?>

<?php if($view == 'itemlist') : ?>

<!--Category List Banner Code Here-->

<?php else : ?>

<?php foreach ($items as $key=>$item): ?>

<!--Item Banner Code Here-->

<?php endforeach; ?>
<?php endif; ?>

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

More
9 years 7 months ago #146919 by Kumar Sara
Replied by Kumar Sara on topic My Feature Requests (Wish List) for K2 v3
Joe I setup a demo showing K2 as a banner manager. See reggae.websitedons.net/events

The 728x90 banner at the top are in rotation and randomly displayed by the K2 content module, more precisely, a revamped version of the module.

The Method
Create a text extra field for the banner URL - alias name exactly as topbanner
Create a radio extra field for new window or parent with options yes and no - alias exactly as newwin

Create a category and name it 728x90 banners
Set Item Image Options medium (or any other) to width 728
Set all options in all parameter tabs to hide (the module is handling display)

Add new items to the category with only the title and the Intro Image

The Module
As stated, we revamped the original K2 content module to do all kinds of stuff and just now added the banner display method so you can test. Get it at cmsenergizer.com/joomla-extensions/88-k2-content-module-revised Download the one with less download count. Its filename is mod_cmse_k2content-12-beta.zip I realized the title isn't showing because the display was modified.

Choose the category
Set Item Count to 1
Set Item Order to Random
Set Link Title to no
Set Image Size to Medium
Set Link Image to Ad Banner (this is the new addition for this demo)
Set Format to vertical-elements and clear the field below to just [image]
Assign to the position you want

----

All the content at the demo site is displayed only with K2

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.

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
9 years 7 months ago - 9 years 7 months ago #146959 by Krikor Boghossian
Replied by Krikor Boghossian on topic My Feature Requests (Wish List) for K2 v3
@Joe Campbell

You can donwload Takai www.joomlaworks.net/joomla-templates/free-templates/takai to see how these variables are set up.

You should go with this method (in your index.php file):
<?php
$option 			= JRequest::getCmd('option');
$view 			= JRequest::getCmd('view');
$layout 			= JRequest::getCmd('layout');
$page 			= JRequest::getCmd('page');
$task 			= JRequest::getCmd('task');
$id 				= JRequest::getInt('id');
?>

<?php if($option == 'com_k2' && $view == 'item' ): ?>

//Code that renders inside the item only

<?php elseif($option == 'com_k2' && $view == 'itemlist' && $task=='category'): ?>

//Code that renders inside the category only

<?php else:  ?>

//Fallback

<?php endif; ?>

You can combine it with the $id variable to render modules in specific K2 items only. The $option variable is used to limit the modules inside K2.

JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Last edit: 9 years 7 months ago by Krikor Boghossian.

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

  • Joe Campbell
  • Joe Campbell's Avatar Topic Author
  • Offline
  • Platinum Member
More
9 years 7 months ago #146963 by Joe Campbell
Replied by Joe Campbell on topic My Feature Requests (Wish List) for K2 v3
Kumar thanks for taking the time to modify your custom K2 Content Module.

What's your Twitter handle so I can follow you :)

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

  • Joe Campbell
  • Joe Campbell's Avatar Topic Author
  • Offline
  • Platinum Member
More
9 years 7 months ago #146965 by Joe Campbell
Replied by Joe Campbell on topic My Feature Requests (Wish List) for K2 v3
Thanks @Krikor - what about tag pages?

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

More
9 years 7 months ago #146971 by Kumar Sara
Replied by Kumar Sara on topic My Feature Requests (Wish List) for K2 v3

Joe Campbell wrote: Kumar... What's your Twitter handle so I can follow you :)

Strangely I do not have a Twitter account but the boss does @websitedons. I am only at Facebook www.facebook.com/cmsenergizer

We were attempting to get another wish list capability to output items by tag with the k2 content module, but have not had any accuracy. Finally just moved the related items code block of the item view template, to the right column to get sort of a Youtube clone. videos.websitedons.net/

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.

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
9 years 7 months ago #146988 by Krikor Boghossian
Replied by Krikor Boghossian on topic My Feature Requests (Wish List) for K2 v3
@Joe, change the $task to tag instead of category.

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

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

  • Joe Campbell
  • Joe Campbell's Avatar Topic Author
  • Offline
  • Platinum Member
More
9 years 7 months ago #147008 by Joe Campbell
Replied by Joe Campbell on topic My Feature Requests (Wish List) for K2 v3
Thanks @Krikor :)

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

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
9 years 7 months ago #147024 by Krikor Boghossian
Replied by Krikor Boghossian on topic My Feature Requests (Wish List) for K2 v3
You 're welcome mate.

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