Can anyone explain structure of content and assets table. I m adding articles by API so how i can insert data into that two tables. In which table i have to add first. Please guide.
1. Adding Joomla Content via the API
Not sure how you are using the API to create articles and why it doesn't create the assets entries for you - assuming you have already tried to do so - as, adding Joomla content through the API will handle this for you.
So you don't actually need to do anything extra in order to create the corresponding assets entries for your articles.
In short the procedure is:
1. Instatiate the JTableContent Object
$item = JTable::getInstance('Content');
2. Create your article's properties:
$item->title = $myTitle; $item->alias = JFilterOutput::stringURLSafe($myAlias); $item->introtext = $articleText; //... and so on
3. Save the article:
2. The Assets Table
In brief the foreach article there should be a related assets record which will hold ACL information about the article.
The assets table follows the Nested Set Model to store data Hierhically, similar to how data are represented in
XML, where every item has a Parent Item and 0 or more Children - except of the Root Item that has no parent.
Read this answer on an old question related with issues with
com_tags in the assets table, where if I can recall right there is an example explanation of how left/righ/level values are calculated, with an example diagram: Unexpected parent tag association.
In that answer there is also a link to a great post that explains the Nested Set Model
I just remembered there was some docs in Joomla.org about using nested set model, which can be found here: https://docs.joomla.org/Using_nested_sets