Using linked objects

Author Message

Robert Munteanu

Thursday 25 November 2004 8:11:11 am

Hi there,

This is my first post on the forum, after exploring eZ publish quite a bit and finding it excellent :)

My question is the following: I am developing a CRM-ish application of which Companies and Contacts are an important part. I developed my own classes and I want to achieve the following result:

1. When I view the company page to be able to add a new contact by pressing a "add" button, giving me the new contact form with the contact's parent company set as the one I was viewing.

2. When I view the company page for a company who already has contacts to be able to see the existing contacts listed.

Thank you,

Robert

Eirik Alfstad Johansen

Thursday 25 November 2004 11:14:04 am

Hi Robert,

This can all be accomplished using basic eZP template language. For #1, you paste the following into the full view template of the contacts page:

<form method="post" action={"/content/action"|ezurl}>
<input type="hidden" name="NodeID" value="{$node.node_id}" />
<input type="hidden" name="ClassID" value="[ClassIdofContactsClass]">
<input class="button" type="submit" name="NewButton" value="Add contact" />
</form>

For #2, you use a basic fetch to get the contacts:

{let contacts=fetch(content, list, hash($node.node_id, class_filter_type, include, class_filter_array, array(contacts_class_identificator)))}
{section loop=$contacts}
{$:item.name}
{/section}
{/let}

Remember that you can learn a lot by searching the forums, and studying the documentation, as well as code that comes with eZP.

Good luck !

Sincerely,

Eirik Alfstad Johansen
http://www.netmaking.no/

Robert Munteanu

Friday 26 November 2004 12:40:41 am

That easy? Well, thank you for quick solution :)

Robert Munteanu

Friday 26 November 2004 12:42:51 am

That was easy ... thank you for your quick reply :)

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