The Joomla! Forum ™



Forum rules


Please use the mailing list here: http://groups.google.com/group/joomla-dev-general rather than this forum.



Post new topic Reply to topic  [ 11 posts ] 
Author Message
PostPosted: Fri Jul 13, 2012 5:29 pm 
User avatar
Joomla! Enthusiast
Joomla! Enthusiast

Joined: Sat Sep 23, 2006 5:54 am
Posts: 108
Hello,

I've been searching all over for some docs on com_content. I find it odd that there seems to be so little published.

I'm looking for best techniques for adding and removing content in #__content while using the API to properly maintain article properties (asset ids etc) during the add/remove process.

Have I missed some link to official docs somewhere?
I find it bizarre that this is not a common topic.


Last edited by NFG on Thu Jul 19, 2012 9:59 pm, edited 1 time in total.

Top
 Profile  
 
PostPosted: Fri Jul 13, 2012 11:51 pm 
Joomla! Explorer
Joomla! Explorer

Joined: Fri Nov 11, 2011 9:43 pm
Posts: 435
Location: Chicago, IL
You'll be hard pressed to find something that specific. The only time any Joomla employees ever post on here is to move a post to the correct forum.

Check out the fiiles inside [root]administrator/components/com_content/

Joomla MVC makes sense if you look at it long enough, lol. The models/articles.php file handles the DB call, you can reverse engineer that to get what you are looking for.


Top
 Profile  
 
PostPosted: Sat Jul 14, 2012 12:32 am 
User avatar
Joomla! Exemplar
Joomla! Exemplar

Joined: Fri Aug 12, 2005 7:19 am
Posts: 9206
Location: Leeds, UK
FYI there is no such thing as a Joomla employee everyone without exception is a volunteer

_________________
"Exploited yesterday... Hacked tomorrow"
Blog http://brian.teeman.net/
Joomla Hidden Secrets http://hiddenjoomlasecrets.com/


Top
 Profile  
 
PostPosted: Sat Jul 14, 2012 2:12 am 
Joomla! Explorer
Joomla! Explorer

Joined: Fri Nov 11, 2011 9:43 pm
Posts: 435
Location: Chicago, IL
Brian,

Sweet name, I'm a Brian too.

Thanks for the correction, as that is an excellent point and something a lot of people aren't aware of. I was so focused on quickly answering NFG's question I didn't realize my statement's tone could easily be misinterpreted. As a result I wanted to be sure I conveyed both my appreciation for your efforts and true intentions with my hastily posted comment.

NFG,

To expound on my previous, incomplete thought and Brian's input, because Joomla is powered by the open source community which includes everything from the code base to the online documentation; you can't expect the same results or for that matter, hold Joomla accountable in the same manner as you would a purchased software vendor. Joomla Docs is a Wiki, which is why you see there are some gaps in documentation and even sometimes *gasp* bugs.

However, there is a massive payoff for truly mastering becoming a Joomla developer. If you use all the <b>free</b> tools at your disposal (Eclipse, Phing, Ubuntu or WAMP, etc) and master them, you will be astounded at increases in productivity and resulting time saved. As a husband and father of two kids, I know there is nothing more valuable then time.

There isn't a person posting on these forums who didn't have to dig through the same documentation and same online resources on the web to learn what they have. If you are really serious about learning how to program Joomla, get the new Joomla Programming Book just released for 2.5. It only costs $30 bucks at Amazon and its 500 pages of detailed instructions to developing anything and everything you'll ever need for Joomla.

Good luck!


Top
 Profile  
 
PostPosted: Sat Jul 14, 2012 8:27 am 
User avatar
Joomla! Exemplar
Joomla! Exemplar

Joined: Fri Aug 12, 2005 7:19 am
Posts: 9206
Location: Leeds, UK
NFG perhaps you could explain in more detail what it is exactly that you are trying to do

Brian Perhaps we will meet at joomladay chicago next month

_________________
"Exploited yesterday... Hacked tomorrow"
Blog http://brian.teeman.net/
Joomla Hidden Secrets http://hiddenjoomlasecrets.com/


Top
 Profile  
 
PostPosted: Mon Jul 16, 2012 4:24 pm 
Joomla! Explorer
Joomla! Explorer

Joined: Fri Nov 11, 2011 9:43 pm
Posts: 435
Location: Chicago, IL
Brian,

