Keyword

Get extra field

  • Tiago Manuel da Costa Silva
  • Tiago Manuel da Costa Silva's Avatar Topic Author
  • Offline
  • Junior Member
More
14 years 6 months ago #83884 by Tiago Manuel da Costa Silva
Get extra field was created by Tiago Manuel da Costa Silva
Hi, i need to know how can i get the first extra field of every items i have on my database. I´m sure there´s a a way right?The thing is i listing some items on the frontpage and need to get this unique extrafield of each one of the items.I tryed doing a query to the db but i don´t know how to get an extrafield from this :[{"name":null,"value":"","target":null}]

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

More
14 years 6 months ago #83885 by william white
Replied by william white on topic Get extra field
If you are inside a k2 routine you can display the value of the first extra field of the current element like
$this->item->extra_fields[0]->value
If you can loop thru the items you can assign that statement to a variable or display it directly
Please send example code you are using and link

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

  • Tiago Manuel da Costa Silva
  • Tiago Manuel da Costa Silva's Avatar Topic Author
  • Offline
  • Junior Member
More
14 years 5 months ago #83886 by Tiago Manuel da Costa Silva
Replied by Tiago Manuel da Costa Silva on topic Get extra field
I´m using a simple query like
$query= mysql_query ("Select title From jos_k2_items)

I think that it is not a k2 routine because i'm using "joomla\components\com_content\views\frontpage\tmpl\default.php" to show this list on the first page (home).

Do you have any idea how to do this?

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

More
14 years 5 months ago #83887 by william white
Replied by william white on topic Get extra field
Then, look at jos_k2_items at the extra fields field. Mine is a text field with "[data,data,data]".
Somewhere k2 must parse this field. Its worth looking thru the files to find how to do this, as it could be used in many instances.
If someone knows the magic, please chime in!

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


Powered by Kunena Forum