- Posts: 1
COMMUNITY FORUM
Only Show Read More if Article has ReadMore Divide
- Ron Adams
- Topic Author
- Offline
- New Member
Please Log in or Create an account to join the conversation.
- Lance Thompson
- Offline
- New Member
- Making the Web Work For You
Did you ever find a solution to this? I too have a client who has a ton of articles, some of them very short and some that have the "Read More" divider set within the content. I only want the read more to show IF there's a read more tag inserted.
The way it works now is that it's either show or not. Period.
Thanks!
Lance Thompson - Blue Sky Web Worx
Web Design, SEO, Graphic Design
www.BlueSkyWebWorx.com
Please Log in or Create an account to join the conversation.
- william white
- Offline
- Platinum Member
- Posts: 3722
you will need to search category_item.php for <?php if ($this->item->params->get('catItemReadMore')): ?>
Place a test for the existance of fulltext around it
Please Log in or Create an account to join the conversation.
- Darryll
- Offline
- New Member
- Posts: 5
I added another if statement inbetween the current block and tried replacing get('catItemReadMore') with all the ideas I had, and the closest I got was hiding it completely when an item actually has fulltext (which isn't very helpful as it's every time, i think).
I also tried adapting the if(!empty statement from the comments counter section, and while I didn't get very far I think if!empty might be where I'm falling down.
William - Could you please post a little code so I can get my head around where I'm going wrong please? Usually I'm OK with the smaller template overrides, but this one is just that little bit over my head.
Thanks in advance, and this is a pretty long winded post to ask a really simple question
Please Log in or Create an account to join the conversation.
- william white
- Offline
- Platinum Member
- Posts: 3722
The php empty will return results that may be misleading
Mabee you should test for the length php strlen and see if the length of the fulltext is greater than some amount.
I would start getting the syntax correct by reporting the srtlen to the screen in the override just after the readmore shows. If there is full text there should be a number there, then you can see what is returned if there is no fulltext.
next, put a if around the readmore code testing for the length > amount to display the readmore....endif
Please Log in or Create an account to join the conversation.
- Aaron
- Offline
- Premium Member
Aaron :)
Please Log in or Create an account to join the conversation.
- william white
- Offline
- Platinum Member
- Posts: 3722
Please Log in or Create an account to join the conversation.
- Darryll
- Offline
- New Member
- Posts: 5
I dug a little deeper and I found the code in a backup of an old site. Just tested on a Joomla 2.5.4 / K2 2.5.6 install and it worked just fine.
category_item.php
<?php if ($this->item->params->get('catItemReadMore')): ?>
replace with
<?php if ($this->item->params->get('catItemReadMore') && ($this->item->fulltext != "")): ?>
Thanks all the same for the replies and I hope this helps :)
Please Log in or Create an account to join the conversation.
- Manuel Kuhs
- Offline
- New Member
- Posts: 17
Darryll wrote: Hey folks,
I dug a little deeper and I found the code in a backup of an old site. Just tested on a Joomla 2.5.4 / K2 2.5.6 install and it worked just fine.
category_item.php<?php if ($this->item->params->get('catItemReadMore')): ?>
replace with<?php if ($this->item->params->get('catItemReadMore') && ($this->item->fulltext != "")): ?>
Thanks all the same for the replies and I hope this helps :)
I did the above on Joomla 2.5.8 / K2 2.6.5 in file components/com_k2/templates/default/category_item.php and it did NOT work.
Anyone any ideas?
Please Log in or Create an account to join the conversation.
- Kelsey Brookes
- Offline
- Elite Member
Please Log in or Create an account to join the conversation.