Hi
When i use this code:
list($ret,$response) = GalleryCoreApi::createAlbum($parentAlbumId, $nameondisc, $title, $summary, $description, $keywords);
the album (the file) is created on the disc in the good directory but nothing in the database...
Could somebody help the novice?
Posts: 4342
Maybe there's some voodoo with closing the transaction before the db is updated. It would help if you posted a more complete code fragment with what you're trying to do, rather than a bare line.
Posts: 8
thanks for your answer, here the code:
<?php
require('includes/application_top.php');//configure,db_connect,....define()...
if (!defined(GALLERY_LINK_ENABLED)) {
require_once(DIR_FS_GALLERY . 'embed.php');
$uid =NULL; // empty string for anonymous/guest user
$ret = GalleryEmbed::init(array('g2Uri' => DIR_FS_GALLERY . 'main.php',
'embedUri' => DIR_FS_GALLERY . 'embed.php',
'activeUserId' => $uid,
'fullinit'=> 'true')
);
}
list($error, $parentAlbumId) = GalleryCoreApi::getPluginParameter('module', 'core', 'id.rootAlbum');
print_r($parentAlbumId); // 7
$nameondisc="secondtalbum";
$title="The first Album";
$summary="";
$description="future description";
$keywords ="myalbum";
list ($ret, $lockId) = GalleryCoreApi::acquireWriteLock($parentAlbumId);
if ($ret) {
return array($ret, null);
}
list($ret,$result) = GalleryCoreApi::createAlbum($parentAlbumId, $nameondisc, $title, $summary, $description, $keywords);
if ($ret) {
GalleryCoreApi::releaseLocks($lockId);
return array($ret, null);
}
print_r($result);
$ret = GalleryEmbed::done();
if ($ret) die($ret->getAsHtml());
?>
regards
nicoloas
Posts: 8
with the debug mode i probably found something...
the problem comes from application_top who loads the configure and functions and the gallery2/modules/zencart loads also the same functions
so i get a fatal error: Cannot redeclare zen_parse_input_field_data() (previously declared in .....
after this request I also have an error in the db
Error (ERROR_MISSING_OBJECT) : Missing object for 0
in modules/core/classes/GalleryStorage/GalleryStorageExtras.class at line 2054 (GalleryCoreApi::error)
in modules/core/classes/GalleryStorage/GalleryStorageExtras.class at line 98 (GalleryStorageExtras::_identifyEntities)
in modules/core/classes/GalleryStorage.class at line 313 (GalleryStorageExtras::loadEntities)
in modules/core/classes/helpers/GalleryEntityHelper_simple.class at line 71 (GalleryStorage::loadEntities)
in modules/core/classes/GalleryCoreApi.class at line 2361 (GalleryEntityHelper_simple::loadEntitiesById)
in modules/core/classes/GalleryTheme.class at line 1291 (GalleryCoreApi::loadEntitiesById)
in themes/matrix/theme.inc at line 65 (GalleryTheme::loadCommonTemplateData)
in modules/core/classes/GalleryTheme.class at line 932 (MatrixTheme::showAlbumPage)
in modules/core/classes/GalleryView.class at line 301 (GalleryTheme::loadTemplate)
in main.php at line 465 (GalleryView::doLoadTemplate)
in main.php at line 104
in main.php at line 88
Regards
Posts: 8
now the data are in the db but i have
Error (ERROR_MISSING_OBJECT) : Missing object for 0
after including an album and no more access to gallery ..
Could somebody help?
Posts: 8
and how to add an item into an album from my site WITHOUT using gallery views?
Posts: 16504
You might want to take a look and see how this guy has done it:
http://gallery.menalto.com/node/81010#comment-284733
____________________________________________
Like Gallery? Like the support? Donate now!!! See G2 live here
Posts: 8
hi, thanks for your message,i hope the code will help me.
i think also i must use instanciation
regards