How to get item ID as global variable?

More
7 years 1 month ago - 7 years 1 month ago #66507 by lipatovroman
Hi!
As you know, FlexiContent does not give us flexible tools for Image Galleries.
Existing galleries are poor.

Image Gallery field does not have option to sort images in different folders feature .

So, we need to solve problems in other ways.

I found not bad free image slider gallery , that displays images from folder.

I use module version, because I don't understand how to use plugin.

My idea:

1. Create 1 module and place it in FC item template using Modules Anywhere plugin.
2. Edit module image slider gallery code to get current item ID (because images placed in folders with title=ID of item).
3. Check, if images in folder item_ID_field_id have prefix = l_ - it means, that it's large image.

So, how do I get current FC item ID in other Joomla extensions.

Thanks.
Last edit: 7 years 1 month ago by ggppdk.

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

More
7 years 1 month ago #66510 by micker

FLEXIcontent is Free but involves a very big effort on our part.
Like the our support? (for a bug-free FC, despite being huge extension) Like the features? Like the ongoing development and future commitment to FLEXIcontent?
-- Add your voice to the FLEXIcontent JED listing reviews. Thanks![/size]
The following user(s) said Thank You: lipatovroman

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

More
7 years 1 month ago #66515 by lipatovroman
This article explain how to get fields values.
I need only get item ID of current item.

I added code:
Code:
require_once (JPATH_ADMINISTRATOR.DS.'components/com_flexicontent/defineconstants.php'); JTable::addIncludePath(JPATH_ADMINISTRATOR.DS.'components'.DS.'com_flexicontent'.DS.'tables'); require_once(JPATH_SITE.DS."components/com_flexicontent/classes/flexicontent.fields.php"); require_once(JPATH_SITE.DS."components/com_flexicontent/classes/flexicontent.helper.php"); require_once(JPATH_SITE.DS."components/com_flexicontent/helpers/permission.php"); require_once(JPATH_SITE.DS."components/com_content/helpers/route.php"); require_once(JPATH_SITE.DS."components/com_flexicontent/helpers/route.php"); require_once(JPATH_SITE.DS."components/com_flexicontent/models/".FLEXI_ITEMVIEW.".php"); $item_arr = array(445,567); // myfunction_to_get_item_ids; $itemmodel_name = FLEXI_J16GE ? 'FlexicontentModelItem' : 'FlexicontentModelItems'; $itemmodel = new $itemmodel_name(); $fcid = $item_id; // Trying to get ID

But $fcid is empty...

I also tried
Code:
$fcid = $item->id;

Does nor work... :(

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

More
7 years 1 month ago #66516 by lipatovroman
Ok, this code works.
Code:
//include constants file $db = & JFactory::getDBO(); // Set a different item id if you don't want the current item ... $fcitem_id= JRequest::getInt('id',0); $fccat_id= JRequest::getInt('cid',0); $view= JRequest::getVar('view'); if ($view!='items' && $view!='item' && $view!='article') { return "not in items view"; } // RETRIEVE item data if ($fcitem_id) { $query = 'SELECT c.*' .' FROM '.'#'.'__content AS c ' .' WHERE c.id = ' . $fcitem_id; $db->setQuery($query); $itemdata = $db->loadObject(); $item_id = $itemdata->id; }

I don't know is it correct, but it works...

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

More
7 years 1 month ago - 7 years 1 month ago #66539 by ggppdk
Hello

yes use 'id' and 'cid'
but JRequest will be removed in J4.0
Code:
$fcitem_id= JRequest::getInt('id',0); $fccat_id= JRequest::getInt('cid',0);

so instead use:
Code:
$app = JFactory::getApplication(); $jinput = $app->input; $fcitem_id= $jinput->get('id', 0, 'INT'); $fccat_id= $jinput->get('cid', 0, 'INT');


-- Flexicontent is Free but involves a big effort on our part.
Like the our support? (for a bug-free FC, despite having a long list of functions) Like the features? Like the ongoing development and future commitment to FLEXIcontent?
-- Add your voice to the FLEXIcontent JED listing with a 5-star...
Last edit: 7 years 1 month ago by ggppdk.

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

More
7 years 1 month ago #66541 by ggppdk
Hello

please see my previous answer

also when we move the image-gallery field display to layout files like the other fields
it would be simpler to do this


-- Flexicontent is Free but involves a big effort on our part.
Like the our support? (for a bug-free FC, despite having a long list of functions) Like the features? Like the ongoing development and future commitment to FLEXIcontent?
-- Add your voice to the FLEXIcontent JED listing with a 5-star...

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

Moderators: vistamediajoomlacornerggppdk
Time to create page: 0.272 seconds
Save
Cookies user preferences
We use cookies to ensure you to get the best experience on our website. If you decline the use of cookies, this website may not function as expected.
Accept all
Decline all
Essential
These cookies are needed to make the website work correctly. You can not disable them.
Display
Accept
Analytics
Tools used to analyze the data to measure the effectiveness of a website and to understand how it works.
Google Analytics
Accept
Decline