I recently did some hack-ish modification of my k2 template and wanted to get some feedback. I wanted to include a slide from the module "tabs and slides" from joomlaworks inside of my k2 items. This way I could include an image gallery within a slide on the item view page and not have a bunch of thumbnails unless someone open the slide. I am using simple image gallery pro in the items, and wanted to make it easy for my client to utilize the built in gallery upload within k2, but have it end up inside a slide. In order to do this I downloaded and installed the tabs and slides module and proceeded to break it apart to use within the k2 template. I then added the necessary code to the item.php file within my k2 template overrides, within my js_inspirion template. 1) I had to add the necessary javascript and css files so at the top of item.php, underneath the //no direct access line, I placed <?php/** * @version $Id: item.php 303 2010-01-07 02:56:33Z joomlaworks $ * @package K2 * @author JoomlaWorks www.joomlaworks.gr * @copyright Copyright (c) 2006 - 2010 JoomlaWorks Ltd. All rights reserved. * @license GNU/GPL license: www.gnu.org/copyleft/gpl.html */// no direct accessdefined('_JEXEC') or die('Restricted access');?><!-- added scripts and stylesheet for slides to work here--><?php JHTML::script($filename='tabs_slides_comp.js', $path = 'plugins/content/plugin_jw_ts/')?><?php JHTML::script($filename='tabs_slides.js', $path = 'plugins/content/plugin_jw_ts/')?><?php JHTML::script($filename='tabs_slides_opt_loader.js', $path = 'plugins/content/plugin_jw_ts/')?><?php JHTML::stylesheet($filename='tabs_slides.css', $path = 'plugins/content/plugin_jw_ts/')?><?php JHTML::script($filename='speed_info.js', $path = 'plugins/content/plugin_jw_ts/')?><!-- end additions for slides --><!-- Start K2 Item Layout --> . . . This adds the javascript that is included for "tabs and slides", the stylesheet and a new .js file that I created to hold the speed variables that are normally passed from the plugin admin to the code. I am not that good so I just hard coded the values into the .js at the speed that I wanted them. I didn't want the sliding effect, so i made it fast. the only code within that file isvar jwts_slideSpeed="10000"; var jwts_timer="1"; 2) Then where the gallery is called to the page I placed <?php if($this->item->params->get('itemImageGallery') && !empty($this->item->gallery)): ?> <!-- Item image gallery --> <a name="itemImageGalleryAnchor" id="itemImageGalleryAnchor"></a> <!-- added to include slides in gallery --> <div class="jwts_title"><div class="jwts_title_left"><a href="javascript:void(null);" title="Click to open!" class="jwts_title_text"><?php echo $this->item->title; ?>'s Photo Gallery</a></div></div><div class="jwts_slidewrapper"><div></p> <!-- end added to include slides in gallery --> <div class="itemImageGallery"> <?php echo $this->item->gallery; ?> </div> <!-- closing tags slides in gallery --> <p></div></div></p> <!-- end closing tags slides in gallery --> <?php endif; ?>I have commented around the areas that I added, but the code is what gets added automatically by the "tabs and slides" plugin when it replaces the {slide},{/slide} tags that get entered into an article. Some modifications to the css later and I have a fully functioning gallery slide within my content items. I have been working with Joomla for a while now, and really want to hear some feedback as to whether this is a good idea or not, I know that it has worked for me so far, still need to do some testing, but wanted to throw it out there. Feedback would be great, I think this is a nice thing to have within a k2 item, and when I get some time want to develop it as an extension. I can't help but feel that I have made this more difficult than it needed to be, but I have learned a lot about the power of k2 in the process. Would love some feedback. It's on a local server and won't run it live for a few days unless someone is really interested in seeing it.
16 years 8 months ago #80045