Using Profiles like social Media sites

More
9 years 7 months ago #49356 by ggppdk
Hello

here is a draft FAQ article about this, please note that it is untested/incomplete:

How to create a FLEXIcontent item by calling the FLEXIcontent item model in custom code


-- 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.

More
9 years 7 months ago #49464 by milind.purandare
Thanks a million.

The line
require_once(JPATH_ADMINISTRATOR.DS.'components'.DS.'com_flexicontent'.DS.'models'.DS.'item.php');

does not let me proceed. (code stops on this line)

So I dropped it.

So I do :
$mynewitem = new FlexicontentModelItem();
$data = array();
$data = 0; // indicate a new item will be created
$data = "1" ; // e.g. 1 for article
$data= 'en-GB'; // e.g. 'en-GB'
$data = 1;
$data = array("1","2","3");
$data = 2; // item version is approved
$data = 1; // 1 for published ...
$data = 'PHP CODE CREATED TITLE';
$data = 'PHP CODE CREATED DESCRIPTION';
$mynewitem->store($data);


Then the code goes upto mynewitem-store where it enters the Store method in ParentclassItem.php of Flex.

Then it throws invalid token on entry!! (It is right at start of the "store" method)

Am I doing something wrong with includes?

Just hairline away from my integration... your help much appreciated.

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

More
9 years 7 months ago #49465 by ggppdk

require_once(JPATH_ADMINISTRATOR.DS.'components'.DS.'com_flexicontent'.DS.'models'.DS.'item.php');


you need it,

you can not create the object (item model) if you do not load the class file.


- are you loading Joomla API before calling the above ?
- does it say that DS is unknown ?

for loading the Joomla Framework, please see the above article, i have updated it


-- 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.

More
9 years 6 months ago #50049 by milind.purandare
Hi

I am so sorry still struggling with this code.

This is inside the item.php of a template called Welcome (welcoem template created from blog template)...

The code hangs at :
require_once(JPATH_ADMINISTRATOR.DS.'components'.DS.'com_flexicontent'.DS.'models'.DS.'item.php');

Thanks in anticipation
===============

<?php
define( '_JEXEC', 1 );
define( '_VALID_MOS', 1 );
define( 'JPATH_BASE', realpath(dirname(__FILE__)));
define( 'DS', DIRECTORY_SEPARATOR );

//sub folder
define( 'JPATH_BASE', realpath(dirname(__FILE__).'/../..' ));

require_once ( JPATH_BASE .DS.'includes'.DS.'defines.php' );
require_once ( JPATH_BASE .DS.'includes'.DS.'framework.php' );


$app = JFactory::getApplication('site');
$app->initialise();

require_once(JPATH_ADMINISTRATOR.DS.'components'.DS.'com_flexicontent'.DS.'models'.DS.'item.php');

$mynewitem = new FlexicontentModelItem();
$data = array();
$data = 0; // indicate a new item will be created

// Type and language
$data = "1" ; // e.g. 1 for article
$data= 'en-GB'; // e.g. 'en-GB'

// main category, secondary categories and tags
$data = 1; // INTEGER ... the main category of the item
$data = array("1","2","3"); //e.g. array(55,117,56) an array of the secondary categories of the item

$data = 2; // item version is approved
$data = 1; // 1 for published ...

$data = 'PHP CODE CREATED TITLE';
$data = 'PHP CODE CREATED DESCRIPTION';

$mynewitem->store($data);

?>

==============

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

More
9 years 6 months ago #50256 by milind.purandare
Look forward to your guidance... thanks

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

More
9 years 6 months ago #50269 by ggppdk
Hello



best solution is that you use new plugin and let plugin do this work, by adding a replacement inside your template



it is almost done, but closing bugs for final FC version is a priority, plug our paid work, will try to finish plugin next days, i am sorry we could not have it earier


-- 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.344 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