Keyword

Back to category link

  • Novalee
  • Novalee's Avatar Topic Author
  • Offline
  • Junior Member
More
12 years 7 months ago #63176 by Novalee
Back to category link was created by Novalee
Hi,
I would like to add a "back to category {categoryname}" link above my item titles. Does anybody know how this works?
I tried to add some code to the item.php of my template of K2, but I don't see anything.

I addes this:

<!-- Item category to go back to category overview -->
<div class="itemCategory">
<span><?php echo JText::_('Back to category: '); ?></span>
<a href="<?php echo $this->item->category->link; ?>"><?php echo $this->item->category->name; ?></a>
test
</div>

Before this:

<?php if(!empty($this->item->fulltext)): ?>
<?php if($this->item->params->get('itemIntroText')): ?>
<!-- Item introtext -->
<div class="itemIntroText">
<?php echo $this->item->introtext; ?>
</div>
<?php endif; ?>


Thanks in advance for your help!

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

More
12 years 7 months ago #63177 by Aaron
Replied by Aaron on topic Re: Back to category link
You don't need to change any variables. You just want to change what the screen says..
Try this:

Original Code:
					

Aaron :)

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

  • Novalee
  • Novalee's Avatar Topic Author
  • Offline
  • Junior Member
More
12 years 6 months ago #63178 by Novalee
Replied by Novalee on topic Re: Back to category link
Hi,
thank you very much for your answer!
I tried this in the component/k2/templates/ all templates i have/item.php folder and also in the
/templates/mytemplate/html/k2/templates/all templates i have/item.php
I changed the original code to this:
<?php if($this->item->params->get('itemCategory')): ?>
<!-- Item category name -->
<div class="itemCategory">
<span><?php echo 'Back to category: '; ?></span>
<a href="<?php echo $this->item->category->link; ?>"><?php echo $this->item->category->name; ?></a>
</div>
<?php endif; ?>
but the change is not seen :(
I cleaned the cache and everything, but still the old text remains :((

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

More
12 years 6 months ago #63179 by Aaron
Replied by Aaron on topic Re: Back to category link
If you are not seeing it follow these steps:

1. Make sure your category is using the template you changed
2. Make sure you are on the ITEM page. (Sorry to sound so basic) - Click on the item to see only that item on the page to ensure you are on the item.php

Hope this helps.


Aaron :)

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

  • Novalee
  • Novalee's Avatar Topic Author
  • Offline
  • Junior Member
More
12 years 6 months ago #63180 by Novalee
Replied by Novalee on topic Re: Back to category link
Hi,

okay I succesfully changed the standard "Published in " category text to "Back to " category.

The last thing is that I would like to have this text directly after the item title, before the introtext starts, but can't get it to work there...
I tried to add it here:
	<?php if($this->item->params->get('itemAuthor')): ?>
		<!-- Item Author -->
		<span class="itemAuthor">
			<?php echo K2HelperUtilities::writtenBy($this->item->author->profile->gender); ?>&nbsp;
			<?php if(empty($this->item->created_by_alias)): ?>
			<a href="<?php echo $this->item->author->link; ?>"><?php echo $this->item->author->name; ?></a>
			<?php else: ?>
			<?php echo $this->item->author->name; ?>
			<?php endif; ?>
		</span>
		<?php endif; ?>

  </div>

  <!-- Plugins: AfterDisplayTitle -->
  <?php echo $this->item->event->AfterDisplayTitle; ?>

		<?php if($this->item->params->get('itemCategory')): ?>
		<!-- Item category name -->
		<div class="itemCategory">
			<span><?php echo 'Back to category: '; ?></span>
			<a href="<?php echo $this->item->category->link; ?>"><?php echo $this->item->category->name; ?></a>
		</div>
		<?php endif; ?>
  <!-- K2 Plugins: K2AfterDisplayTitle -->
  <?php echo $this->item->event->K2AfterDisplayTitle; ?>

	<?php if(
		$this->item->params->get('itemFontResizer') ||
		$this->item->params->get('itemPrintButton') ||
		$this->item->params->get('itemEmailButton') ||
But it doesn't show up.
Where should I exactly place it?

Thank you so much for your help!

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


Powered by Kunena Forum