Keyword

K2 item view - Gallery/Extra fields change ordering

  • chrisgermany
  • chrisgermany's Avatar Topic Author
  • Offline
  • New Member
More
9 years 3 months ago #140521 by chrisgermany
Hi,

first, everything is up to date (Jooomla, K2, Sigallery).

I have to change the ordering in the K2 item view. Instead of

1. Image
2. Introtext and ItemFulltext
3. Extra Fileds
4. Gallery

i need to have the gallery and then the extrafileds directly after the item image:it in that way:

1. Image
2.Gallery
3. Extra Fileds
4.Introtext and ItemFulltext

I tried it with editing the k2/templates/item.php cut/ and paste the code for the extra field for example, but then the item full text disappears.

How can i achieve that - thank you for help!


<!-- Item extra fields -->
<div class="itemExtraFields">
<h3><?php echo JText::_('K2_ADDITIONAL_INFO'); ?></h3>
<ul>
<?php foreach ($this->item->extra_fields as $key=>$extraField): ?>
<?php if($extraField->value != ''): ?>
<li class="<?php echo ($key%2) ? "odd" : "even"; ?> type<?php echo ucfirst($extraField->type); ?> group<?php echo $extraField->group; ?>">
<?php if($extraField->type == 'header'): ?>
<h4 class="itemExtraFieldsHeader"><?php echo $extraField->name; ?></h4>
<?php else: ?>
<span class="itemExtraFieldsLabel"><?php echo $extraField->name; ?>:</span>
<span class="itemExtraFieldsValue"><?php echo $extraField->value; ?></span>
<?php endif; ?>
</li>
<?php endif; ?>
<?php endforeach; ?>
</ul>
<div class="clr"></div>
</div>
<?php endif; ?>

<?php if($this->item->params->get('itemHits') || ($this->item->params->get('itemDateModified') && intval($this->item->modified)!=0)): ?>
<div class="itemContentFooter">

<?php if($this->item->params->get('itemHits')): ?>

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

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
9 years 3 months ago #140534 by Krikor Boghossian
Replied by Krikor Boghossian on topic K2 item view - Gallery/Extra fields change ordering
Please read this post getk2.org/documentation/tutorials/174-templating-with-k2-and-the-concepts-of-sub-templates

After you have overriden the item.php file, you can move the blocks (he comments will help you locate them).

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

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

  • chrisgermany
  • chrisgermany's Avatar Topic Author
  • Offline
  • New Member
More
9 years 3 months ago - 9 years 3 months ago #140581 by chrisgermany
Replied by chrisgermany on topic K2 item view - Gallery/Extra fields change ordering
Krikor, thank you for your reply.

This explains, how to create a k2 subtemplate, all right, copying it into the site template, giving new name etc.

But i still have to change the ordering of the item view, how is that done in the subtemplate?

I moved the Blocks in the /componemt/k2/template....item.php, that did not work, does that mean if i do the same in the /templates/mytemplate//html/com_k2/default/item.php, editing item.php there THEN it will work??
Last edit: 9 years 3 months ago by chrisgermany.

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

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
9 years 3 months ago #140585 by Krikor Boghossian
Replied by Krikor Boghossian on topic K2 item view - Gallery/Extra fields change ordering
Did you check to see if your template already has overrides?

The: /templates/mytemplate//html/com_k2/default/item.php is indeed the correct path.

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

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

  • chrisgermany
  • chrisgermany's Avatar Topic Author
  • Offline
  • New Member
More
9 years 3 months ago #140836 by chrisgermany
Replied by chrisgermany on topic K2 item view - Gallery/Extra fields change ordering
Hi,

so, now i copied the com_k2/default into my template directory and renamed it. Now in the joomla k2 backend, i can chose this new layout for the K2 conten module for example.

But i still do not know, what/how to change the item.php so that the gallery and extra fields are displayed before the intro text.

What do i have to do?

Sorry, but my php/css knowledge is poor, but i know copy and paste and trial and error :-)

Thanks fpr further helt in advance

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

More
9 years 3 months ago #140849 by Lefteris
@chrisgermany

Hi,

You need to move the parts you want in the desired order. There are comments in the code indicating where each part starts. For example the code that renders the extra fields is the following:
	  <?php if($this->item->params->get('itemExtraFields') && count($this->item->extra_fields)): ?>
	  <!-- Item extra fields -->
	  <div class="itemExtraFields">
	  	<h3><?php echo JText::_('K2_ADDITIONAL_INFO'); ?></h3>
	  	<ul>
			<?php foreach ($this->item->extra_fields as $key=>$extraField): ?>
			<?php if($extraField->value != ''): ?>
			<li class="<?php echo ($key%2) ? "odd" : "even"; ?> type<?php echo ucfirst($extraField->type); ?> group<?php echo $extraField->group; ?>">
				<?php if($extraField->type == 'header'): ?>
				<h4 class="itemExtraFieldsHeader"><?php echo $extraField->name; ?></h4>
				<?php else: ?>
				<span class="itemExtraFieldsLabel"><?php echo $extraField->name; ?>:</span>
				<span class="itemExtraFieldsValue"><?php echo $extraField->value; ?></span>
				<?php endif; ?>
			</li>
			<?php endif; ?>
			<?php endforeach; ?>
			</ul>
	    <div class="clr"></div>
	  </div>
	  <?php endif; ?>

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