splitting the paragraph into 2 sections in wordpress - php

I'm building a property section in WordPress that leaves me with a long and excruciating list of information when the code draws the data. This list should be divided into 2 sections to save more space on the page when on desktops, etc.
<a name="rooms"></a>
<h3><?php echo __("Property Details", "wppf"); ?></h3>
<?php foreach ($paragraphs as $paragraph) : ?>
<div class="clearfix">
<?php if ($paragraph['name'] != '') : ?>
<h4><?php echo $paragraph['name'] ?></h4>
<?php endif; ?>
<?php if ($paragraph['filesortorder'] != '') : ?>
<?php echo ($paragraph['filesortorder']); ?>
<?php endif; ?>
<p>
<?php if ($paragraph['dimensions'] != "") : ?>
<em><?php echo $paragraph['dimensions'] ?></em>
<br />
<?php endif; ?>
<?php echo $paragraph['description'] ?>
</p>
</div>
<?php endforeach; ?>
<?php foreach ($links as $link) : ?>
<div class="clearfix">
<a href="<?php echo $link['url']; ?>" target="_blank">
<?php echo (empty($link['name'])) ? $link['url'] : $link['name']; ?>
</a>
</div>
<?php endforeach; ?>
There is a maximum of 10 sections that it fills in and I want to split that into 2 groups of 5.

Something like...
if(count($paragraphs) > 5) {
$paragraphs2 = array_splice($paragraphs, 5);
}
Would let you split the paragraphs > 5 into another array.
You'd then just need to output those in your code as you see fit - something like:
<?php foreach ($paragraphs2 as $paragraph2) :?>
<div class="clearfix">
<?php if ($paragraph2['name']!=''):?>
<h4>
<?php echo $paragraph2['name'] ?>
</h4>
<?php endif; ?>
<?php if ($paragraph2['filesortorder']!=''):?>
<?php echo ($paragraph2['filesortorder']); ?>
<?php endif; ?>
<p>
<?php if ($paragraph2['dimensions']!=""):?>
<em>
<?php echo $paragraph2['dimensions'] ?>
</em>
<br />
<?php endif;?>
<?php echo $paragraph2['description'] ?>
</p>
</div>
<?php endforeach;?>
Should get you started to loop through and repeat the relevant display code.

Related

How to show k2 items in k2 content module in 3 columns?

Joomla k2 component is power Joomla content system. k2 has a module that's called k2 content module and you can override the layout template of it.
I had this code for my k2 content module, this template file shows k2 items in 2 columns with even and odd classes and extra fields in it.
<?php
// no direct access
defined('_JEXEC') or die;
// includes placehold
$yt_temp = JFactory::getApplication()->getTemplate();
include (JPATH_BASE . '/templates/'.$yt_temp.'/includes/placehold.php');
?>
<div id="k2ModuleBox<?php echo $module->id; ?>" class="k2ItemsBlock<?php
if($params->get('moduleclass_sfx')) echo ' '.$params-
>get('moduleclass_sfx'); ?>">
<?php if($params->get('itemPreText')): ?>
<p class="modulePretext"><?php echo $params->get('itemPreText'); ?></p>
<?php endif; ?>
<?php if(count($items)): ?>
<ul class="product">
<?php foreach ($items as $key=>$item): ?>
<li class="<?php echo ($key%2) ? "odd" : "even"; if(count($items)==$key+1)
echo ' lastItem'; ?>">
<?php if($params->get('itemImage') || $params->get('itemIntroText')): ?>
<?php if($params->get('itemImage')): ?>
<div class="product-image">
<img src="<?php echo $item->image; ?>" alt="<?php echo
K2HelperUtilities::cleanHtml($item->title); ?>" />
</div>
<?php endif; ?>
<div class="main">
<?php if($params->get('itemTitle')): ?>
<p class="moduleItemTitle"><?php echo $item->title; ?></p>
<?php endif; ?>
<?php if($params->get('itemIntroText')): ?>
<div class="introtext">
<?php echo $item->introtext; ?>
</div>
<?php endif; ?>
<!-- end main-->
<?php if($params->get('itemExtraFields') && count($item->extra_fields)): ?
>
<div class="moduleItemExtraFields-energi">
<ul>
<?php foreach ($item->extra_fields as $extraField): ?>
<?php if($extraField->value != ''): ?>
<li class="type<?php echo ucfirst($extraField->type); ?>
group2">
<?php if($extraField->type == 'header'): ?>
<h4 class="moduleItemExtraFieldsHeader"><?php echo
$extraField->name; ?></h4>
<?php else: ?>
<span class="moduleItemExtraFieldsLabel"><?php echo
$extraField->name; ?></span>
<span class="moduleItemExtraFieldsValue"><?php echo
$extraField->value; ?></span>
<?php endif; ?>
<div class="clr"></div>
</li>
<?php endif; ?>
<?php endforeach; ?>
</ul>
</div>
<?php endif; ?>
</div>
<?php endif; ?>
<div class="clr"></div>
</li>
<?php endforeach; ?>
<li class="clearList"></li>
</ul>
<?php endif; ?>
</div>
I would like to show my articles in 3 columns with extra fields.
How to do this? If it's possible, help me to do it.
Thanks for your attention.

magento do not display title and logo when manufacturer attribute is set to empty

I am working with the following codes for Magento inside product page view.phtml.
<div class="manufacturer">
<?php if ($_product->getAttributeText('manufacturer') == "Bellazza" || "Della" || "Pet Zone" || "Spyder Auto" ):?>
<div class="dealer">
<p>Authorized Dealer:</p>
</div>
<div class="logoImg">
<?php echo $this->getLayout()->createBlock('manufacturer/manufacturer')->setProduct($_product)->setTemplate('manufacturer/product_manufacturer.phtml')->toHtml();?>
</div>
<?php elseif ?>
<?php endif;?>
</div>
So I create div.manufacturer to display associated brand logo image started by the title "Authorized Dealer". It works. But not all products have a brand so when I set the manufacturer attribute to empty ( refer to the image below ) I don't need the title "Authorized Dealer" anymore. What is the best practice to approach the elseif. Thank you
manufacturer/manufacturer.phtml
<?php
$maufacturers = Mage::getModel('manufacturer/manufacturer')->getCollection()->addFieldToFilter('status',Array('eq'=>1));
$_columnCount=4;
$i=0;
?>
<div class="manufacturer-list">
<?php foreach($maufacturers as $manufacturer): ?>
<?php if(Mage::getModel('eav/entity_attribute_source_table')->setAttribute(Mage::getModel('eav/entity_attribute')->load(Mage::getModel('eav/entity_attribute')->getIdByCode('catalog_product',"manufacturer")))->getOptionText($manufacturer->getMenufecturerName())): ?>
<?php if ($i++%$_columnCount==0): ?>
<ul>
<?php endif; ?>
<li>
<a href="<?php echo $this->getBaseUrl()."catalogsearch/advanced/result/?manufacturer[]=".$manufacturer->getMenufecturerName() ?>">
<?php echo $this->getLayout()->createBlock('core/template')->setmanufacturerimage($manufacturer->getFilename())->setlegend($manufacturer->getLegend())->setListPageFlag(1)->setTemplate('manufacturer/manufacturer_resize.phtml')->toHtml(); ?>
</a>
<div class="manufacturer-name">
<?php echo Mage::getModel('eav/entity_attribute_source_table')->setAttribute(Mage::getModel('eav/entity_attribute')->load(Mage::getModel('eav/entity_attribute')->getIdByCode('catalog_product',"manufacturer")))->getOptionText($manufacturer->getMenufecturerName()) ?>
</div>
</li>
<?php if ($i%$_columnCount==0 && $i!=count($maufacturers)): ?>
</ul>
<?php endif; ?>
<?php endif; ?>
<?php endforeach; ?>
</div>
product_manufacturer
<?php
$product=$this->getProduct();
if(Mage::getModel('eav/entity_attribute_source_table')->setAttribute(Mage::getModel('eav/entity_attribute')->load(Mage::getModel('eav/entity_attribute')->getIdByCode('catalog_product',"manufacturer")))->getOptionText($product->getData('manufacturer'))):
$manufacturers=Mage::getModel('manufacturer/manufacturer')->getCollection()->addFieldToFilter('menufecturer_name',$product->getData('manufacturer'));
foreach($manufacturers as $manufacturer){
$status=$manufacturer->getStatus();
if($status==1){
?>
<div class="manufacturer-img-box">
<a href="<?php echo $this->getBaseUrl()."catalogsearch/advanced/result/?manufacturer[]=".$manufacturer->getMenufecturerName() ?>">
<?php echo $this->getLayout()->createBlock('core/template')->setmanufacturerimage($manufacturer->getFilename())->setlegend($manufacturer->getLegend())->setTemplate('manufacturer/manufacturer_resize.phtml')->toHtml(); ?>
</a>
</div>
<?php }
}
endif;
?>
You need refactoring the code
<div class="manufacturer">
<div class="logoImg">
<?php echo $this->getLayout()->createBlock('manufacturer/manufacturer')->setProduct($_product)->setTemplate('manufacturer/product_manufacturer.phtml')->toHtml();?>
</div>
</div>
and check variable
<?php if(!is_null($manufacturer->getMenufecturerName())): ?>
<div class="manufacturer-name">
<?php
echo Mage::getModel('eav/entity_attribute_source_table')
->setAttribute(Mage::getModel('eav/entity_attribute')
->load(Mage::getModel('eav/entity_attribute')
->getIdByCode('catalog_product',"manufacturer")))
->getOptionText($manufacturer->getMenufecturerName())
?>
</div>
<?php endif; ?>
And you need refactoring your code. Because I loock much excess code in your template. You need get data in you block and in phtml you need render this data by API blocks. getImageSrc(); getManufactures() and more over methods for get processed information.

