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.

eZ debug

Timing: Jan 18 2025 22:39:31
Script start
Timing: Jan 18 2025 22:39:31
Module start 'layout'
Timing: Jan 18 2025 22:39:31
Module start 'content'
Timing: Jan 18 2025 22:39:32
Module end 'content'
Timing: Jan 18 2025 22:39:32
Script end

Main resources:

Total runtime0.8728 sec
Peak memory usage4,096.0000 KB
Database Queries60

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0053 588.9453152.6094
Module start 'layout' 0.00530.0051 741.554739.4141
Module start 'content' 0.01040.8609 780.9688541.2891
Module end 'content' 0.87130.0015 1,322.257812.1875
Script end 0.8728  1,334.4453 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00330.3821160.0002
Check MTime0.00130.1471160.0001
Mysql Total
Database connection0.00080.092410.0008
Mysqli_queries0.820694.0238600.0137
Looping result0.00060.0672580.0000
Template Total0.839596.220.4197
Template load0.00240.279120.0012
Template processing0.837095.898720.4185
Template load and register function0.00010.014410.0001
states
state_id_array0.00130.149810.0013
state_identifier_array0.00140.165220.0007
Override
Cache load0.00210.2354230.0001
Sytem overhead
Fetch class attribute can translate value0.00080.086220.0004
Fetch class attribute name0.00120.135550.0002
XML
Image XML parsing0.00060.073320.0003
class_abstraction
Instantiating content class attribute0.00000.003850.0000
General
dbfile0.00100.1089160.0001
String conversion0.00000.000940.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
4content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
6content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
1content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
2content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 15
 Number of unique templates used: 6

Time used to render debug report: 0.0001 secs