I am currently building a google drive plugin for wordpress that read a users google document files and displays them in the admin page and allows a user to convert them.
<div class="wrap">
<h2>Wordpress x Google Drive</h2>
<h3>How To Use:</h3>
<h4>Click on a Google Drive Document to open it in your Google Drive account to edit it.</h4>
<h4>Click on the <img src='DrivePluginIcons/convert.png'> icon to convert your document into a Wordpress draft.</h4>
<?php if( isset($message) ): ?>
<div class="updated"><p><?php echo $message; ?></p></div>
<?php elseif( isset($error) ): ?>
<div class="error"><p><strong><?php echo $error; ?></strong></p></div>
<?php endif; ?>
<?php if($settings === FALSE or empty($settings) ): ?>
<p>You have not set up any accounts yet.</p><a href="<?php echo $client- >createAuthUrl(); ?>">Add a new account</a></p>
<?php else: ?>
<h3>Logged In Drive Account:</h3>
<ol>
<li><?php echo $settings->email; ?><a href="<?php echo $url; ?>&remove=<? php echo urlencode( $settings->email);?>">(Remove)</a></li>
</ol>
<h3> Here are the documents on your drive:</h3>
<?php $files_list = $service->files->listFiles(array())->getItems(); ?>
<ol>
<?php foreach($files_list as $item):?>
<?php if ($item['mimeType']== "application/vnd.google-apps.folder" or $item['mimeType']=='application/vnd.google-apps.document'):
if (!empty($item['parents'])):
echo '<li><span><img src="' . $item['iconLink'] . '" alt="Icon"> <a href="' . $item['downloadUrl'] . '" target=_self"' . '">' . $item- >title . '</a>';
//echo "<form action=./cexdrive.php' method='get'>";
// echo '<input type="hidden" name="DocId" value=$item["id"]>';
//edited here /image/google_drive_icon.png
echo "<a href=".$url."&DocId=".$item['id']."> <img src='DrivePluginIcons/convert.png'> </a></span></li>";?>
<?php endif; ?>
<?php endif; ?>
<?php endforeach; ?>
</ol>
<br>
I am able to display the folders and the documents but I can't have the child documents underneath their parent folders.
Any help would be much appreciated.
Aucun commentaire:
Enregistrer un commentaire