Author
|
Message
|
Marcin N.
|
Thursday 14 December 2006 1:43:54 pm
Hi! I try to add code to my node_list.tpl which let me skip two articles. I think that I have to change this part of "fetch":
class_filter_type, exclude,
class_filter_array, array( 'folder', 'link', 'feedback_form', 'comment'),
Now I show only articles but I have two articles which I don't want to show, myArticle1 (id:80) and myArticle2 (id:81). Please give me some tip how to change it...? thx! Marcin
|
Marcin N.
|
Friday 15 December 2006 12:22:44 am
I tried this:
class_filter_array, array( 'folder', 'link', 'feedback_form', 'comment', array( 'id', '=', '81' )),
and this
class_filter_array, array( 'folder', 'link', 'feedback_form', 'comment', array( 'node_id', '=', '81' )),
..doesn't work :( Marcin
|
Claudia Kosny
|
Friday 15 December 2006 12:29:42 am
Hi Marcin The class filter is used to filter nodes based on the class of their contentobject, so you cannot use this to filter nodes based on their node id. The attribute filter would be a better choice but unfortunately I am pretty sure that you cannot filter by the node id (feel free to prove me wrong, I haven't tried it yet). But maybe you can use the attribute filter to filter by by the names of the nodes? Here the docu for the list fetch function , have a look at the comments to see what attribute filters are possible. http://ez.no/doc/ez_publish/technical_manual/3_8/reference/modules/content/fetch_functions/list If you just want to list all the nodes (without navigation or other features that need the number of nodes), the easiest way would be to add a condition in the loop that checks the node id and just skips these two nodes. Claudia
|
Marcin N.
|
Friday 15 December 2006 2:54:56 am
Thanks for help! I put extra condition in my loop, for Article with node 81. But it desn't work.
{section name=Node loop=$node_list sequence=array(bglight,bgdark)}
{* --my extra code-- *}
{def $nn = $Node.node_id}
{if $nn|eq(81)}
Skip it
{else}
Don't skip it
{/if}
{* ---- *}
{node_view_gui view=listitem content_node=$Node:item}
{/section}
Where is the problem??
|
Claudia Kosny
|
Friday 15 December 2006 4:04:44 am
Hi Marcin
Two basic troubleshooting tips:
- Enable debug output and check there for any error messages. Mind that depending on your cache settings you might see some messages only the first time a page is loaded, so clear the cache before reloading the page. - Use the template operator attribute to inspect the content of a variable. E.g {$node|attribute('show', 2)} shows you the attributes of the variable $node with a depth of 2. This operator works on objects and arrays, but not on e.g strings. The debug output will tell you that you cannot use {def $nn = ...} in a loop unless you undef $nn again each time. So either put {def $nn= false()} before the loop and use {set $nn = ..} in the loop or use {undef $nn} at the end of each iteration. I am not very familiar with using a section for looping. It is deprecated and I hate the usage, so I always use foreach to loop through something. As far as I know, the item within a section loop is accessed by $<name of section>:item . So instead of $nn = $Node.node_id you need to use $Node:item.node_id. If this does not work, use the attribute() template operator to inspect both $Node and $Node:item. One of them should have the node_id as attribute. Claudia
|
Marcin N.
|
Friday 15 December 2006 4:37:28 am
Sorry for my basic mistakes. The template language is completly new for me. I'm reading Docs of course :) I changed my code:
{def $nn = $Node:item.node_id}
{if or(eq($nn, 80), eq($nn, 81))}
SKIP
{else}
DONT SKIP
{/if}
{undef}
It works perfect!!! :) Thanks!!
One more question: when I turn on Debug I saw a lot of errors this kind:
<b>Error: eZTemplateDesignResource::overrideArray
Custom match file: path 'datatype/ezmatrix/edit.tpl' not found in any resource. (...)</b> but my website works perfect! Strange! Marcin
|
Claudia Kosny
|
Friday 15 December 2006 5:00:36 am
Hi Marcin There is no need to be sorry, everyone has to start somewhere. I don't know where the messages about the missing templates come from - it looks like your override.ini has settings for files that do not exist on your machine, which should not happen on a fresh installation. This might cause problems if you need such a template, e.g to edit a matrix attribute. As long as you are just testing stuff, I would not worry to much, but if you intend to use this on a production server I would try to make a fresh, clean installation to get rid of these errors. Anyway, if the missing template cause a problem for you please start a new thread for this topic. Cheers Claudia
|
Kristian Hole
|
Friday 15 December 2006 9:48:59 am
Marcin, The following:
Error: eZTemplateDesignResource::overrideArray
Custom match file: path 'datatype/ezmatrix/edit.tpl' not found in any resource. (...)
Means that there is entries in override.ini(.append.php) pointing to templates that do not exist on the filesystem. In this example some rule has matchfile datatype/ezmatrix/edit.tpl, but datatype/ezmatrix/edit.tpl is not found in the system. The way to fix this, is to remove the entries from override.ini.append.php or add the template.
Kristian
http://ez.no/ez_publish/documenta...tricks/show_which_templates_are_used
http://ez.no/doc/ez_publish/techn...te_operators/miscellaneous/attribute
|