Author
|
Message
|
Carl Heaton
|
Monday 07 March 2005 3:17:42 am
if I replace 18 with:
$node.object.contentclass_id
or
$node.data_map.name.contentclass_attribute.contentclass_id
the script fails, placing 18 manually works perfectly i've double and tripple checked $node.object.contentclass_id == 18 thnx in advance :)
{$node.data_map.name.contentclass_attribute.contentclass_id}
{let topic_articles=fetch( 'content', 'list',
hash(
'parent_node_id', 58,
'depth', 1,
'class_filter_type', 'include',
'class_filter_array',array('article_general')
)
)
}
<table width="100%" border="1">
<tr>
<th>Popular Articles for {attribute_view_gui attribute=$node.data_map.name}</th>
</tr>
{section loop=$topic_articles}
{set topic_type=$node.object.contentclass_id}
class:{$topic_type}<br />
{set topic_article_relation=filter_related($:item.contentobject_id, 18, false)}
{set topic_headline=$:item.data_map.headline}
{set show_item=false}
{section loop=$topic_article_relation}
{section show=$:item.main_node_id|eq($node.main_node_id) }
{set show_item=true}
{section-else}
{section show=$show_item|eq(false)}
{set show_item=false}
{/section}
{/section}
{/section}
{section show=$show_item|eq(true)}
<tr>
<td>
<strong><u>{attribute_view_gui attribute=$topic_headline}</u></strong><br/ >
</td>
</tr>
{/section}
{/section}
</table>
---
Carl
{'EZP 3.5, Apache 2, FC2, PHP 4.3.4 (cgi), MySQL 4.1.9'}
|
Łukasz Serwatka
|
Monday 07 March 2005 3:37:18 am
Hi I suppose that you have declared var topic_type somewhere above... What is the result of?
{let topic_type=''}
{set topic_type=$node.object.contentclass_id}
{$topic_type}
{/let}
Personal website -> http://serwatka.net
Blog (about eZ Publish) -> http://serwatka.net/blog
|
Carl Heaton
|
Monday 07 March 2005 3:51:37 am
Your sample code provided works fine. My code has been updated to the following but still with the issue $topic_type not getting passed to filter_related Entire topic_articles.tpl:
{* $node.data_map.name.contentclass_attribute.contentclass_id *}
{let topic_type='' show_item=''}
{set topic_type=$node.object.contentclass_id}
{let topic_articles=fetch( 'content', 'list',
hash(
'parent_node_id', 58,
'depth', 1,
'class_filter_type', 'include',
'class_filter_array',array('article_general')
)
)
}
<table width="100%" border="1">
<tr>
<th>Popular Articles for {attribute_view_gui attribute=$node.data_map.name}</th>
</tr>
{section loop=$topic_articles}
class:{$topic_type}<br /> (* !!!NOTE!!! this outputs fine *}
{let topic_article_relation=''}
{set topic_article_relation=filter_related($:item.contentobject_id, $topic_type, false)} (* !!!NOTE!!! $topic_type doesn't seem to be passed *}
{let topic_headline=''}
{set topic_headline=$:item.data_map.headline}
{set show_item=false}
{section loop=$topic_article_relation}
{section show=$:item.main_node_id|eq($node.main_node_id) }
{set show_item=true}
{section-else}
{section show=$show_item|eq(false)}
{set show_item=false}
{/section}
{/section}
{/section}
{/let}
{/let}
{section show=$show_item|eq(true)}
<tr>
<td>
<strong><u>{attribute_view_gui attribute=$topic_headline}</u></strong><br/ >
</td>
</tr>
{/section}
{/section}
</table>
{/let}
Any further help is appreciated :)
---
Carl
{'EZP 3.5, Apache 2, FC2, PHP 4.3.4 (cgi), MySQL 4.1.9'}
|
Łukasz Serwatka
|
Monday 07 March 2005 4:03:04 am
Hi Carl,
Try with $:topic_type this looks like name space problem. http://ez.no/ez_publish/documentation/development/libraries/ez_template/basics/namespaces
Personal website -> http://serwatka.net
Blog (about eZ Publish) -> http://serwatka.net/blog
|
Carl Heaton
|
Monday 07 March 2005 4:05:22 am
Update: Code has been tidied to cleanup set/let bad nesting. Problem still persists
{* $node.data_map.name.contentclass_attribute.contentclass_id *}
{let topic_type='' show_item='' topic_article_relation='' topic_headline=''}
{set topic_type=$node.object.contentclass_id}
{let topic_articles=fetch( 'content', 'list',
hash(
'parent_node_id', 58,
'depth', 1,
'class_filter_type', 'include',
'class_filter_array',array('article_general')
)
)
}
<table width="100%" border="1">
<tr>
<th>Popular Articles for {attribute_view_gui attribute=$node.data_map.name}</th>
</tr>
{section loop=$topic_articles}
class:{$topic_type}<br />
{set topic_article_relation=filter_related($:item.contentobject_id, $topic_type, false)}
{set topic_headline=$:item.data_map.headline}
{set show_item=false}
{section loop=$topic_article_relation}
{section show=$:item.main_node_id|eq($node.main_node_id) }
{set show_item=true}
{section-else}
{section show=$show_item|eq(false)}
{set show_item=false}
{/section}
{/section}
{/section}
{section show=$show_item|eq(true)}
<tr>
<td>
<strong><u>{attribute_view_gui attribute=$topic_headline}</u></strong><br/ >
</td>
</tr>
{/section}
{/section}
</table>
{/let}
---
Carl
{'EZP 3.5, Apache 2, FC2, PHP 4.3.4 (cgi), MySQL 4.1.9'}
|
Carl Heaton
|
Monday 07 March 2005 4:10:31 am
Hey Lucasz,
{section loop=$topic_articles}
class:{$:topic_type}<br />
{set topic_article_relation=filter_related($:item.contentobject_id, $:topic_type, false)}
class:{$:topic_type} seems to output fine to the browser however the value still doesn't seem to pass to filter_related :-/ thanks again for your help thus far
---
Carl
{'EZP 3.5, Apache 2, FC2, PHP 4.3.4 (cgi), MySQL 4.1.9'}
|
Gabriel Ambuehl
|
Monday 07 March 2005 4:37:08 am
Are you using the newest filter_related version? On what version of ezP?
Visit http://triligon.org
|
Carl Heaton
|
Monday 07 March 2005 4:46:15 am
Hey Gabriel, Yep, its the one you pointed me to via irc (gate|work) and its EZP3.5 :)
---
Carl
{'EZP 3.5, Apache 2, FC2, PHP 4.3.4 (cgi), MySQL 4.1.9'}
|
Gabriel Ambuehl
|
Monday 07 March 2005 4:54:41 am
Is topic type an int or a string? You could try adding
eZDebug::writeError( "class:" $class );
on about line 95 of filterrelated.php (after
$class = $namedParameters['class'];
and activate debugging to see what gets passed to the filter. Or even better, uncomment line 104 for all params.
Visit http://triligon.org
|
Carl Heaton
|
Monday 07 March 2005 5:17:44 am
sorted :) Looks like the `18` was getting passed as a string and as such the class got unset as the following was called:
if(is_string($class)) {
$class_instance=eZContentClass::fetchByIdentifier($class);
$class=$class_instance->ID;
}
In my version i've just commented out the offending if statement. Is there someway within the templating system to convert string->int etc?
---
Carl
{'EZP 3.5, Apache 2, FC2, PHP 4.3.4 (cgi), MySQL 4.1.9'}
|
Carl Heaton
|
Monday 07 March 2005 5:18:06 am
Almost forgot to say thnx very much to you both :)
---
Carl
{'EZP 3.5, Apache 2, FC2, PHP 4.3.4 (cgi), MySQL 4.1.9'}
|
Gabriel Ambuehl
|
Monday 07 March 2005 5:31:06 am
Interesting. I thought PHP would automatically figure this out correctly...
Visit http://triligon.org
|