Forums / Developer / How to get Content out of the DB with a Datatype
Daniel Scheiner
Tuesday 03 October 2006 11:12:03 am
Hi!
I want to write a new Datatype (is there a good HowTo out there?).My problem is that I need the datatype to get some content-values and send those via a HTTP-Request to a server designated through the URL supplied to the datatype (it will be a textline-sort of datatype that is given a url).
Can anyone help me out with this? Thanks!!! =)
Damien Pobel
Tuesday 03 October 2006 11:54:40 am
Hi Daniel,
As I understand, you need to fill a form with some fields plus one field with a URL and then send them to a URL ?
It looks like to a trackback system ! You should have a look the eZTrackback extension [1]. This extension defines a workflow that sends some data (title, begin of the text, ...) to some URLs when the user writes a blog entry and click on "Send for publishing".
[1] http://ez.no/community/contribs/applications/ez_trackback
Damien Planet eZ Publish.fr : http://www.planet-ezpublish.fr Certification : http://auth.ez.no/certification/verify/372448 Publications about eZ Publish : http://pwet.fr/tags/keywords/weblog/ez_publish
Wednesday 04 October 2006 12:10:57 am
Hi Damien,
First of all: Thanks!
BUT: well, I would look at that but a) it isn't workingb) I want it a lot simpler.
So I need to know how I can write a Datatype and add a action that is executed when the datatype-variable is submitted via the "send"-button.
Ćukasz Serwatka
Wednesday 04 October 2006 12:49:01 am
Here is tutorial how to build new datatype:http://ez.no/products/ez_publish/documentation/development/extensions/datatypes/new_datatype
You can also generate one using Setup->RAD in admin interface. Of course code from RAD is just a base which you need to extend. Take a look at this topic for information how to connect to ex. database.
http://ez.no/community/forum/developer/using_external_db_in_extension_causes_problems
Personal website -> http://serwatka.net Blog (about eZ Publish) -> http://serwatka.net/blog
Paul Borgermans
Wednesday 04 October 2006 4:17:35 am
Hi
You may want to use the onPublish method for a datatype to have an action executed upon publishing. You can start with an existing datatype for your new datatype which just implements this post-publish action as the difference.
This is also the way to create simple workflows (and it is easier to debug than the ezp workflow mechanism). It's one of the little (undocumented) features which are so useful in certain situations.
hth
Paul
eZ Publish, eZ Find, Solr expert consulting and training http://twitter.com/paulborgermans
Wednesday 04 October 2006 4:51:01 am
Or a custom edit handler: check out the nice article by Lukazs:
http://serwatka.net/index.php/en/blog/ez_publish_3_8_new_custom_edit_handler
Wednesday 04 October 2006 5:36:25 am
Thanks Paul! the onPublish method for a datatype sounds neat! is there an example somewhere? And which onPublish method is the right one? eZDataType::onPublish?eZContentObjectAttribute::onPublish?
Wednesday 04 October 2006 6:14:36 am
Hi Daniel
The datatype (class attribute level)
Here is an example:
http://pubsvn.ez.no/community/trunk/extension/personlist/datatypes/sckpersonlist/
But the custom edit handler is more appropriate if you want to do things with existing datatypes/classes
Wednesday 04 October 2006 9:07:25 am
Thanks!!!
one small question on the side:what is "(class attribute level)" ?