- Posts: 21
COMMUNITY FORUM
change positions of item parts
- executor
- Topic Author
- Offline
- Junior Member
Less
More
10 years 4 months ago #128922
by executor
change positions of item parts was created by executor
Normally k2 items have a written by (author) at the top and a read (time viewed) times at the bottom. The type of content on my site means that these should both be inside the item simailer to a youtube video. Since joomla is based off php im guessing that their is a php code that i could put in the items code exactly where i want them displayed. What is the php code i could use for this or if thats not how then how would i do it.
Please Log in or Create an account to join the conversation.
- Lefteris
- Offline
- Moderator
Less
More
- Posts: 8743
10 years 4 months ago #128923
by Lefteris
JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Replied by Lefteris on topic Re: change positions of item parts
You can completely change the output of K2 to meet your needs. First read getk2.org/documentation/tutorials/174-templating-with-k2-and-the-concepts-of-sub-templates to get familiar with templates in K2 and Joomla! . It is important to apply your changes to overrides and not in core K2 files. Otherwise you will lose your changes in future updates.
JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Please Log in or Create an account to join the conversation.
- executor
- Topic Author
- Offline
- Junior Member
Less
More
- Posts: 21
10 years 4 months ago #128924
by executor
Replied by executor on topic Re: change positions of item parts
I tried to change the position of authorship by copying and pasting the fowling code into the item where i wanted the author to be displayed: <span class="itemAuthor">
<?php echo K2HelperUtilities::writtenBy($this->item->author->profile->gender); ?>
<?php if(empty($this->item->created_by_alias)): ?>
<a rel="author" 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>
This is what displays in the browser: Written by
Parse error: syntax error, unexpected $end in /home/bypassga/public_html/plugins/content/DirectPHP/DirectPHP.php(58) : eval()'d code on line 1
Parse error: syntax error, unexpected T_ELSE in /home/bypassga/public_html/plugins/content/DirectPHP/DirectPHP.php(58) : eval()'d code on line 1
Parse error: syntax error, unexpected T_ENDIF in /home/bypassga/public_html/plugins/content/DirectPHP/DirectPHP.php(58) : eval()'d code on line 1
For some reason written by displays but i get errors where the author link should be.
<?php echo K2HelperUtilities::writtenBy($this->item->author->profile->gender); ?>
<?php if(empty($this->item->created_by_alias)): ?>
<a rel="author" 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>
This is what displays in the browser: Written by
Parse error: syntax error, unexpected $end in /home/bypassga/public_html/plugins/content/DirectPHP/DirectPHP.php(58) : eval()'d code on line 1
Parse error: syntax error, unexpected T_ELSE in /home/bypassga/public_html/plugins/content/DirectPHP/DirectPHP.php(58) : eval()'d code on line 1
Parse error: syntax error, unexpected T_ENDIF in /home/bypassga/public_html/plugins/content/DirectPHP/DirectPHP.php(58) : eval()'d code on line 1
For some reason written by displays but i get errors where the author link should be.
Please Log in or Create an account to join the conversation.
- Lefteris
- Offline
- Moderator
Less
More
- Posts: 8743
10 years 4 months ago #128925
by Lefteris
JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Replied by Lefteris on topic Re: change positions of item parts
As the message says you have a syntax error. Ensure that you are moving the whole block of code. Some parts include if and foreach statements. Make sure that you don't break them.
JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Please Log in or Create an account to join the conversation.