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.

  • Thanks for your answer and i will implement it but how i can upload image or how i can specify image url. Can anyone guide? – Info Truth Nov 24 '16 at 15:09
  • I discovered your comment purely by chance. Don't expect others to be notified after commenting under your question. Please read the help center section of JSE to find out how the site works. Also read the small help section of the comments. Regarding your comment, this is not directly related with the title of your question, which is the Assets table. Consider asking another question - explaining clearly your current problem. Regarding this question - if the answers below answered it, then consider accepting it - joomla.stackexchange.com/help/someone-answers – FFrewin Nov 25 '16 at 6:00

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

3. Docs

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.