- Posts: 4
COMMUNITY FORUM
- Forum
- K2 Community Forum
- English K2 Community
- [SOLVED] How to call K2 viewed item's title / creation date ?
[SOLVED] How to call K2 viewed item's title / creation date ?
- Paul
-
Topic Author
- Offline
- New Member
Less
More
8 years 8 months ago #156869
by Paul
How to call K2 viewed item's title / creation date ? was created by Paul
Hello here !
As mentionned in title, I'd like to know how to call the K2 current item's title / creation date on my template index.php ?
What I'm trying to achieve is to display (if user is on a K2 item's page ) the title and creation date of a K2 item somewhere else ( in my index.php of my template for example ).
The thing is that I'd like to completely move the title/created date from K2 item to a module position on my template.
I've done a lot of researches but couldn't find anything but this, that work well but only for Joomla article's titles, not K2's : p
Thanks in advance !
As mentionned in title, I'd like to know how to call the K2 current item's title / creation date on my template index.php ?
What I'm trying to achieve is to display (if user is on a K2 item's page ) the title and creation date of a K2 item somewhere else ( in my index.php of my template for example ).
The thing is that I'd like to completely move the title/created date from K2 item to a module position on my template.
I've done a lot of researches but couldn't find anything but this, that work well but only for Joomla article's titles, not K2's : p
$option = JRequest::getCmd('option');
$view = JRequest::getCmd('view');
if ($option=="com_content" && $view=="article") {
$ids = explode(':',JRequest::getString('id'));
$article_id = $ids[0];
$article =& JTable::getInstance("content");
$article->load($article_id);
echo $article->get("title");
}
Thanks in advance !
Please Log in or Create an account to join the conversation.
- Mohamed Abdelaziz
-
- Offline
- Platinum Member
- Joomla Developer
8 years 8 months ago #156871
by Mohamed Abdelaziz
Multiple Extra Fields Groups for K2
AutoMeta for K2
Chained Fields for K2
More K2 Extensions In My Extensions Store
Replied by Mohamed Abdelaziz on topic How to call K2 viewed item's title / creation date ?
I think this module is helpful for this purpose extensions.joomla.org/extension/bnr-content-for-k2
Multiple Extra Fields Groups for K2
AutoMeta for K2
Chained Fields for K2
More K2 Extensions In My Extensions Store
Please Log in or Create an account to join the conversation.
- Paul
-
Topic Author
- Offline
- New Member
Less
More
- Posts: 4
8 years 8 months ago #156872
by Paul
Replied by Paul on topic How to call K2 viewed item's title / creation date ?
Nice ! Exactly what I wanted, thanks a lot : )
Please Log in or Create an account to join the conversation.
- Paul
-
Topic Author
- Offline
- New Member
Less
More
- Posts: 4
8 years 8 months ago #156883
by Paul
Replied by Paul on topic How to call K2 viewed item's title / creation date ?
Do you know if the same module exist but for Joomla articles plz ? : p
Please Log in or Create an account to join the conversation.
- Mohamed Abdelaziz
-
- Offline
- Platinum Member
- Joomla Developer
8 years 8 months ago #156886
by Mohamed Abdelaziz
Multiple Extra Fields Groups for K2
AutoMeta for K2
Chained Fields for K2
More K2 Extensions In My Extensions Store
Replied by Mohamed Abdelaziz on topic How to call K2 viewed item's title / creation date ?
I think the developer has a similar module for Joomla, you can have a look at their website.
Multiple Extra Fields Groups for K2
AutoMeta for K2
Chained Fields for K2
More K2 Extensions In My Extensions Store
Please Log in or Create an account to join the conversation.
- Paul
-
Topic Author
- Offline
- New Member
Less
More
- Posts: 4
8 years 8 months ago #156887
by Paul
Replied by Paul on topic How to call K2 viewed item's title / creation date ?
aye but its not free :-/
I managed to do it with the code I posted on my original topic but had to do some tweaking : p
I managed to do it with the code I posted on my original topic but had to do some tweaking : p
Please Log in or Create an account to join the conversation.
- Andy
-
- Offline
- New Member
Less
More
- Posts: 3
8 years 7 months ago #158118
by Andy
Replied by Andy on topic How to call K2 viewed item's title / creation date ?
Hi, I looked for ages for a way to display the k2 item outside of the main k2 container (i wanted the title to be big and 100% width at the top of the page and separate from the other k2 info. This worked for me:
<?php
$db = JFactory::getDBO();
$articleid = JRequest::getInt('id');
$db->setQuery('SELECT title FROM #__k2_items WHERE id='.$articleid);
$myid=$db->loadResult();
echo $myid;
?>
<?php
$db = JFactory::getDBO();
$articleid = JRequest::getInt('id');
$db->setQuery('SELECT title FROM #__k2_items WHERE id='.$articleid);
$myid=$db->loadResult();
echo $myid;
?>
Please Log in or Create an account to join the conversation.
- Krikor Boghossian
-
- Offline
- Platinum Member
Less
More
- Posts: 15920
8 years 7 months ago #158124
by Krikor Boghossian
JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Replied by Krikor Boghossian on topic How to call K2 viewed item's title / creation date ?
This post will help you.
www.joomlaworks.net/forum/k2-en/46586-custom-k2-content-module-assistance?start=10#157674
www.joomlaworks.net/forum/k2-en/46586-custom-k2-content-module-assistance?start=10#157674
JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Please Log in or Create an account to join the conversation.
- Forum
- K2 Community Forum
- English K2 Community
- [SOLVED] How to call K2 viewed item's title / creation date ?