Set priority in import script

Author Message

Ekkehard Dörre

Tuesday 12 July 2005 1:04:46 am

Hi,
working on an import script, I need images sort by priority. So what to do?
Change sort field of parent to priority and give children the priority number.

And that's my problem, to change the sort field of an existing parent and give a priority number to the image.

In my try, I gave the image the sort field priority (8), but not the parent and can't give them the number.

if (file_exists($href)) {

	// Import image
	$classID = 5;
	$class = & eZContentClass :: fetch($classID);
	$creatorID = 14;
	$parentNodeID = $placeNodeID;

	$contentObject = & $class->instantiate($creatorID, 1);

	$nodeAssignment = & eZNodeAssignment :: create(array ('contentobject_id' => $contentObject->attribute('id'), 'contentobject_version' => $contentObject->attribute('current_version'), 'parent_node' => $parentNodeID, 'sort_field' => 8, 'sort_order' => 1, 'is_main' => 1));
	$nodeAssignment->store();

	$version = & $contentObject->version(1);
	$version->setAttribute('modified', eZDateTime :: currentTimeStamp());
	$version->setAttribute('status', EZ_VERSION_STATUS_DRAFT);

	$version->store();

	$contentObjectID = $contentObject->attribute('id');
	$dataMap = & $contentObject->dataMap();

	$dataMap['name']->setAttribute('data_text', $h1Tag);
	$dataMap['name']->store();

	$dataMap['caption']->setAttribute('data_text', $notesTag);
	$dataMap['caption']->store();

	$imageContent = & $dataMap['image']->attribute('content');
	$imageContent->initializeFromFile($href, $altTag);
	$dataMap['image']->store();

	$paragraphContent .= "<object id='$contentObjectID' align='$imageAlignment' size='$imageSize' />";

	include_once ('lib/ezutils/classes/ezoperationhandler.php');
	$operationResult = eZOperationHandler :: execute('content', 'publish', array ('object_id' => $contentObjectID, 'version' => 1));
}

Can anybody give me the trick?

Thanks, ekke

http://www.coolscreen.de - Over 40 years of certified eZ Publish know-how: http://www.cjw-network.com
CJW Newsletter: http://projects.ez.no/cjw_newsletter - http://cjw-network.com/en/ez-publ...w-newsletter-multi-channel-marketing

Ekkehard Dörre

Wednesday 13 July 2005 2:56:41 am

Has anybody an idea?

Thanke, ekke

http://www.coolscreen.de - Over 40 years of certified eZ Publish know-how: http://www.cjw-network.com
CJW Newsletter: http://projects.ez.no/cjw_newsletter - http://cjw-network.com/en/ez-publ...w-newsletter-multi-channel-marketing

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.