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.

eZ debug

Timing: Jan 20 2025 20:08:50
Script start
Timing: Jan 20 2025 20:08:50
Module start 'layout'
Timing: Jan 20 2025 20:08:50
Module start 'content'
Timing: Jan 20 2025 20:08:50
Module end 'content'
Timing: Jan 20 2025 20:08:50
Script end

Main resources:

Total runtime0.0136 sec
Peak memory usage2,048.0000 KB
Database Queries3

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0048 588.0469151.2266
Module start 'layout' 0.00480.0021 739.273436.6797
Module start 'content' 0.00680.0052 775.953198.3125
Module end 'content' 0.01210.0015 874.265637.9922
Script end 0.0135  912.2578 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.002316.8516140.0002
Check MTime0.00107.4767140.0001
Mysql Total
Database connection0.00064.537310.0006
Mysqli_queries0.002015.037830.0007
Looping result0.00000.073710.0000
Template Total0.00118.410.0011
Template load0.00086.223010.0008
Template processing0.00032.158010.0003
Override
Cache load0.00064.094810.0006
General
dbfile0.00118.098380.0001
String conversion0.00000.050940.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 1
 Number of unique templates used: 1

Time used to render debug report: 0.0001 secs