- Posts: 6
COMMUNITY FORUM
item author in generic.php
- Peppo Nedra
- Topic Author
- Offline
- New Member
Less
More
14 years 8 months ago #77309
by Peppo Nedra
item author in generic.php was created by Peppo Nedra
Hi, I have a problem.
I want to add the item auhor in generic.php, after the category name of every item.
I'm not able with php. :-)
I add this at line 96:
echo $this->item->author->name; ?
but I'm non able to view the author name, after the category
Please, give me some info :-))))
THANKS!!!!
I want to add the item auhor in generic.php, after the category name of every item.
I'm not able with php. :-)
I add this at line 96:
echo $this->item->author->name; ?
but I'm non able to view the author name, after the category
Please, give me some info :-))))
THANKS!!!!
Please Log in or Create an account to join the conversation.
- jeanchristophe
- Offline
- Junior Member
Less
More
- Posts: 32
14 years 8 months ago #77310
by jeanchristophe
Replied by jeanchristophe on topic item author in generic.php
A solution out from the hat should be something like this:
You will have to replace 'genericItemDateCreated' by something like 'author' which you will find in one another file (sorry I don't remember the exact string.
Hope thats help
Regards
Jean-Christophe
You will have to replace 'genericItemDateCreated' by something like 'author' which you will find in one another file (sorry I don't remember the exact string.
Hope thats help
Regards
Jean-Christophe
Please Log in or Create an account to join the conversation.
- jeanchristophe
- Offline
- Junior Member
Less
More
- Posts: 32
14 years 8 months ago #77311
by jeanchristophe
Replied by jeanchristophe on topic item author in generic.php
I try again without the php balise:
if($item->params->get('genericItemDateCreated')):
if($item->params->get('genericItemDateCreated')):
Please Log in or Create an account to join the conversation.
- Peppo Nedra
- Topic Author
- Offline
- New Member
Less
More
- Posts: 6
14 years 8 months ago #77312
by Peppo Nedra
Replied by Peppo Nedra on topic item author in generic.php
I add this code, with the php baseline:
if($this->item->params->get('itemTitle')):
echo $this->item->title;
endif;
OR
if($item->params->get('genericItemTitle')):
echo JText::_('Published in');
echo $item->title->name;
endif;
BUT THE ITEM TITLE IS NOT VISIBLE!
Please, give me some info
if($this->item->params->get('itemTitle')):
echo $this->item->title;
endif;
OR
if($item->params->get('genericItemTitle')):
echo JText::_('Published in');
echo $item->title->name;
endif;
BUT THE ITEM TITLE IS NOT VISIBLE!
Please, give me some info
Please Log in or Create an account to join the conversation.
- Peppo Nedra
- Topic Author
- Offline
- New Member
Less
More
- Posts: 6
14 years 8 months ago #77313
by Peppo Nedra
Replied by Peppo Nedra on topic item author in generic.php
If I Install the new 2.2 version, May I solve my problem?
THANKS!!!
THANKS!!!
Please Log in or Create an account to join the conversation.
- Peppo Nedra
- Topic Author
- Offline
- New Member
Less
More
- Posts: 6
14 years 8 months ago #77314
by Peppo Nedra
Replied by Peppo Nedra on topic item author in generic.php
WOW! Great! I solve my problems!!! Many many thanks for your help!!! Thanks again!!
I use this solution:
$Item->author->username
After this passage, I write (n) html redirect page, one for every "username"
My english is terrible, but if you are going to the page, you view the solution:
live-arcimantova.it/blow-up-arci-mantova
I use this solution:
$Item->author->username
After this passage, I write (n) html redirect page, one for every "username"
My english is terrible, but if you are going to the page, you view the solution:
live-arcimantova.it/blow-up-arci-mantova
Please Log in or Create an account to join the conversation.
- Olivier Karfis
- Offline
- Elite Member
13 years 11 months ago #77315
by Olivier Karfis
Owner of www.FrenchToday.com - K2 fan and freelancer, runs the Joomla/K2 tip site: www.yanaku.com
Replied by Olivier Karfis on topic item author in generic.php
Hello,
Anybody try this solution with K2.4.1? Been trying for an hour and I'm not getting anywhere...
I'd like to get the author name and also the tag list for items within the generic.php view.
Thanks!
--Olivier
Anybody try this solution with K2.4.1? Been trying for an hour and I'm not getting anywhere...
I'd like to get the author name and also the tag list for items within the generic.php view.
Thanks!
--Olivier
Owner of www.FrenchToday.com - K2 fan and freelancer, runs the Joomla/K2 tip site: www.yanaku.com
Please Log in or Create an account to join the conversation.
- Miro Mitov
- Offline
- New Member
Less
More
- Posts: 9
13 years 9 months ago #77316
by Miro Mitov
Replied by Miro Mitov on topic item author in generic.php
Hi everyone,
managed to get the author name to display, but cant modify this for the link:
$items[$i]->author = &JFactory::getUser($items[$i]->created_by);
any help? How can i modify it for the link to the author? Google turns up dry for once...
Thanks.
managed to get the author name to display, but cant modify this for the link:
$items[$i]->author = &JFactory::getUser($items[$i]->created_by);
any help? How can i modify it for the link to the author? Google turns up dry for once...
Thanks.
Please Log in or Create an account to join the conversation.
- krmr
- Offline
- Senior Member
Less
More
- Posts: 61
13 years 8 months ago #77317
by krmr
Replied by krmr on topic item author in generic.php
Hi everyone,I have been struggling to get the author in generic.php for ages, and am happy to see now there is a solution.
However I tried the suggestion and it did work in generic template, but broke the category item template displaying error messages.May be I did it wrong? I placed "$items[$i]->author = &JFactory::getUser($items[$i]->created_by);" in view.html.php in line 255, after "else {" (just above "//Pathway" string)
Can someone point out the exact place for placing the code?
My problem is I have authors, and author aliases, so first the alias should be shown, and if absent then author/user is displayed, so I guess there must be some variable added to clear the error?
Any help is mush appreciated!
However I tried the suggestion and it did work in generic template, but broke the category item template displaying error messages.May be I did it wrong? I placed "$items[$i]->author = &JFactory::getUser($items[$i]->created_by);" in view.html.php in line 255, after "else {" (just above "//Pathway" string)
Can someone point out the exact place for placing the code?
My problem is I have authors, and author aliases, so first the alias should be shown, and if absent then author/user is displayed, so I guess there must be some variable added to clear the error?
Any help is mush appreciated!
Please Log in or Create an account to join the conversation.
- Miro Mitov
- Offline
- New Member
Less
More
- Posts: 9
13 years 8 months ago #77318
by Miro Mitov
Replied by Miro Mitov on topic item author in generic.php
Hey there,
To get the author in the view.html.php you dont need to to include this... simply put the following to get the author and the link:
<?php if($this->item->params->get('catItemAuthor')): ?>
<!-- Item Author -->
<span class="catItemDateCreated">
<?php echo K2HelperUtilities::writtenBy($this->item->author->profile->gender); ?> <a href="<?php echo $this->item->author->link; ?>"><?php echo $this->item->author->name; ?></a>
</span>
<?php endif; ?>
you can change the span class to anything you like to get it to display the way you like it.
Hope this works for you.
krmr trzv said:
Hi everyone,I have been struggling to get the author in generic.php for ages, and am happy to see now there is a solution.
However I tried the suggestion and it did work in generic template, but broke the category item template displaying error messages.May be I did it wrong? I placed "$items[$i]->author = &JFactory::getUser($items[$i]->created_by);" in view.html.php in line 255, after "else {" (just above "//Pathway" string)
Can someone point out the exact place for placing the code?
My problem is I have authors, and author aliases, so first the alias should be shown, and if absent then author/user is displayed, so I guess there must be some variable added to clear the error?
Any help is mush appreciated!
To get the author in the view.html.php you dont need to to include this... simply put the following to get the author and the link:
<?php if($this->item->params->get('catItemAuthor')): ?>
<!-- Item Author -->
<span class="catItemDateCreated">
<?php echo K2HelperUtilities::writtenBy($this->item->author->profile->gender); ?> <a href="<?php echo $this->item->author->link; ?>"><?php echo $this->item->author->name; ?></a>
</span>
<?php endif; ?>
you can change the span class to anything you like to get it to display the way you like it.
Hope this works for you.
krmr trzv said:
Hi everyone,I have been struggling to get the author in generic.php for ages, and am happy to see now there is a solution.
However I tried the suggestion and it did work in generic template, but broke the category item template displaying error messages.May be I did it wrong? I placed "$items[$i]->author = &JFactory::getUser($items[$i]->created_by);" in view.html.php in line 255, after "else {" (just above "//Pathway" string)
Can someone point out the exact place for placing the code?
My problem is I have authors, and author aliases, so first the alias should be shown, and if absent then author/user is displayed, so I guess there must be some variable added to clear the error?
Any help is mush appreciated!
Please Log in or Create an account to join the conversation.