Keyword

Read more only if there is a full text

More
9 years 9 months ago #130136 by Nancy
I'm using K2 V2.6.1. on a website and would love to see the read more, only when there is a read more text. Now it's displaying at all times.

I've tried to use this tip: www.slurpitup.com/joomla/k2-tip-how-to-show-read-more-when-necessary

Changed the line in the template version of the php file. But it didn't work at all. Also tried the 'dirty way' he's talking about, but still nothing happened. I've checked if there is any hard show in the parameters from the item, where there should be no read more button. But there isn't.

Does anyone got any idea how to fix this?
I can't send you a link, because the website is still offline.

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

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
9 years 9 months ago #130137 by Krikor Boghossian
Replied by Krikor Boghossian on topic Re: Read more only if there is a full text
You should not use the quick and dirty version because you are using an outdated version and you will lose all your changes when you update.

Try echoing $this->item->fulltext
<?php echo $this->item->fulltext; ?> to see if the item does indeed have a full text.

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

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

More
9 years 9 months ago #130138 by Nancy
Replied by Nancy on topic Re: Read more only if there is a full text
Hi Krikor,

I'm sorry, could you tell me where to put this?
I think it should be in the category_item.php from my template.
		<?php if($this->item->params->get('catItemIntroText')): ?>
			<div class="catItemIntroText">
				<?php echo $this->item->introtext; ?>
			
					<!-- Item "read more..." link -->
					<?php if ($this->item->params->get('catItemReadMore') && ($this->item->fulltext != "")): ?>
					<div class="catItemReadMore">
						<a class="k2ReadMore" href="<?php echo $this->item->link; ?>">
							<?php echo JText::_('K2_READ_MORE_THEME'); ?>
						</a>
					</div>
					<?php endif; ?>
			</div>
		<?php endif; ?>

		<div class="clr"></div>

Thanks a lot for your respond.

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

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
9 years 9 months ago #130139 by Krikor Boghossian
Replied by Krikor Boghossian on topic Re: Read more only if there is a full text
Directly under <?php echo $this->item->introtext; ?>
paste
<?php echo $this->item->fulltext; ?>
Just to be make sure that this item does not a full text.

you can also try isset($this->item->fulltext) eg:
<?php if ($this->item->params->get('catItemReadMore') && isset($this->item->fulltext) ): ?>

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

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

More
9 years 9 months ago #130140 by Nancy
Replied by Nancy on topic Re: Read more only if there is a full text
Did this, but no changes at all. Stil a read more after each item on te website. I did use the CTRL+F5 to refresh.

When using the second line you write about, I got a syntaxis error in Dreamweaver.

Do you have more suggestions?

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

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
9 years 9 months ago #130141 by Krikor Boghossian
Replied by Krikor Boghossian on topic Re: Read more only if there is a full text
Dreamweaver is not the same as a live site. Did you try it on your Joomla! site?

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

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

More
9 years 9 months ago - 9 years 9 months ago #130142 by Nancy
Replied by Nancy on topic Re: Read more only if there is a full text
Yes, I did try it...but it didn't work.

This code is active at this moment:
<!-- Item introtext -->           
                <?php if($this->item->params->get('catItemIntroText')): ?>
                        <div class="catItemIntroText">
                                <?php echo $this->item->introtext; ?>
<?php if ($this->item->params->get('catItemReadMore') && isset($this->item->fulltext) ): ?>
                                        <!-- Item "read more..." link -->
                                        <?php if ($this->item->params->get('catItemReadMore') && ($this->item->fulltext != "")): ?>
                                        <div class="catItemReadMore">
                                                <a class="k2ReadMore" href="<?php echo $this->item->link; ?>">
                                                        <?php echo JText::_('K2_READ_MORE_THEME'); ?>
                                                </a>
                                        </div>
                                        <?php endif; ?>
                        </div>
                <?php endif; ?>

                <div class="clr"></div>

What about this line in the Original file category_item.php
Is that correct, or do I need to make a change in that line?
<?php if ($this->item->params->get('catItemReadMore') && ($this->item->fulltext != "")): ?>

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

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
9 years 9 months ago #130143 by Krikor Boghossian
Replied by Krikor Boghossian on topic Re: Read more only if there is a full text
You still haven't told me if $this->item->fulltext outputs something.
The initial code should work:
<?php if ($this->item->params->get('catItemReadMore') && $this->item->fulltext !== ''): ?>

Provided that you have set an introtext/ fulltext.

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

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

More
9 years 9 months ago #130144 by Nancy
Replied by Nancy on topic Re: Read more only if there is a full text
I'm sorry Krikor, but I don't understand what you mean.
Where do I need to read this output you're talking about. I think my experience i'n't enough for this maybe.

The item where de read more button appears, only have a fulltext in the editor, no intro at all.

I'll set the website online right now, so you can see what I mean.

Please see:
Follow Lezingen & Interviews --> first and third item diplayed. There is no more tekst available, but the button is there.

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

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
9 years 9 months ago #130145 by Krikor Boghossian
Replied by Krikor Boghossian on topic Re: Read more only if there is a full text
You do not know how the items is sorted until you put <?php echo $this->item->fulltext; ?>
If you haven't used the read more or used two separate editors the item might not have a fulltext. In itemlistings the entire text will be handled as introtext.

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