Missing template-output in custom datatype

Author Message

Felix Laate

Thursday 12 January 2006 1:48:20 am

Hi all!

I'm making a colorpicker-datatype. I've been in trouble from the very beginning. The extension wouldn't register correctly. Debug reported that there was a strange "_space_" in the path to the datatypes directory - "/extensions/colorpicker /datatypes". I changed

eZDataType::register( EZ_DATATYPESTRING_COLORPICKER, "ezcolorpicker" );

to

eZDataType::register( EZ_DATATYPESTRING_COLORPICKER, "ezcolorpickertype" );

 

and then it worked..

But now comes the next challenge. I can add a colorpicler-attribute to a class, but there is a problem with the templates - they don't show.

I read that a missing design.ini.append.php would cause this, but I do have one:

<?php
/*

[ExtensionSettings]
DesignExtensions[]=colorpicker

*/
?>

I'm really excited with designing extesions, but I need to get past the first hirdles. Documentation is limited, so please give me some advice if you have some :-)

Felix

Publlic Relations Manager
Greater Stavanger
www.greaterstavanger.com

Hans Melis

Thursday 12 January 2006 1:58:50 am

Hi Felix,

1) Does the template actually exist?

2) If it does, have you cleared the template override cache?

Hans
http://blog.hansmelis.be

Felix Laate

Thursday 12 January 2006 2:23:09 am

Hi Hans,

Thank you for your answer!

I have the files:

extension/colorpicker/design/standard/templates/content/datatype/edit/ezcolorpickertype.tpl
extension/colorpicker/design/standard/templates/content/datatype/view/ezcolorpickertype.tpl

And I have cleared all caches.

Felix

Publlic Relations Manager
Greater Stavanger
www.greaterstavanger.com

Hans Melis

Thursday 12 January 2006 2:27:27 am

The templates should have the name of the datatype, not its class name. In your case, just name them <b>ezcolorpicker.tpl</b> (thus without <i>type</i>)

Edit: and clear the template override cache again after the rename just to be sure

Hopefully that solves it ;-)

Hans
http://blog.hansmelis.be

Felix Laate

Thursday 12 January 2006 3:19:12 am

Hi again,

I changed the filenames and cleared all the cache, but it still won't work.

This my php-code:

<?php   

// 
// ezcolorpicker DataType
//
//

// Include the super class file 
include_once( "kernel/classes/ezdatatype.php" );   

// Define the name of datatype string 
define( "EZ_DATATYPESTRING_COLORPICKER", "ezcolorpickertype" );   

class eZColorPickerType extends eZDataType {    

function eZColorPickerType()    {        
	$this->eZDataType( EZ_DATATYPESTRING_COLORPICKER, "Colorpicker" );    
}      

function fetchObjectAttributeHTTPInput( &$http, $base, &$contentObjectAttribute ) {
	if ( $http->hasPostVariable( $base . "_data_text_" . $contentObjectAttribute->attribute( "id" ) ) ) {
		$data =& $http->postVariable( $base . "_data_text_" . $contentObjectAttribute->attribute( "id" ));
		$contentObjectAttribute->setAttribute( "data_text", $data );
	}        
	return true;    
}      

function storeObjectAttribute( &$contentObjectattribute ) {    
}     

function &objectAttributeContent( &$contentObjectAttribute ) {        
 	return $contentObjectAttribute->attribute( "data_text" ); 
}      

function metaData( $contentObjectAttribute ) {        
	return $contentObjectAttribute->attribute( "data_text" ); 
}      

function title( &$contentObjectAttribute ) {        
	return $contentObjectAttribute->attribute( "data_text" );  
} 

}   

eZDataType::register( EZ_DATATYPESTRING_COLORPICKER, "ezcolorpickertype" ); 

?> 

Felix

Publlic Relations Manager
Greater Stavanger
www.greaterstavanger.com

Felix Laate

Thursday 12 January 2006 6:47:46 am

Hans,

I figured it out.. or rather I didn't. I redid the whole thing, and then it worked.

Thank you for your advices!

Felix

Publlic Relations Manager
Greater Stavanger
www.greaterstavanger.com

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