Using getChildHtml to display product attributes not working

I have added a to my catalog.xml file, created a specifications.phtml file to be used as the template, and I’m calling echo $this->getChildHtml(’specifications’); in my view.phtml file.
However it’s not displaying anything at all. I’ve basically mirrored everything after the same type of thing for the product description (which works) but I’m not having any luck.
The content that I’m trying to pull in is under the product page and I think a custom section that is labeled “Specifications Tab”. Not sure if the space in the field name is causing issues or what.
Here is what I have in my view.phtml file:
<div id="product-tabs" class="tabs">
<ul class="tabs-nav">
<li><?php echo $this->__('Description'); ?></li>
<?php
$specificationsTabContent = $_product->getSpecificationsTab();
$videoTabContent = $_product->getVideoTab();
$faqTabContent = $_product->getFaqTab();
$howitworksTabContent = $_product->getHowitworksTab();
$awardsTabContent = $_product->getAwardsTab();
?>
<?php #if ($this->getChildHtml('specifications_tab')): #($this->getChildHtml('product_attributes')): ?>
<?php if (!empty($specificationsTabContent)) : ?>
<li><?php echo $this->__('Specs'); ?></li>
<?php endif; ?>
<?php if (!empty($videoTabContent)) : ?>
<li><?php echo $this->__('Videos14'); ?></li>
<?php endif; ?>
<?php if (!empty($faqTabContent)) : ?>
<li><?php echo $this->__('FAQs'); ?></li>
<?php endif; ?>
<?php if (!empty($howitworksTabContent)) : ?>
<li><?php echo $this->__('How It Works'); ?></li>
<?php endif; ?>
<?php if (!empty($awardsTabContent)) : ?>
<li><?php echo $this->__('Awards'); ?></li>
<?php endif; ?>
<!-- <li><?php #echo $this->__('Tags'); ?></li> -->
<?php if ($this->getChildHtml('snippet_product_view_tab_1')): ?>
<li><?php echo $this->__('Custom 1'); ?></li>
<?php endif; ?>
<?php if ($this->getChildHtml('snippet_product_view_tab_2')): ?>
<li><?php echo $this->__('Custom 2'); ?></li>
<?php endif; ?>
</ul>
<div class="tabs-content">
<div id="tab-description">
<?php echo $this->getChildHtml('description'); ?>
</div>
<div id="tab-details">
<?php #echo $this->getChildHtml('specifications'); ?>
<?php echo $specificationsTabContent; ?>
</div>
<div id="tab-faq">
<?php echo $faqTabContent; ?>
</div>
<div id="tab-video">
<?php echo $videoTabContent; ?>
</div>
<div id="tab-howitworks">
<?php echo $howitworksTabContent; ?>
</div>
<div id="tab-awards">
<?php echo $awardsTabContent; ?>
</div>
<!-- <div id="tab-tags">
<?php echo $this->getChildHtml('product_additional_data') ?>
</div> -->
<?php if ( $this->getChildHtml('snippet_product_view_tab_1') ): ?>
<div id="tab-custom-1">
<div class="snippet snippet-product-view-tab-1"><?php echo $this->getChildHtml('snippet_product_view_tab_1') ?></div>
</div>
<?php endif; ?>
<?php if ( $this->getChildHtml('snippet_product_view_tab_2') ): ?>
<div id="tab-custom-2">
<div class="snippet snippet-product-view-tab-2"><?php echo $this->getChildHtml('snippet_product_view_tab_2') ?></div>
</div>
<?php endif; ?>
</div>
</div>
This is the XML I added to my catalog.xml:
<!-- specifications -->
<block type="catalog/product_view_specifications" name="product.specifications.tab" as="specifications" template="catalog/product/view/specifications.phtml"/>
And this is the template file specifications.phtml:
<?php $_specifications = $this->getProduct()->getSpecificationsTab(); ?>
<?php if ($_specifications): ?>
<h2><?php echo $this->__('Specifications') ?></h2>
<div class="long-description std">
<?php echo $this->helper('catalog/output')->productAttribute($this->getProduct(), $_specifications, 'specifications') ?>
</div>
<?php endif; ?>
Any help would be greatly appreciated! I’m not overly familiar with Magento or PHP.
Thanks,
JUst change
<?php #echo $this->getChildHtml('specifications'); ?>
to
<?php echo $this->getChildHtml('specifications'); ?>

