Keyword

Read more only if there is a full text

More
10 years 11 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
10 years 11 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.

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

More
10 years 11 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
10 years 11 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) ): ?>

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

More
10 years 11 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
10 years 11 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?

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

More
10 years 11 months ago - 10 years 11 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
10 years 11 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.

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

More
10 years 11 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
10 years 11 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.

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

More
10 years 11 months ago #130146 by Nancy
Replied by Nancy on topic Re: Read more only if there is a full text
I did put that line in the php file. It's still in at the live site at this moment.

Could you tell me step by step what to do. Do I need to edit a read more in the item first en then write the tekst, to have the item appear without a read more button?
I didn't use two editors.

Well I do not understand how I can manage this by your last message. I'm sorry!

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

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
10 years 11 months ago - 10 years 11 months ago #130147 by Krikor Boghossian
Replied by Krikor Boghossian on topic Re: Read more only if there is a full text
If the echo does not return anything then there is no fulltext present.

As I explained you have two options.
a) Use your editor's read more button to separate your text
b) Enable two editors from K2's advanced settings and use them both.

If you have not specified a fulltext and an intro then in listings all the text is handled as introtext.
PS. 2.6.1 is really outdated. You should consider updating to 2.6.8

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

More
10 years 11 months ago #130148 by Nancy
Replied by Nancy on topic Re: Read more only if there is a full text
But Krikor,

The problem is, I only want to display an intro tekst in the category view. There is no fulltext neccessary in this item. I want no read more button after this first item on this page: [link]www.artmeaning.nl/index.php/nl-NL/lezingen[/link]

I can't change the parameters in this category hiding the read more, because the second item on this category view page does have a full text.

Now you are explaining me how to use a read more. That's not my question.

It should bij like the regular Joomla Article category view. They will only show a read more if I used the read more in the editor.

I'm using JCE at this site.
I'll update K2.

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

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
10 years 11 months ago #130149 by Krikor Boghossian
Replied by Krikor Boghossian on topic Re: Read more only if there is a full text
I am explaining that without a read more button then you cannot have the distinction between introtext and fulltext.

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


Powered by Kunena Forum