Note that there are some explanatory texts on larger screens.

plurals
  1. POGoogle Docs API list of documents and two folders with same name
    primarykey
    data
    text
    <p>I use PHP to get a list of folders, and then documents from Google Docs (two API requests).</p> <p>Getting a list of the folders, I can get their folderID, which is fine.</p> <p>However, when getting a list of documents, it returns categories, and these only contain the name of the folder.</p> <p>My problem exists because I have two folders with the same name, and my code is merging the documents from these, because they have the same name.</p> <p>The function I use to get a list of the documents within the folder:</p> <pre><code>/** * Gets a list of 'internal' IDs of docs within a certain folder * @global Mixed $fileslist * @param String $folder * @return Array */ function getDocumentsInFolder($folder) { global $fileslist; $docs = array(); foreach ($fileslist as $id =&gt; $files) { if (in_array($folder, $files['folders'])) { $docs[] = $id; } } return $docs; } </code></pre> <p>And the arrays are:</p> <pre><code> foreach ($list[$i]-&gt;category as $cat) { $folders[] = $cat-&gt;label; } $folderslist[$i] = array( 'name' =&gt; $foldername, 'authorname' =&gt; $authorname, 'authoremail' =&gt; $authoremail, 'lastupdated' =&gt; $lastupdated, 'fid' =&gt; $fid ); $fileslist[] = array( 'name' =&gt; $name, 'authorname' =&gt; $authorname, 'authoremail' =&gt; $authoremail, 'lastupdated' =&gt; $lastupdated, 'folders' =&gt; $folders, 'id' =&gt; $id, 'type' =&gt; $list[$i]-&gt;extensionElements[0]-&gt;text, ); </code></pre> <p>The XML the Google Docs API for the list of documents is @ <a href="http://code.google.com/apis/documents/docs/3.0/developers_guide_protocol.html#ListDocs" rel="nofollow noreferrer">http://code.google.com/apis/documents/docs/3.0/developers_guide_protocol.html#ListDocs</a> (Note how the categories are just folder names).</p> <p>Any ideas how to stop files appearing in all instances of that folder name, and just in their proper folder?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload