Keyword

Author Details in K2 Tool: Authors List

  • Ma Bauer
  • Ma Bauer's Avatar Topic Author
  • Offline
  • New Member
More
5 years 2 months ago #171094 by Ma Bauer
Author Details in K2 Tool: Authors List was created by Ma Bauer
Moin.

Ich mache gerade erste Schritte in K2 und benötige folgende Funktion:

ich möchte den "itemAuthorBlock" unter den Beiträgen als Modul frei platzieren können.

Im Modul wird benötigt:
- Nutzer Avatar
- Nutzer Name
- Nutzer Email
- Nutzer Telefon

Es soll je Beitrag ein thematisch zuständiger Kontakt angezeigt werden, den man dann direkt kontaktieren kann.
Somit muss sich das Modul je nach Beitrag dynamisch füllen.

Dazu habe ich ein Override erstellt:
template/*NAME*/html/mod_k2_tools/authores.php
Modul-Option: Select Module Functionality: Authors List

Im "com_k2/templates/default.php" gibt es den entsprechenden Abschnitt *itemAuthorBlock*.
<?php if($this->item->params->get('itemAuthorBlock') && empty($this->item->created_by_alias)): ?>
	<!-- Author Block -->
	<div class="itemAuthorBlock">
		<?php if($this->item->params->get('itemAuthorImage') && !empty($this->item->author->avatar)): ?>
		<img class="itemAuthorAvatar" src="<?php echo $this->item->author->avatar; ?>" alt="<?php echo K2HelperUtilities::cleanHtml($this->item->author->name); ?>" />
		<?php endif; ?>

		<div class="itemAuthorDetails">
			<h3 class="itemAuthorName">
				<a rel="author" href="<?php echo $this->item->author->link; ?>"><?php echo $this->item->author->name; ?></a>
			</h3>

			<?php if($this->item->params->get('itemAuthorDescription') && !empty($this->item->author->profile->description)): ?>
			<p><?php echo $this->item->author->profile->description; ?></p>
			<?php endif; ?>

			<?php if($this->item->params->get('itemAuthorURL') && !empty($this->item->author->profile->url)): ?>
			<span class="itemAuthorUrl"><i class="icon-globe"></i> <a rel="me" href="<?php echo $this->item->author->profile->url; ?>" target="_blank"><?php echo str_replace('http://','',$this->item->author->profile->url); ?></a></span>
			<?php endif; ?>

			<?php if($this->item->params->get('itemAuthorURL') && !empty($this->item->author->profile->url) && $this->item->params->get('itemAuthorEmail')): ?>
			<span class="k2HorizontalSep">|</span>
			<?php endif; ?>

			<?php if($this->item->params->get('itemAuthorEmail')): ?>
			<span class="itemAuthorEmail"><i class="icon-envelope"></i> <?php echo JHTML::_('Email.cloak', $this->item->author->email); ?></span>
			<?php endif; ?>

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

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

			<div class="clr"></div>
		</div>
		<div class="clr"></div>
	</div>
	<?php endif; ?>

Kann mit jmd. sagen, wie ich die entsprechenden Informationen / Variablen in das Modul-Override bekomme?

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

More
5 years 2 months ago #171119 by JoomlaWorks
Replied by JoomlaWorks on topic Author Details in K2 Tool: Authors List
You can't just use the code from a component view (the file path you mention there is wrong by the way).

If you want to present K2 items (articles) with the user's info below each item, you should use "K2 Content". If you can be more detailed as to WHAT you want to show, I'll be able to provide a better solution for you.

Fotis / 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