Joomla 3.2.1 Module Layout Override: Need to move category title subheading above grouped article titles

I'm trying to create a mod_articles_category layout override for a Joomla 3.2.1 site.
I have 1 parent article category and about 10 child categories under it.
The default is to display the category title in parentheses beneath each article title, which looks crowded and repetitive.
What I'd like to do is display each category title subheading once above each child group of article titles.
So far, I've got it to display the category title (see comment below) but for some strange reason, it is displaying underneath the group of articles it relates to, instead of above it. How can I get it to move above each child group of article titles?
Thanks in advance for any tips.
======================
<ul class="category-module<?php echo $moduleclass_sfx; ?>">
<?php if ($grouped) : ?>
<?php foreach ($list as $group_name => $group) : ?>
<li>
<ul>
<!-- THIS IS THE CATEGORY TITLE SUBHEADING -->
<?php if ($item->displayCategoryTitle) :?>
<h3><?php echo $item->displayCategoryTitle; ?>
</h3>
<?php endif; ?>
<?php foreach ($group as $item) : ?>
<li>
<?php if ($params->get('link_titles') == 1) : ?>
<a class="mod-articles-category-title <?php echo $item->active; ?>" href="<?php echo $item->link; ?>">
<?php echo $item->title; ?>
</a>
<?php else : ?>
<?php echo $item->title; ?>
<?php endif; ?>
<?php if ($item->displayHits) : ?>
<span class="mod-articles-category-hits">
(<?php echo $item->displayHits; ?>)
</span>
<?php endif; ?>
<?php if ($params->get('show_author')) :?>
<span class="mod-articles-category-writtenby">
<?php echo $item->displayAuthorName; ?>
</span>
<?php endif;?>
<?php if ($item->displayDate) : ?>
<span class="mod-articles-category-date"><?php echo $item->displayDate; ?></span>
<?php endif; ?>
<?php if ($params->get('show_introtext')) :?>
<p class="mod-articles-category-introtext">
<?php echo $item->displayIntrotext; ?>
</p>
<?php endif; ?>
<?php if ($params->get('show_readmore')) :?>
<p class="mod-articles-category-readmore">
<a class="mod-articles-category-title <?php echo $item->active; ?>" href="<?php echo $item->link; ?>">
<?php if ($item->params->get('access-view') == false) :
echo JText::_('MOD_ARTICLES_CATEGORY_REGISTER_TO_READ_MORE');
elseif ($readmore = $item->alternative_readmore) :
echo $readmore;
echo JHtml::_('string.truncate', $item->title, $params->get('readmore_limit'));
if ($params->get('show_readmore_title', 0) != 0) :
echo JHtml::_('string.truncate', ($this->item->title), $params->get('readmore_limit'));
endif;
elseif ($params->get('show_readmore_title', 0) == 0) :
echo JText::sprintf('MOD_ARTICLES_CATEGORY_READ_MORE_TITLE');
else :
echo JText::_('MOD_ARTICLES_CATEGORY_READ_MORE');
echo JHtml::_('string.truncate', ($item->title), $params->get('readmore_limit'));
endif; ?>
</a>
</p>
<?php endif; ?>
</li>
<?php endforeach; ?>
</ul>
</li>
<?php endforeach; ?>
Change
<?php if ($item->displayCategoryTitle) :?>
<h3><?php echo $item->displayCategoryTitle; ?>
</h3>
<?php endif; ?>
to
<h3><?php echo $group_name; ?></h3>

