Forums / General / A niave designer question on embed related objects

A niave designer question on embed related objects

Author Message

Alan Sparkes

Saturday 18 October 2003 3:12:24 pm

I want a three column design.
Left column menu
Centre column content
right column related content

So afr I have acheived,
Customised pagelayout = yes, success in overriding standard
Left menu expndable=yes, borrowed from round here somewhere
right column - help required!

I want the contents of one folder, eg 'CARs' to be related to the contents of another folder. So when i view the node 'CARs' in the centre column i can view the related folder content in the right column [not all the related content but select drop down or first 5 content objects]

I understand from reading this has to do with placing an embed_class_x.tpl file in the override/templates/content/view directory, where x is the related object class id [is this right]
Ok so I do that but how on earth do i get the right column of my page layout to show the related content for a given piece of content?

The help i have read seems to assume to much knowledge to complete the process [not uncommon round here - this is intimidating for a newbie wrestling with EZ].

What needs to happen next to acheive this holy grail?

all answers will receive best newbie kiss or miniature Elvis

alans

Paul Borgermans

Sunday 19 October 2003 3:02:28 am

As I understand it, you have a related object pointing to a folder? If so, just grab the node id and do a fetch of this folder with a limit set to 5. You can then display the items in a column on the right.

hth

-paul

eZ Publish, eZ Find, Solr expert consulting and training
http://twitter.com/paulborgermans

Alan Sparkes

Sunday 19 October 2003 5:16:04 am

Thanks for the reply. I appreciate it.

However, i don't think this is enough information to complete the task.

1. The code to acheive this is documented I suspect - ok i'll read and experiment - I am not asking to be completely spoon fed!
2. Once I have the template code does inserting it into embed_class_x.tpl and placing this in the correct override dir automatically produce the desired result?
3. What else is there to do to complete the task?

Like I said previously, "The help i have read seems to assume to much knowledge to complete the process .."

many thanks for persevering with me!

alans

Paul Borgermans

Sunday 19 October 2003 7:04:16 am

1. Yes and no: it is scattered a bit in the docs section.

Your point of depature is the $node structure, do an

{$node|attribute(show)} to find the related object array.
Then use the nodeid of the related object to do a fetch (see template docs).

You can use that to display each item in the view template of your object class.

2. So not the embed_class_x.tpl file, this is used to embed objects in xml text fields. Use the view template of your folder class.

3. If you complete 1 and 2, there is nothing more to be done (except clearing caches)

To start with ez publish, it's a bit difficult. But the docs are getting better and you will appriciate the way ez publish works more and more (not that it is perfect though)

-paul

eZ Publish, eZ Find, Solr expert consulting and training
http://twitter.com/paulborgermans

James Ward

Sunday 19 October 2003 8:05:10 am

Hi Alan,
I actually did something similar for articles on my web design. In your case you want to relate folders. Your solution will be a little different but basically the same idea. If you want to do folders, override your full folder view with your own folder.tpl (you may have done that already) and add the following code to your folder.tpl wherever you want your list to appear i.e. right column:

{*Related Objects List*}
{let enableendtag=0 name=Rel}
{section show=count($node.object.related_contentobject_array)|gt(0)}
{section loop=$node.object.related_contentobject_array}
{section-exclude match=$:item.contentclass_id|eq(5)}
{switch match=$:index}
{case match=0}
{* if starttag *}
{set enableendtag=1}
<table width="150" border=0 cellpadding=3 cellspacing=0 class="related-information-table">
<tr>
<td align="center">Related Information<td>
</tr>
<tr>
<td><ul>
<li><a class="related-information-link" href={concat("/content/view/full/",$:item.main_node.node_id)|ezurl}>{$:item.name}</a></li>
{/case}
{case}
<li><a class="related-information-link" href={concat("/content/view/full/",$:item.main_node.node_id)|ezurl}>{$:item.name}</a></li>
{/case}
{/switch}
{/section}
{section show=$:enableendtag}
</ul></td>
</tr>
</table>
{/section}
{/section}
{/let}
{*End Related Information Link*}

The line {section-exclude match=$:item.contentclass_id|eq(5)} ensures that any related images are not included in your related items list. This was particualrily important for relating articles since most articles contain related images but it will likely be a non-issue for folders.

Hope this helps.

working at www.wardnet.com
blogging at www.jamesward.ca

eZ debug

