What are the strings for other fields from the K2 items?

News Show Pro GK5 - flexible, responsive and easily extendable free Joomla module support forum.
Rate this topic: Evaluations: 0, 0.00 on the average.Evaluations: 0, 0.00 on the average.Evaluations: 0, 0.00 on the average.Evaluations: 0, 0.00 on the average.Evaluations: 0, 0.00 on the average.Evaluations: 0, 0.00 on the average.
GK User
Tue Aug 23, 2016 4:34 pm
Hi,
on Portfolio Grid option for NSP on roll over on the image it shows the Title, Date and Author.
In controller.php I learned that this code is for the author name:
Code: Select all
// Author
if($this->parent->config['portal_mode_portfolio_grid_author'] != 0) {
   echo '<span>'.$this->parent->content[$i]['author_username'].'</span>';
}
echo '</span>';

I guess that the same way I can get the other fields even the extra fields but I cannot find out how and where is this defined. Where do you assign 'author_username' for the authors name since in the K2 item the syntax for author data is: $this->item->params->get('itemAuthor').

It has to do something with the content[$i] but not sure where to search.

Thanks,
Gorast
User avatar
Platinum Boarder

teitbite
Fri Aug 26, 2016 8:40 am
Hi

This is not exactly like that. Naming of variables can be a lot different between extensions and it doesn't even have to be similar.

In Your example $this->parent->content[$i]['author_username'] is just one of the values from database (query for database is located in style's modal.php) and there the naming is decided. When You will see ".. AS author_username" it's the place. Also a full list of items pulled from database with their naming will be close to this one.

Or You can simply use a method I found extremely useful and right after the piece of the code You have copied above use a construction like:

Code: Select all
print '<pre>';
var_dump( $this->parent->content[$i] );
print '</pre>';


when You will look at site after adding this code, full list of elements in $this->parent->content[$i] will be revealed.
User avatar
Moderator


cron