Author
|
Message
|
Selmah Maxim
|
Wednesday 01 June 2005 10:05:14 am
Hi ... I have News class, and there is "Object relation" to select to company where this news related, now I need to list news by this "Object relation".... another way around ... if ($companynew=="ez publish") ... or if($companyid=="112") ... how ?! Thanks in advance.
|
Selmah Maxim
|
Wednesday 01 June 2005 11:33:19 am
is this sql bug ?! the template :
{section loop=fetch( 'content', 'list',hash( 'parent_node_id', $DiscountsFolder, depth,0, class_filter_type, "include", class_filter_array,
array($DiscountsClass),
attribute_filter, array('and', array('223', '=' , 'My Company')),
sort_by, array(published,false()) ))}
the sql debug :
SELECT ezcontentobject.*,
ezcontentobject_tree.*,
ezcontentclass.name as class_name,
ezcontentclass.identifier as class_identifier
, ezcontentobject_name.name as name, ezcontentobject_name.real_translation
FROM
ezcontentobject_tree,
ezcontentobject,ezcontentclass
, ezcontentobject_name
, ezcontentobject_attribute a1
WHERE
path_string like '/1/2/81/%' and
a1.contentobject_id = ezcontentobject.id AND
a1.contentclassattribute_id = 223 AND
a1.version = ezcontentobject_name.content_version AND
a1.language_code = ezcontentobject_name.real_translation AND
( a1.sort_key_int = 'Al Mardoud' ) AND
ezcontentclass.version=0 AND
node_id != 81 AND
ezcontentobject_tree.contentobject_id = ezcontentobject.id AND
ezcontentclass.id = ezcontentobject.contentclass_id AND
ezcontentobject.contentclass_id IN ( 19 ) AND
ezcontentobject_tree.contentobject_id = ezcontentobject_name.contentobject_id and
ezcontentobject_tree.contentobject_version = ezcontentobject_name.content_version and
ezcontentobject_name.content_translation = 'eng-GB'
AND ezcontentobject_tree.is_invisible = 0
AND ((ezcontentobject.section_id in (1)))
ORDER BY ezcontentobject.published DESC
<b>a1.sort_key_int = 'My Company'</b> where is <i>a1.sort_key_int</i> in the sql refrence. ... its unknown !?
|
Selmah Maxim
|
Friday 03 June 2005 2:56:14 am
ANY HELP PLEASE ... any way to do this or not yet supoorted ?!
|
Xavier Dutoit
|
Friday 03 June 2005 3:16:36 am
Well, if you want to list all the news "related" to a company, fetch the company name and:
{* Reverse relation *}
{let reverse_related=$node.object.current.reverse_related_object_list}
<ul>
{section name=ReverseObject loop=$reverse_related show=$reverse_related}
<li><a href={$ReverseObject:item.main_node.url_alias|ezurl}>{$ReverseObject:item.name}</a></li>
{/section}
It doesn't work for ez < 5.6 (I think). FYI, this extension has been written specificaly to deal with a need like yours: http://www.ez.no/community/contribs/datatypes/enhanced_objectrelation
http://www.sydesy.com
|
Felix Laate
|
Friday 03 June 2005 3:17:20 am
Hi Selmah! I think you can do a fetch of all news with a:
attribute_filter, array( array( 'article/companyid', '=', '112' ) ) ) )
Felix
Publlic Relations Manager
Greater Stavanger
www.greaterstavanger.com
|
kracker (the)
|
Friday 03 June 2005 3:17:57 am
I don't really understand just what your trying to do. It would help if you were to at the very least, write a brief paragraph explaining what your trying to do / accomplish / goals. Even though I don't know what your trying to do exactly. Here are a few templates I have created (don't laugh :), which I include in the pagelayout.tpl (main layout). These eZ publish templates are license solely under the GNU GPL (v2 or later). <b>Example #1 : related_links.tpl</b> This file will display related objects of the type 'link' only. {*
Related Links : Lets get our data sets
License : GNU GPL (v2 or later).
Author: kracker
*}
{let root_node=fetch( content, node, hash( node_id, $module_result.node_id ) )
related_objects=$root_node.object.related_contentobject_array
) ) }
{* If we got data, display the items *}
{section show=$related_objects}
<div id="whatsrelated">
<span class="headerw">{"Related Links"|shorten(30)}</span>
</div>
<div class="sectmain">
{section var=mini loop=$related_objects}
{* We only want to display articles in this related link list *}
{section show=eq( $mini.main_node.class_name, 'Article' ) )}
{* section-include match=$mini.main_node.class_name|eq(file) *}
<a href={$mini.main_node.url_alias|ezroot} class="mainb">{$mini.name|shorten( 25 )}</a>
{/section}
{/section}
</div>
{/section}
{/let}
<b>Example #2 : related_files.tpl</b> Here is another related object template. {* Related Files : Lets get our data sets
License : GNU GPL (v2 or later).
Author: kracker
*}
{let root_node=fetch( content, node, hash( node_id, $module_result.node_id ) )
related_objects=$root_node.object.related_contentobject_array
) ) }
{* If we got data, display the items *}
{section show=$related_objects}
<div id="whatsrelated">
<span class="headerw">{"Related Files"|shorten(30)}</span>
</div>
<div class="sectmain">
{section var=mini loop=$related_objects}
{* We only want to display articles in this related files list *}
{section show=eq( $mini.main_node.class_name, 'File' ) )}
{* section-include match=$mini.main_node.class_name|eq(file) *}
<a href={$mini.main_node.url_alias|ezroot} class="mainb">{$mini.name|shorten( 25 )}</a>
{/section}
{/section}
</div>
{/section}
{/let}
//kracker <i>Korn : Freak on a Leash</i> <i>These templates are licensed under the GNU GPL, as such you may</i> <b>not</b> <i>use these templates in anyway under the eZPL. The eZPL is a </i> <b>non-free</b> <i>license of eZ publish. Re: http://www.ez.no/ez_publish/licenses</i>
Member since: 2001.07.13 || http://ezpedia.se7enx.com/
|
Selmah Maxim
|
Friday 03 June 2005 3:48:57 am
Hmm ... reading my post realy is ^@#$^@!# :) again i`ll try to explain it ...
Folder name : News
Stands from :
- This Related to company --> (Object relation)
- title (xml) - News (xml) thats all ... in the News folder there is over 100 news about diffrent companies, now i wanna list just the news witch is related to campnay called (ez Systems) ... how can i do this without request the whole news and refiltered again ?! Thanks in advance.
|
Selmah Maxim
|
Friday 03 June 2005 5:15:55 am
Maybe i have DB error .. in sql debug i get this :
Query error: Unknown column 'contentclassattribute_id' in 'where clause'. Query: SELECT DISTINCT ezcontentobject.*
FROM
ezcontentobject, ezcontentobject_link
WHERE
ezcontentobject.id=ezcontentobject_link.from_contentobject_id AND
ezcontentobject.status=1 AND
ezcontentobject_link.to_contentobject_id=64 AND
ezcontentobject_link.from_contentobject_version=ezcontentobject.current_version AND
contentclassattribute_id=0
|
Xavier Dutoit
|
Friday 03 June 2005 9:28:34 am
Hi, What are you using ? the enhanced object relation ? anyway, it looks like a field is missing:
alter table ezcontentobject_link add contentclassattribute_id int(11) NULL default null;
X+
http://www.sydesy.com
|
Selmah Maxim
|
Friday 03 June 2005 11:00:57 am
Nop .. I don`t use "enhanced object relation" i got this error after this code :
{* Reverse relation *}
{let reverse_related=$node.object.current.reverse_related_object_list}
<ul>
{section name=ReverseObject loop=$reverse_related show=$reverse_related}
<li><a href={$ReverseObject:item.main_node.url_alias|ezurl}>{$ReverseObject:item.name}</a></li>
{/section}
|
Selmah Maxim
|
Sunday 05 June 2005 12:05:12 pm
"field is missing" ?!?! Is this bug ... or ?!
|
kracker (the)
|
Sunday 05 June 2005 5:22:46 pm
Selmah, I'm sorry your still having problems but I really do believe that the problem is only related to your code running on your installation. I also believe that your insistence towards talking about sql problems / sql errors is doing you a disservice. I think your template code has errors in it your fetch is querying details that do not match your actual database content. It would be a big help to us trying to help you if you would be more descriptive on <i>exactly</i> what your doing and what is happening. Details like ... 1. Information about the current node like : node.id, parent.node_id 2. Number of related objects for the current node, which you must have assigned to the current node via the admin. (this is not a dynamic relation ship) I think you are hoping this is dynamic object relationship instead of static. See, I made the same mistake for the first hour or so of trying to use this functionality / features. but ... you must manually assign a object relationship between each node using the admin. give it a try, bring back more details please. ./kracker <i>Wizzards of OS 3 : Eben Moglen</i>
Member since: 2001.07.13 || http://ezpedia.se7enx.com/
|
Xavier Dutoit
|
Monday 06 June 2005 1:26:17 am
Hi all, The error message Maxim report (missing attribute at the sql) looks like a real error you can get. The relation table has been modified (and the new attribute has been added) somewhere between 3.5.x and 3.6). If you've created the base with a 3.5.x version and updated the php to 3.6 without updating the sql structure, that might explain the problem. Kracker, you don't have to "manually assign a object relationship between each node using the admin", let me shamelessly promote this attribute that does it with an easier to use (it allows for instance to assign several nodes in one click): http://www.ez.no/community/contribs/datatypes/enhanced_objectrelation X+
http://www.sydesy.com
|