Timing: Jan 18 2025 11:21:13
Script start
Timing: Jan 18 2025 11:21:13
Module start 'content'
Timing: Jan 18 2025 11:21:14
Module end 'content'
Timing: Jan 18 2025 11:21:14
Script end

Main resources:

Total runtime0.8175 sec
Peak memory usage4,096.0000 KB
Database Queries202

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0063 587.8359180.8203
Module start 'content' 0.00630.6630 768.6563624.2266
Module end 'content' 0.66930.1481 1,392.8828341.3750
Script end 0.8175  1,734.2578 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00480.5911210.0002
Check MTime0.00150.1822210.0001
Mysql Total
Database connection0.00070.087110.0007
Mysqli_queries0.723588.49582020.0036
Looping result0.00250.30062000.0000
Template Total0.784696.020.3923
Template load0.00270.327120.0013
Template processing0.781995.643120.3910
Template load and register function0.00020.023510.0002
states
state_id_array0.00120.144110.0012
state_identifier_array0.00160.193820.0008
Override
Cache load0.00240.2913790.0000
Sytem overhead
Fetch class attribute can translate value0.00150.182240.0004
Fetch class attribute name0.00150.180370.0002
XML
Image XML parsing0.00150.184240.0004
class_abstraction
Instantiating content class attribute0.00000.002780.0000
General
dbfile0.00320.3923340.0001
String conversion0.00000.000730.0000
Note: percentages do not add up to 100% because some accumulators overlap

CSS/JS files loaded with "ezjscPacker" during request:

CacheTypePacklevelSourceFiles
CSS0extension/community/design/community/stylesheets/ext/jquery.autocomplete.css
extension/community_design/design/suncana/stylesheets/scrollbars.css
extension/community_design/design/suncana/stylesheets/tabs.css
extension/community_design/design/suncana/stylesheets/roadmap.css
extension/community_design/design/suncana/stylesheets/content.css
extension/community_design/design/suncana/stylesheets/star-rating.css
extension/community_design/design/suncana/stylesheets/syntax_and_custom_tags.css
extension/community_design/design/suncana/stylesheets/buttons.css
extension/community_design/design/suncana/stylesheets/tweetbox.css
extension/community_design/design/suncana/stylesheets/jquery.fancybox-1.3.4.css
extension/bcsmoothgallery/design/standard/stylesheets/magnific-popup.css
extension/sevenx/design/simple/stylesheets/star_rating.css
extension/sevenx/design/simple/stylesheets/libs/fontawesome/css/all.min.css
extension/sevenx/design/simple/stylesheets/main.v02.css
extension/sevenx/design/simple/stylesheets/main.v02.res.css
JS0extension/ezjscore/design/standard/lib/yui/3.17.2/build/yui/yui-min.js
extension/ezjscore/design/standard/javascript/jquery-3.7.0.min.js
extension/community_design/design/suncana/javascript/jquery.ui.core.min.js
extension/community_design/design/suncana/javascript/jquery.ui.widget.min.js
extension/community_design/design/suncana/javascript/jquery.easing.1.3.js
extension/community_design/design/suncana/javascript/jquery.ui.tabs.js
extension/community_design/design/suncana/javascript/jquery.hoverIntent.min.js
extension/community_design/design/suncana/javascript/jquery.popmenu.js
extension/community_design/design/suncana/javascript/jScrollPane.js
extension/community_design/design/suncana/javascript/jquery.mousewheel.js
extension/community_design/design/suncana/javascript/jquery.cycle.all.js
extension/sevenx/design/simple/javascript/jquery.scrollTo.js
extension/community_design/design/suncana/javascript/jquery.cookie.js
extension/community_design/design/suncana/javascript/ezstarrating_jquery.js
extension/community_design/design/suncana/javascript/jquery.initboxes.js
extension/community_design/design/suncana/javascript/app.js
extension/community_design/design/suncana/javascript/twitterwidget.js
extension/community_design/design/suncana/javascript/community.js
extension/community_design/design/suncana/javascript/roadmap.js
extension/community_design/design/suncana/javascript/ez.js
extension/community_design/design/suncana/javascript/ezshareevents.js
extension/sevenx/design/simple/javascript/main.js

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
5content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
7content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
10content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
3content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/pagelayout.tplEdit templateOverride template
 Number of times templates used: 27
 Number of unique templates used: 6

Time used to render debug report: 0.0001 secs