I actually will be attending the August 8th Intermediate Admin class. I was interested in attending the main conference, but since this was a work expense (I'm the lone Joomla Developer, or Web Developer for that matter) I felt the best use of company resources would to fine tune my Administrative skills with the intermediate class.

Will you be teaching any classes?


Top
 Profile  
 
PostPosted: Mon Jul 16, 2012 6:01 pm 
User avatar
Joomla! Exemplar
Joomla! Exemplar

Joined: Fri Aug 12, 2005 7:19 am
Posts: 9206
Location: Leeds, UK
Sadly not

_________________
"Exploited yesterday... Hacked tomorrow"
Blog http://brian.teeman.net/
Joomla Hidden Secrets http://hiddenjoomlasecrets.com/


Top
 Profile  
 
PostPosted: Tue Jul 17, 2012 8:11 pm 
User avatar
Joomla! Enthusiast
Joomla! Enthusiast

Joined: Sat Sep 23, 2006 5:54 am
Posts: 108
Thanks a lot guys for the many posts.

I appear to have opened a subtly torrid topic by mentioning docs.

Yes, I have spent many happy hour dredging for docs on Joomla and I am aware that Joomla is built and supported by volunteers.

Still - loading all the content items in a category while strictly using the API, or creating an article from scratch and then adding it to the content table - again strictly using the API - I'm surprised that people in the community don't talk about these things in forums and ask questions and beat their heads against the damn thing as I do. I would have thought these were common activities. Am I the only person? am I really so dim?

Anyway, to the point:

I have a plugin. I need to load all the articles in a category and then link to them from a list. I know how to do this with categories, but I cannot seem to get the same results with content items. I could load directly from the database using SELECT * FROM .... but I am trying to play nice.

I have a component. I need to accept user input that is stored in a separate table. At a certain time after much chaining of approval the data in this table is moved over to the content table and published. I do this currently using JTable and this works in every respect except that the field for the asset_id is empty, and this worries me. I read places that the asset_id is important and can cause real problems if it is not set properly.

What class should I be using to manipulate content in this way?


Top
 Profile  
 
PostPosted: Tue Jul 17, 2012 9:38 pm 
Joomla! Explorer
Joomla! Explorer

Joined: Fri Nov 11, 2011 9:43 pm
Posts: 435
Location: Chicago, IL
I'm not 100%, maybe a more experienced Joomla Jockey can clarify, but the asset id is not a required field. One example of how it is used is if you have any categories specific to your extension. So if you add a category to your component within the context of your component, that category entry will have an Asset ID value, which refers to the #__assets table and tells joomla which component (if any, otherwise it belongs to asset id 1 by default which is the Joomla Core) has ownership.

Does that make any sense?


Top
 Profile  
 
PostPosted: Wed Jul 18, 2012 12:00 pm 
User avatar
Joomla! Enthusiast
Joomla! Enthusiast

Joined: Sat Sep 23, 2006 5:54 am
Posts: 108
Sorta,
Read this here.
http://docs.joomla.org/Fixing_the_assets_table
This is where I got the notion that I had to do something sensible about this.

In some 1.6 pre alpha docs I found they define assets thusly:
Quote:
Assets are items that you need to set access control on. For example each article on your site can be an asset and you can set edit permission for them. Currently these are not used in core.
http://docs.joomla.org/Access_Control_System_In_Joomla_1.6#Assets

Interestingly it appears that JTable is supposed to take care of this. Note the bit on asset tracking that takes up most of the code.
http://docs.joomla.org/API16:JTable/store

So it looks as though I have to go back and try to understand what I am doing wrong with JTable, and maybe read the 2.5 version of JTable->store() while I'm at it.


Top
 Profile  
 
PostPosted: Thu Jul 19, 2012 5:16 pm 
User avatar
Joomla! Enthusiast
Joomla! Enthusiast

Joined: Sat Sep 23, 2006 5:54 am
Posts: 108
Naturally the actual answer is quite arduous to discover but amounts to a very simple bit of code. In a correction to my earlier post I was not in fact using JTable, just hard-coding a query.

Here $topic is an assoc array with database field names for keys.
asset_id is not one of the keys but $topic->store() appears to set it automatically.

Code:
   function addContent($topic){
      
      $table = &JTable::getInstance('content');
      
      $table->bind($topic);
      
      if(!$table->check()) {
         // error, throw an exception or something
         return false;
      }
      
      if(!$table->store()) {
         // error
         return false;
      }
      
      return true;
   }


So that was easy.

Useful info on this can be found here:
http://docs.joomla.org/Using_the_JTable_class

here:
http://www.neotheme.com.au/blog/playing ... la-jtable/

and though it is somewhat out of date but provides a simple code example from which mine is derived, here:
viewtopic.php?p=1146535

May all this info bring you all hours of ecstatic pleasure. :eek:


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 11 posts ] 



Who is online

Users browsing this forum: No registered users and 7 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
Powered by phpBB® Forum Software © phpBB Group