joomla/k2 php template overrides

Really need some help after many hours of banging head against a brick wall!
Basically I have a Joomla News page made in the K2 component. The page would have the top story, the next two, then the next four and the next four after that all with their own class so they can be styled differently for emphasis (like most news websites).
So there would be one row of one column - main news (with items image and text cut off after about 150 words with a 'read more')
second row - two columns - next two news pieces (with items image and text cut off after about 150 words with a 'read more')
third row - four columns - next four news pieces (with items image and text cut off after about 150 words with a 'read more')
fourth row - one column of eight links (no image just the title linked)
This is the file I'm trying to amend:
<?php
// no direct access
defined('_JEXEC') or die;
$selectedFilters=$params->get('extraFieldsSelect'); //get selected fields in module params
?>
<div id="k2ModuleBox<?php echo $module->id; ?> k2FiltrifyContainer" class="k2Filtrify k2ItemsBlock<?php if($params->get('moduleclass_sfx')) echo ' '.$params->get('moduleclass_sfx'); ?>">
<?php if($params->get('itemPreText')): ?>
<p class="modulePretext"><?php echo $params->get('itemPreText'); ?></p>
<?php endif; ?>
<!--Filtrify Placeholder-->
<div id="k2FiltrifyPlaceHolder"></div>
<?php //set placeholder, if LEGEND is the selected callback method
if($placeholder == 'legend'): ?>
<!--Filtrify legend placeholder-->
<div id="legend"><i><?php echo JText::_('K2_VIEWING_ALL'); ?></i></div>
<?php endif; ?>
<?php //set placeholder, if PAGINATION is the selected callback method
if($placeholder == 'pagination'): ?>
<!--Filtrify pagination placeholder-->
<div id="pagination"></div>
<?php endif; ?>
<?php if(count($items)): //Filtrify Container?>
<ul id="k2FiltrifyContainer">
<p>
<?php foreach ($items as $keyItem=>$item): ?>
<?php
// Define a CSS class for the last container on each row
if( (($keyItem+1)%($params->get('num_columns'))==0) || count($items)<$params->get('num_columns') )
$lastContainer= ' itemContainerLast';
else
$lastContainer='';
?>
<li class="itemContainer<?php echo $lastContainer; ?>" <?php echo (count($items)==1) ? '' : ' style="width:'.number_format(100/$params->get('num_columns'), 1).'%;"'; ?>
<?php
if( count($item->extra_fields) && $selectedFilters != ''): //check if there are extrafields and selected fields?>
<?php foreach ($item->extra_fields as $key=>$extraField): //adding extrafields as data parameter?>
<?php if(in_array($extraField->id,(array)$selectedFilters, TRUE)) : ?>
data-<?php echo preg_replace("/[^A-Za-zA-yA-y0-9а-яА-Яa-zA-Z?-??-?sctzlldSCTZLD]/ui", "_", $extraField->name); ?>="<?php echo $extraField->value; //set the values, and remove special chars?>"
<?php endif; ?>
<?php endforeach; ?>
<?php endif; ?>
<?php if($params->get('showCatFilter')==1): //check for param - show category filter?>
data-<?php echo preg_replace("/[^A-Za-zA-yA-y0-9а-яА-Яá-źÁ-ŹΑ-Ωα-ωščťžľĺďŠČŤŽĹĎ]/ui", "_", JText::_('K2_CATEGORIES')); ?>="<?php echo $item->categoryname;?>"
<?php endif; ?>
<?php if($params->get('showTagFilter')==1): //check for param - show tag filter?>
data-<?php echo preg_replace("/[^A-Za-zA-yA-y0-9а-яА-Яá-źÁ-ŹΑ-Ωα-ωščťžľĺďŠČŤŽĹĎ]/ui", "_", JText::_('K2_TAGS')); ?>="<?php foreach ($item->tags as $tag): ?><?php echo $tag->name; ?>, <?php endforeach; ?>"
<?php endif; ?>
>
</p>
<p>
<?php if(isset($item->event->BeforeDisplay)): ?>
<!-- Plugins: BeforeDisplay -->
<?php echo $item->event->BeforeDisplay; ?>
<?php endif; ?>
<!-- K2 Plugins: K2BeforeDisplay -->
<?php echo $item->event->K2BeforeDisplay; ?>
<?php if($params->get('itemAuthorAvatar')): ?>
<a class="k2Avatar moduleItemAuthorAvatar" rel="author" href="<?php echo $item->authorLink; ?>">
<img src="<?php echo $item->authorAvatar; ?>" alt="<?php echo K2HelperUtilities::cleanHtml($item->author); ?>" style="width:<?php echo $avatarWidth; ?>px;height:auto;" />
</a>
<?php endif; ?>
<?php if($params->get('itemTitle')): ?>
<a class="moduleItemTitle" href="<?php echo $item->link; ?>"><?php echo $item->title; ?></a>
<?php endif; ?>
<?php if($params->get('itemAuthor')): ?>
</p>
<div class="moduleItemAuthor">
<?php echo K2HelperUtilities::writtenBy($item->authorGender); ?>
<?php if(isset($item->authorLink)): ?>
<a rel="author" title="<?php echo K2HelperUtilities::cleanHtml($item->author); ?>" href="<?php echo $item->authorLink; ?>"><?php echo $item->author; ?></a>
<?php else: ?>
<?php echo $item->author; ?>
<?php endif; ?>
<?php if($params->get('userDescription')): ?>
<?php echo $item->authorDescription; ?>
<?php endif; ?>
</div>
<?php endif; ?>
<?php if(isset($item->event->AfterDisplayTitle)): ?>
<!-- Plugins: AfterDisplayTitle -->
<?php echo $item->event->AfterDisplayTitle; ?>
<?php endif; ?>
<!-- K2 Plugins: K2AfterDisplayTitle -->
<?php echo $item->event->K2AfterDisplayTitle; ?>
<?php if(isset($item->event->BeforeDisplayContent)): ?>
<!-- Plugins: BeforeDisplayContent -->
<?php echo $item->event->BeforeDisplayContent; ?>
<?php endif; ?>
<!-- K2 Plugins: K2BeforeDisplayContent -->
<?php echo $item->event->K2BeforeDisplayContent; ?>
<?php if($params->get('itemImage') || $params->get('itemIntroText')): ?>
<div class="moduleItemIntrotext">
<?php if($params->get('itemImage') && isset($item->image)): ?>
<a class="moduleItemImage" href="<?php echo $item->link; ?>" title="<?php echo JText::_('K2_CONTINUE_READING'); ?> "<?php echo K2HelperUtilities::cleanHtml($item->title); ?>"">
<img src="<?php echo $item->image; ?>" alt="<?php echo K2HelperUtilities::cleanHtml($item->title); ?>"/>
</a>
<?php endif; ?>
<?php if($params->get('itemIntroText')): ?>
<?php echo $item->introtext; ?>
<?php endif; ?>
</div>
<?php endif; ?>
<div class="clr"></div>
<?php if($params->get('itemExtraFields') && count($item->extra_fields)): ?>
<div class="moduleItemExtraFields">
<b><?php echo JText::_('K2_ADDITIONAL_INFO'); ?></b>
<ul>
<?php foreach ($item->extra_fields as $extraField): ?>
<?php if($extraField->value): ?>
<li class="type<?php echo ucfirst($extraField->type); ?> group<?php echo $extraField->group; ?>">
<span class="moduleItemExtraFieldsLabel"><?php echo $extraField->name; ?></span>
<span class="moduleItemExtraFieldsValue"><?php echo $extraField->value; ?></span>
<div class="clr"></div>
</li>
<?php endif; ?>
<?php endforeach; ?>
</ul>
</div>
<?php endif; ?>
<div class="clr"></div>
<?php if($params->get('itemVideo')): ?>
<div class="moduleItemVideo">
<?php echo $item->video ; ?>
<span class="moduleItemVideoCaption"><?php echo $item->video_caption ; ?></span>
<span class="moduleItemVideoCredits"><?php echo $item->video_credits ; ?></span>
</div>
<?php endif; ?>
<div class="clr"></div>
<?php if(isset($item->event->AfterDisplayContent)): ?>
<!-- Plugins: AfterDisplayContent -->
<?php echo $item->event->AfterDisplayContent; ?>
<?php endif; ?>
<!-- K2 Plugins: K2AfterDisplayContent -->
<?php echo $item->event->K2AfterDisplayContent; ?>
<?php if($params->get('itemDateCreated')): ?>
<span class="moduleItemDateCreated"><?php echo JText::_('K2_WRITTEN_ON') ; ?> <?php echo JHTML::_('date', $item->created, JText::_('K2_DATE_FORMAT_LC2')); ?></span>
<?php endif; ?>
<?php if($params->get('itemCategory')): ?>
<?php echo JText::_('K2_IN') ; ?> <a class="moduleItemCategory" href="<?php echo $item->categoryLink; ?>"><?php echo $item->categoryname; ?></a>
<?php endif; ?>
<?php if($params->get('itemTags') && count($item->tags)>0): ?>
<div class="moduleItemTags">
<b><?php echo JText::_('K2_TAGS'); ?>:</b>
<?php foreach ($item->tags as $tag): ?>
<?php echo $tag->name; ?>
<?php endforeach; ?>
</div>
<?php endif; ?>
<?php if($params->get('itemAttachments') && count($item->attachments)): ?>
<div class="moduleAttachments">
<?php foreach ($item->attachments as $attachment): ?>
<a title="<?php echo K2HelperUtilities::cleanHtml($attachment->titleAttribute); ?>" href="<?php echo $attachment->link; ?>"><?php echo $attachment->title; ?></a>
<?php endforeach; ?>
</div>
<?php endif; ?>
<?php if($params->get('itemCommentsCounter') && $componentParams->get('comments')): ?>
<?php if(!empty($item->event->K2CommentsCounter)): ?>
<!-- K2 Plugins: K2CommentsCounter -->
<?php echo $item->event->K2CommentsCounter; ?>
<?php else: ?>
<?php if($item->numOfComments>0): ?>
<a class="moduleItemComments" href="<?php echo $item->link.'#itemCommentsAnchor'; ?>">
<?php echo $item->numOfComments; ?> <?php if($item->numOfComments>1) echo JText::_('K2_COMMENTS'); else echo JText::_('K2_COMMENT'); ?>
</a>
<?php else: ?>
<a class="moduleItemComments" href="<?php echo $item->link.'#itemCommentsAnchor'; ?>">
<?php echo JText::_('K2_BE_THE_FIRST_TO_COMMENT'); ?>
</a>
<?php endif; ?>
<?php endif; ?>
<?php endif; ?>
<?php if($params->get('itemHits')): ?>
<span class="moduleItemHits">
<?php echo JText::_('K2_READ'); ?> <?php echo $item->hits; ?> <?php echo JText::_('K2_TIMES'); ?>
</span>
<?php endif; ?>
<?php if($params->get('itemReadMore') && $item->fulltext): ?>
<a class="moduleItemReadMore" href="<?php echo $item->link; ?>">
<?php echo JText::_('K2_READ_MORE'); ?>
</a>
<?php endif; ?>
<?php if(isset($item->event->AfterDisplay)): ?>
<!-- Plugins: AfterDisplayContent -->
<?php echo $item->event->AfterDisplay; ?>
<?php endif; ?>
<!-- K2 Plugins: K2AfterDisplay -->
<?php echo $item->event->K2AfterDisplay; ?>
<div class="clr"></div>
</li>
<?php if((($keyItem+1)%($params->get('num_columns'))==0) && (($placeholder != 'pagination'))) : ?>
<div class="clr"></div>
<?php endif; ?>
<?php endforeach; ?>
<li class="clearList"></li>
</ul>
<?php endif; ?>
<?php if($params->get('itemCustomLink')): ?>
<a class="moduleCustomLink" href="<?php echo $params->get('itemCustomLinkURL'); ?>" title="<?php echo K2HelperUtilities::cleanHtml($itemCustomLinkTitle); ?>"><?php echo $itemCustomLinkTitle; ?></a>
<?php endif; ?>
<?php if($params->get('feed')): ?>
<div class="k2FeedIcon">
<a href="<?php echo JRoute::_('index.php?option=com_k2&view=itemlist&format=feed&moduleID='.$module->id); ?>" title="<?php echo JText::_('K2_SUBSCRIBE_TO_THIS_RSS_FEED'); ?>">
<span><?php echo JText::_('K2_SUBSCRIBE_TO_THIS_RSS_FEED'); ?></span>
</a>
<div class="clr"></div>
</div>
<?php endif; ?>
</div>
Like I say, I've tried and tried to make this template work, but have got nowhere!
You try it with wrong file! This file belongs to Filtrify Module!
You must:
set as template for category "default"
edit K2 native category settings,
edit K2 native category item settings,
edit K2 native
item settings,
After you set all native K2 parameters, you must clone your default k2 template. Do it so:
go into components/com_k2/templates.
Copy all, what you see, locally.
Then create in you templates/your-template/html folder named com_k2.
Copy into it all, what you got befor from components/com_k2/templates.
Then duplicate folder named "default" and give them own name. This will be your K2 template for overrides.
Then go into K2 administration and change template of you category, which you set up befor, from default to the new name. Just now you can begin with template overrides, but ONLY inside of templates/your template/html/com_k2/your-k2-template. The files you need to override are category-item.php for category view and item.php for single item view.

Categories