- Posts: 63
COMMUNITY FORUM
Limiting introtext under tag lists?
- Josh
- Offline
- Senior Member
Less
More
12 years 11 months ago #90794
by Josh
Replied by Josh on topic Limiting introtext under tag lists?
Sure, a tag item list view is at
www.winelands.co.za/wine-farms/all-wine-farms
Intro text is limited to 30 characters.
www.winelands.co.za/wine-farms/all-wine-farms
Intro text is limited to 30 characters.
Please Log in or Create an account to join the conversation.
- NintendoNerds
- Offline
- Senior Member
Less
More
- Posts: 55
12 years 11 months ago #90795
by NintendoNerds
Replied by NintendoNerds on topic Limiting introtext under tag lists?
Wow! That looks great, Josh. I tried making that change to my generic.php file but it did not work. Below, I have posted the generic.php file from my override directory. Also, here is how my current tag listing looks:
www.nintendonerds.com/articles/other/itemlist/tag/may%202011
<?php/** * @version $Id: generic.php 478 2010-06-16 16:11:42Z joomlaworks $ * @package K2 * @author JoomlaWorks www.joomlaworks.gr * @copyright Copyright (c) 2006 - 2010 JoomlaWorks, a business unit of Nuevvo Webware Ltd. All rights reserved. * @license GNU/GPL license: www.gnu.org/copyleft/gpl.html */// no direct accessdefined('_JEXEC') or die('Restricted access');?><!-- Start K2 Generic Layout --><div id="k2Container" class="genericView<?php if($this->params->get('pageclass_sfx')) echo ' '.$this->params->get('pageclass_sfx'); ?>"> <?php if($this->params->get('show_page_title')): ?> <!-- Page title --> <div class="componentheading<?php echo $this->params->get('pageclass_sfx')?>"> <?php echo $this->escape($this->params->get('page_title')); ?> </div> <?php endif; ?> <?php if($this->params->get('userFeed')): ?> <!-- RSS feed icon --> <div class="k2FeedIcon"> <a href="/<?php echo $this->feed; ?>" title="<?php echo JText::_('Subscribe to this RSS feed'); ?>"> <span><?php echo JText::_('Subscribe to this RSS feed'); ?></span> </a> <div class="clr"></div> </div> <?php endif; ?> <?php if(count($this->items)): ?> <div class="genericItemList"> <?php foreach($this->items as $item): ?> <!-- Start K2 Item Layout --> <div class="genericItemView"> <div class="genericItemHeader"> <?php if($item->params->get('genericItemDateCreated')): ?> <!-- Date created --> <span class="genericItemDateCreated"> <?php echo JHTML::_('date', $item->created , JText::_('DATE_FORMAT_LC2')); ?> </span> <?php endif; ?> <?php if($item->params->get('genericItemTitle')): ?> <!-- Item title --> <h2 class="genericItemTitle"> <?php if ($item->params->get('genericItemTitleLinked')): ?> <a href="/<?php echo $item->link; ?>"> <?php echo $item->title; ?> </a> <?php else: ?> <?php echo $item->title; ?> <?php endif; ?> </h2> <?php endif; ?> </div> <div class="genericItemBody"> <?php if($item->params->get('genericItemImage') && !empty($item->imageGeneric)): ?> <!-- Item Image --> <div class="genericItemImageBlock"> <span class="genericItemImage"> <a href="/<?php echo $item->link; ?>" title="<?php if(!empty($item->image_caption)) echo $item->image_caption; else echo $item->title; ?>"> <img src="/<?php echo $item->imageGeneric; ?>" alt="<?php if(!empty($item->image_caption)) echo $item->image_caption; else echo $item->title; ?>" style="width:<?php echo $item->params->get('itemImageGeneric'); ?>px; height:auto;" /> </a> </span> <div class="clr"></div> </div> <?php endif; ?> <?php if($item->params->get('genericItemIntroText')): ?> <!-- Item introtext --> <div class="genericItemIntroText"> <?php /* echo $item->introtext; */?> </div> <?php echo K2HelperUtilities::wordLimit($item->introtext,30); ?> <?php endif; ?> <div class="clr"></div> </div> <div class="clr"></div> <?php if($item->params->get('genericItemExtraFields') && count($item->extra_fields)): ?> <!-- Item extra fields --> <div class="genericItemExtraFields"> <h4><?php echo JText::_('Additional Info'); ?></h4> <ul> <?php foreach ($item->extra_fields as $key=>$extraField): ?> <li class="<?php echo ($key%2) ? "odd" : "even"; ?> type<?php echo ucfirst($extraField->type); ?> group<?php echo $extraField->group; ?>"> <span class="genericItemExtraFieldsLabel"><?php echo $extraField->name; ?></span> <span class="genericItemExtraFieldsValue"><?php echo $extraField->value; ?></span> </li> <?php endforeach; ?> </ul> <div class="clr"></div> </div> <?php endif; ?> <?php if($item->params->get('genericItemCategory')): ?> <!-- Item category name --> <div class="genericItemCategory"> <span><?php echo JText::_('Published in'); ?></span> <a href="/<?php echo $item->category->link; ?>"><?php echo $item->category->name; ?></a> </div> <?php endif; ?> <?php if ($item->params->get('genericItemReadMore')): ?> <!-- Item "read more..." link --> <div class="genericItemReadMore"> <a class="k2ReadMore" href="/<?php echo $item->link; ?>"> <?php echo JText::_('Read more...'); ?> </a> </div> <?php endif; ?> <div class="clr"></div> </div> <!-- End K2 Item Layout --> <?php endforeach; ?> </div> <!-- Pagination --> <?php if($this->pagination->getPagesLinks()): ?> <div class="k2Pagination"> <?php echo $this->pagination->getPagesLinks(); ?> <div class="clr"></div> <?php echo $this->pagination->getPagesCounter(); ?> </div> <?php endif; ?> <?php endif; ?> </div><!-- End K2 Generic Layout -->
www.nintendonerds.com/articles/other/itemlist/tag/may%202011
<?php/** * @version $Id: generic.php 478 2010-06-16 16:11:42Z joomlaworks $ * @package K2 * @author JoomlaWorks www.joomlaworks.gr * @copyright Copyright (c) 2006 - 2010 JoomlaWorks, a business unit of Nuevvo Webware Ltd. All rights reserved. * @license GNU/GPL license: www.gnu.org/copyleft/gpl.html */// no direct accessdefined('_JEXEC') or die('Restricted access');?><!-- Start K2 Generic Layout --><div id="k2Container" class="genericView<?php if($this->params->get('pageclass_sfx')) echo ' '.$this->params->get('pageclass_sfx'); ?>"> <?php if($this->params->get('show_page_title')): ?> <!-- Page title --> <div class="componentheading<?php echo $this->params->get('pageclass_sfx')?>"> <?php echo $this->escape($this->params->get('page_title')); ?> </div> <?php endif; ?> <?php if($this->params->get('userFeed')): ?> <!-- RSS feed icon --> <div class="k2FeedIcon"> <a href="/<?php echo $this->feed; ?>" title="<?php echo JText::_('Subscribe to this RSS feed'); ?>"> <span><?php echo JText::_('Subscribe to this RSS feed'); ?></span> </a> <div class="clr"></div> </div> <?php endif; ?> <?php if(count($this->items)): ?> <div class="genericItemList"> <?php foreach($this->items as $item): ?> <!-- Start K2 Item Layout --> <div class="genericItemView"> <div class="genericItemHeader"> <?php if($item->params->get('genericItemDateCreated')): ?> <!-- Date created --> <span class="genericItemDateCreated"> <?php echo JHTML::_('date', $item->created , JText::_('DATE_FORMAT_LC2')); ?> </span> <?php endif; ?> <?php if($item->params->get('genericItemTitle')): ?> <!-- Item title --> <h2 class="genericItemTitle"> <?php if ($item->params->get('genericItemTitleLinked')): ?> <a href="/<?php echo $item->link; ?>"> <?php echo $item->title; ?> </a> <?php else: ?> <?php echo $item->title; ?> <?php endif; ?> </h2> <?php endif; ?> </div> <div class="genericItemBody"> <?php if($item->params->get('genericItemImage') && !empty($item->imageGeneric)): ?> <!-- Item Image --> <div class="genericItemImageBlock"> <span class="genericItemImage"> <a href="/<?php echo $item->link; ?>" title="<?php if(!empty($item->image_caption)) echo $item->image_caption; else echo $item->title; ?>"> <img src="/<?php echo $item->imageGeneric; ?>" alt="<?php if(!empty($item->image_caption)) echo $item->image_caption; else echo $item->title; ?>" style="width:<?php echo $item->params->get('itemImageGeneric'); ?>px; height:auto;" /> </a> </span> <div class="clr"></div> </div> <?php endif; ?> <?php if($item->params->get('genericItemIntroText')): ?> <!-- Item introtext --> <div class="genericItemIntroText"> <?php /* echo $item->introtext; */?> </div> <?php echo K2HelperUtilities::wordLimit($item->introtext,30); ?> <?php endif; ?> <div class="clr"></div> </div> <div class="clr"></div> <?php if($item->params->get('genericItemExtraFields') && count($item->extra_fields)): ?> <!-- Item extra fields --> <div class="genericItemExtraFields"> <h4><?php echo JText::_('Additional Info'); ?></h4> <ul> <?php foreach ($item->extra_fields as $key=>$extraField): ?> <li class="<?php echo ($key%2) ? "odd" : "even"; ?> type<?php echo ucfirst($extraField->type); ?> group<?php echo $extraField->group; ?>"> <span class="genericItemExtraFieldsLabel"><?php echo $extraField->name; ?></span> <span class="genericItemExtraFieldsValue"><?php echo $extraField->value; ?></span> </li> <?php endforeach; ?> </ul> <div class="clr"></div> </div> <?php endif; ?> <?php if($item->params->get('genericItemCategory')): ?> <!-- Item category name --> <div class="genericItemCategory"> <span><?php echo JText::_('Published in'); ?></span> <a href="/<?php echo $item->category->link; ?>"><?php echo $item->category->name; ?></a> </div> <?php endif; ?> <?php if ($item->params->get('genericItemReadMore')): ?> <!-- Item "read more..." link --> <div class="genericItemReadMore"> <a class="k2ReadMore" href="/<?php echo $item->link; ?>"> <?php echo JText::_('Read more...'); ?> </a> </div> <?php endif; ?> <div class="clr"></div> </div> <!-- End K2 Item Layout --> <?php endforeach; ?> </div> <!-- Pagination --> <?php if($this->pagination->getPagesLinks()): ?> <div class="k2Pagination"> <?php echo $this->pagination->getPagesLinks(); ?> <div class="clr"></div> <?php echo $this->pagination->getPagesCounter(); ?> </div> <?php endif; ?> <?php endif; ?> </div><!-- End K2 Generic Layout -->
Please Log in or Create an account to join the conversation.
- Josh
- Offline
- Senior Member
Less
More
- Posts: 63
12 years 11 months ago #90796
by Josh
Replied by Josh on topic Limiting introtext under tag lists?
hi sorry about the late reply.
I use only one generic.php as I don't think its actually possible to use more than one themed generic.php. I believe that generic.php should be placed within the /templates/YOURJOOMLATEMPLATE/html/com_k2/ and not within an override sub folder
(community.getk2.org/notes/Templating_in_K2 paragraph 4 and 5)
Try using only one generic.php and moving the <?php echo K2HelperUtilities::wordLimit($item->introtext,30); ?>
to inside the genericItemIntroText div. just below the uncommented <?php /* echo $item->introtext; */?>
Like such:
<?php/** * @version $Id: generic.php 478 2010-06-16 16:11:42Z joomlaworks $ * @package K2 * @author JoomlaWorks www.joomlaworks.gr * @copyright Copyright (c) 2006 - 2010 JoomlaWorks, a business unit of Nuevvo Webware Ltd. All rights reserved. * @license GNU/GPL license: www.gnu.org/copyleft/gpl.html */// no direct accessdefined('_JEXEC') or die('Restricted access');?><!-- Start K2 Generic Layout --><div id="k2Container" class="genericView<?php if($this->params->get('pageclass_sfx')) echo ' '.$this->params->get('pageclass_sfx'); ?>"> <?php if($this->params->get('show_page_title')): ?> <!-- Page title --> <div class="componentheading<?php echo $this->params->get('pageclass_sfx')?>"> <?php echo $this->escape($this->params->get('page_title')); ?> </div> <?php endif; ?> <?php if($this->params->get('userFeed')): ?> <!-- RSS feed icon --> <div class="k2FeedIcon"> <a href="/<?php echo $this->feed; ?>" title="<?php echo JText::_('Subscribe to this RSS feed'); ?>"> <span><?php echo JText::_('Subscribe to this RSS feed'); ?></span> </a> <div class="clr"></div> </div> <?php endif; ?> <?php if(count($this->items)): ?> <div class="genericItemList"> <?php foreach($this->items as $item): ?> <!-- Start K2 Item Layout --> <div class="genericItemView"> <div class="genericItemHeader"> <?php if($item->params->get('genericItemDateCreated')): ?> <!-- Date created --> <span class="genericItemDateCreated"> <?php echo JHTML::_('date', $item->created , JText::_('DATE_FORMAT_LC2')); ?> </span> <?php endif; ?> <?php if($item->params->get('genericItemTitle')): ?> <!-- Item title --> <h2 class="genericItemTitle"> <?php if ($item->params->get('genericItemTitleLinked')): ?> <a href="/<?php echo $item->link; ?>"> <?php echo $item->title; ?> </a> <?php else: ?> <?php echo $item->title; ?> <?php endif; ?> </h2> <?php endif; ?> </div> <div class="genericItemBody"> <?php if($item->params->get('genericItemImage') && !empty($item->imageGeneric)): ?> <!-- Item Image --> <div class="genericItemImageBlock"> <span class="genericItemImage"> <a href="/<?php echo $item->link; ?>" title="<?php if(!empty($item->image_caption)) echo $item->image_caption; else echo $item->title; ?>"> <img src="/<?php echo $item->imageGeneric; ?>" alt="<?php if(!empty($item->image_caption)) echo $item->image_caption; else echo $item->title; ?>" style="width:<?php echo $item->params->get('itemImageGeneric'); ?>px; height:auto;" /> </a> </span> <div class="clr"></div> </div> <?php endif; ?> <?php if($item->params->get('genericItemIntroText')): ?> <!-- Item introtext --> <div class="genericItemIntroText"> <?php /* echo $item->introtext; */?><?php echo K2HelperUtilities::wordLimit($item->introtext,30); ?> </div> <?php endif; ?> <div class="clr"></div> </div> <div class="clr"></div> <?php if($item->params->get('genericItemExtraFields') && count($item->extra_fields)): ?> <!-- Item extra fields --> <div class="genericItemExtraFields"> <h4><?php echo JText::_('Additional Info'); ?></h4> <ul> <?php foreach ($item->extra_fields as $key=>$extraField): ?> <li class="<?php echo ($key%2) ? "odd" : "even"; ?> type<?php echo ucfirst($extraField->type); ?> group<?php echo $extraField->group; ?>"> <span class="genericItemExtraFieldsLabel"><?php echo $extraField->name; ?></span> <span class="genericItemExtraFieldsValue"><?php echo $extraField->value; ?></span> </li> <?php endforeach; ?> </ul> <div class="clr"></div> </div> <?php endif; ?> <?php if($item->params->get('genericItemCategory')): ?> <!-- Item category name --> <div class="genericItemCategory"> <span><?php echo JText::_('Published in'); ?></span> <a href="/<?php echo $item->category->link; ?>"><?php echo $item->category->name; ?></a> </div> <?php endif; ?> <?php if ($item->params->get('genericItemReadMore')): ?> <!-- Item "read more..." link --> <div class="genericItemReadMore"> <a class="k2ReadMore" href="/<?php echo $item->link; ?>"> <?php echo JText::_('Read more...'); ?> </a> </div> <?php endif; ?> <div class="clr"></div> </div> <!-- End K2 Item Layout --> <?php endforeach; ?> </div> <!-- Pagination --> <?php if($this->pagination->getPagesLinks()): ?> <div class="k2Pagination"> <?php echo $this->pagination->getPagesLinks(); ?> <div class="clr"></div> <?php echo $this->pagination->getPagesCounter(); ?> </div> <?php endif; ?> <?php endif; ?> </div><!-- End K2 Generic Layout -->
community.getk2.org/profiles/blogs/modifying-the-tags-results
I use only one generic.php as I don't think its actually possible to use more than one themed generic.php. I believe that generic.php should be placed within the /templates/YOURJOOMLATEMPLATE/html/com_k2/ and not within an override sub folder
(community.getk2.org/notes/Templating_in_K2 paragraph 4 and 5)
Try using only one generic.php and moving the <?php echo K2HelperUtilities::wordLimit($item->introtext,30); ?>
to inside the genericItemIntroText div. just below the uncommented <?php /* echo $item->introtext; */?>
Like such:
<?php/** * @version $Id: generic.php 478 2010-06-16 16:11:42Z joomlaworks $ * @package K2 * @author JoomlaWorks www.joomlaworks.gr * @copyright Copyright (c) 2006 - 2010 JoomlaWorks, a business unit of Nuevvo Webware Ltd. All rights reserved. * @license GNU/GPL license: www.gnu.org/copyleft/gpl.html */// no direct accessdefined('_JEXEC') or die('Restricted access');?><!-- Start K2 Generic Layout --><div id="k2Container" class="genericView<?php if($this->params->get('pageclass_sfx')) echo ' '.$this->params->get('pageclass_sfx'); ?>"> <?php if($this->params->get('show_page_title')): ?> <!-- Page title --> <div class="componentheading<?php echo $this->params->get('pageclass_sfx')?>"> <?php echo $this->escape($this->params->get('page_title')); ?> </div> <?php endif; ?> <?php if($this->params->get('userFeed')): ?> <!-- RSS feed icon --> <div class="k2FeedIcon"> <a href="/<?php echo $this->feed; ?>" title="<?php echo JText::_('Subscribe to this RSS feed'); ?>"> <span><?php echo JText::_('Subscribe to this RSS feed'); ?></span> </a> <div class="clr"></div> </div> <?php endif; ?> <?php if(count($this->items)): ?> <div class="genericItemList"> <?php foreach($this->items as $item): ?> <!-- Start K2 Item Layout --> <div class="genericItemView"> <div class="genericItemHeader"> <?php if($item->params->get('genericItemDateCreated')): ?> <!-- Date created --> <span class="genericItemDateCreated"> <?php echo JHTML::_('date', $item->created , JText::_('DATE_FORMAT_LC2')); ?> </span> <?php endif; ?> <?php if($item->params->get('genericItemTitle')): ?> <!-- Item title --> <h2 class="genericItemTitle"> <?php if ($item->params->get('genericItemTitleLinked')): ?> <a href="/<?php echo $item->link; ?>"> <?php echo $item->title; ?> </a> <?php else: ?> <?php echo $item->title; ?> <?php endif; ?> </h2> <?php endif; ?> </div> <div class="genericItemBody"> <?php if($item->params->get('genericItemImage') && !empty($item->imageGeneric)): ?> <!-- Item Image --> <div class="genericItemImageBlock"> <span class="genericItemImage"> <a href="/<?php echo $item->link; ?>" title="<?php if(!empty($item->image_caption)) echo $item->image_caption; else echo $item->title; ?>"> <img src="/<?php echo $item->imageGeneric; ?>" alt="<?php if(!empty($item->image_caption)) echo $item->image_caption; else echo $item->title; ?>" style="width:<?php echo $item->params->get('itemImageGeneric'); ?>px; height:auto;" /> </a> </span> <div class="clr"></div> </div> <?php endif; ?> <?php if($item->params->get('genericItemIntroText')): ?> <!-- Item introtext --> <div class="genericItemIntroText"> <?php /* echo $item->introtext; */?><?php echo K2HelperUtilities::wordLimit($item->introtext,30); ?> </div> <?php endif; ?> <div class="clr"></div> </div> <div class="clr"></div> <?php if($item->params->get('genericItemExtraFields') && count($item->extra_fields)): ?> <!-- Item extra fields --> <div class="genericItemExtraFields"> <h4><?php echo JText::_('Additional Info'); ?></h4> <ul> <?php foreach ($item->extra_fields as $key=>$extraField): ?> <li class="<?php echo ($key%2) ? "odd" : "even"; ?> type<?php echo ucfirst($extraField->type); ?> group<?php echo $extraField->group; ?>"> <span class="genericItemExtraFieldsLabel"><?php echo $extraField->name; ?></span> <span class="genericItemExtraFieldsValue"><?php echo $extraField->value; ?></span> </li> <?php endforeach; ?> </ul> <div class="clr"></div> </div> <?php endif; ?> <?php if($item->params->get('genericItemCategory')): ?> <!-- Item category name --> <div class="genericItemCategory"> <span><?php echo JText::_('Published in'); ?></span> <a href="/<?php echo $item->category->link; ?>"><?php echo $item->category->name; ?></a> </div> <?php endif; ?> <?php if ($item->params->get('genericItemReadMore')): ?> <!-- Item "read more..." link --> <div class="genericItemReadMore"> <a class="k2ReadMore" href="/<?php echo $item->link; ?>"> <?php echo JText::_('Read more...'); ?> </a> </div> <?php endif; ?> <div class="clr"></div> </div> <!-- End K2 Item Layout --> <?php endforeach; ?> </div> <!-- Pagination --> <?php if($this->pagination->getPagesLinks()): ?> <div class="k2Pagination"> <?php echo $this->pagination->getPagesLinks(); ?> <div class="clr"></div> <?php echo $this->pagination->getPagesCounter(); ?> </div> <?php endif; ?> <?php endif; ?> </div><!-- End K2 Generic Layout -->
community.getk2.org/profiles/blogs/modifying-the-tags-results
Please Log in or Create an account to join the conversation.
- NintendoNerds
- Offline
- Senior Member
Less
More
- Posts: 55
12 years 11 months ago #90797
by NintendoNerds
Replied by NintendoNerds on topic Limiting introtext under tag lists?
Dude! Thank you so much!! It worked like a charm. I can't tell you how happy I am right now that I have this working!
Please Log in or Create an account to join the conversation.
- Josh
- Offline
- Senior Member
Less
More
- Posts: 63
12 years 11 months ago #90798
by Josh
Replied by Josh on topic Limiting introtext under tag lists?
Sure thing man, glad to help.
Please Log in or Create an account to join the conversation.