Getting error on creating item by calling FLEXIcontent item model in custom code

More
8 years 13 hours ago #72493 by ggppdk
Hello

i retested with the exact code that the FAQ article has
and it is working with v3.2.1.12

are you running it from an external script (that loads Joomla framework manually)
or from inside a Joomla extension ?


-- 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 review. Thanks!

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

More
8 years 12 hours ago - 8 years 12 hours ago #72494 by Ali_wdm
Editor removes some code. So I am attaching file. Please go through function onAjaxCreateSubItems()

File Attachment:

File Name: subitem_20...3-24.txt
File Size:33.79 KB
Last edit: 8 years 12 hours ago by Ali_wdm.

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

More
8 years 9 hours ago #72495 by Ali_wdm
This code is not working in ajax call using com_ajax.
I have written this code in separate file and make ajax call, everything is working fine. What is problem in ajax call using com_ajax...??

How to get newly created item id...???
How to delete item by custom code...??

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

More
7 years 11 months ago - 7 years 11 months ago #72496 by ggppdk
Hello

about the specific error that you are getting

replace:
Code:
JTable::addIncludePath(JPATH_COMPONENT_ADMINISTRATOR.DS.'tables');

with:
Code:
JTable::addIncludePath(JPATH_ADMINISTRATOR.DS.'components'.DS.'com_flexicontent'.DS.'tables');

and it will work

About getting the ID of the new item
Code:
if ( !$item_model->store($data) ) { $msg = 'Failed to store item: '. $item_model->getError(); JLog::add($msg); echo $msg."<br/>"; }

you can use:
Code:
echo $item_model->get('id');


-- 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 review. Thanks!
Last edit: 7 years 11 months ago by ggppdk.

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

More
7 years 11 months ago #72497 by Ali_wdm
Thanks a lot.
How to delete item by ajax call....?

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

More
7 years 11 months ago #72500 by ggppdk
Hello

security concerns about creating and deleteing via custom code

Please note that the DB model only does what the controllers tell it
- so when you are using the the DB item model directly via custom code

then you realize that you also need to check ACL ?
someone can access these URLs and do thing in you website

also an alternative to using the DB item model directly

would be you instatiate a FLEXIcontent controller instance
and call its tasks, that would also include ACL checks

$controller = new ...controller class name ...

// then set data into $POST

// Then call

$controller->save();
$controller->delete();

just the above will do filtering and ACL checks for current user

so it depends who has access to run your custom scripts


-- 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 review. Thanks!

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

More
7 years 11 months ago #72504 by Ali_wdm
Can you please give an example how to instatiate a FLEXIcontent controller instance, then set data into $POST, Then call remove() function...??

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

More
7 years 11 months ago #72517 by Ali_wdm
Please reply, I am waiting for your response

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

More
7 years 11 months ago #72518 by ggppdk
Hello

a little busy now

will try to give the code during today evening
otherwise tomorrow


-- 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 review. Thanks!

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

More
7 years 11 months ago #72519 by ggppdk
Hello

please don't hesitate to post a reminder tomorrow (or in a forum topic) if you do not get answer


-- 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 review. Thanks!

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

Moderators: vistamediajoomlacornerggppdk
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
Save