This site has been archived and you can no longer log in or post new messages. For up-to-date community resources please visit ezplatform.com

eZ Community » Forums » Install & configuration » Again fetch functions in templates
expandshrink

Again fetch functions in templates

Again fetch functions in templates

Sunday 12 January 2003 12:53:46 pm - 4 replies

Why "list" or "tree" functions only return folders?

I have a site structure like this

Main Node
--Folder 1 (class_id=21; contentclass_id or class_type=1)
----Article1 (class_id=33; contentclass_id=2)
----Article2 (class_id=34; contentclass_id=2)
----Folder 1.1 (class_id= 35; contentclass_id=1)
----Folder 1.2 (class_id=36; contentclass_id=1)

If I try:
{let mylist=fetch(content, list, hash(parent_node_id, 21, sort_by, array(published,false())))}
{section name=mysection loop=$mylist}
...
{/section}
{/let}

I only receive two items: Folder 1.1 and Folder 1.2.
It should return four items, two articles and two folders.

Well, I will use a filter:
{let mylist=fetch(content, list, hash(parent_node_id, 21, sort_by, array(published,false()),class_filter_type, include, class_filter_array, array(2)))}

And I receive nothing ????

If I use any combination of filter (include, exclude, etc) I receive nothing.

How can I receive a list of only article objects in my Folder 1 using the template function "fetch"?

Thanks in advance
Adolfo Barragán

Sunday 12 January 2003 11:55:05 pm

> > Why "list" or "tree" functions only return folders?
> >
> > I have a site structure like this
> >
> > Main Node
> > --Folder 1 (class_id=21; contentclass_id or
> class_type=1)
> > ----Article1 (class_id=33; contentclass_id=2)
> > ----Article2 (class_id=34; contentclass_id=2)
> > ----Folder 1.1 (class_id= 35; contentclass_id=1)
> > ----Folder 1.2 (class_id=36; contentclass_id=1)
> >
> > If I try:
> > {let mylist=fetch(content, list, hash(parent_node_id,
> 21,
> > sort_by, array(published,false())))}
> > {section name=mysection loop=$mylist}
> > ...
> > {/section}
> > {/let}
> >
> > I only receive two items: Folder 1.1 and Folder 1.2.
> > It should return four items, two articles and two
> folders.
> >
> > Well, I will use a filter:
> > {let mylist=fetch(content, list, hash(parent_node_id,
> 21,
> > sort_by, array(published,false()),class_filter_type,
> > include, class_filter_array, array(2)))}
> >
> > And I receive nothing ????
> >
> > If I use any combination of filter (include, exclude, etc)
> I
> > receive nothing.
> >
> > How can I receive a list of only article objects in my
> > Folder 1 using the template function "fetch"?
> >
> > Thanks in advance
> > Adolfo Barragán
>
> Are the class ids that you are listing about class ids or
> node ids?
> If you can a content object you can get the node_id (aka
> mainNodeID) by
> $ob.main_node_id (if I remeber or it is $ob.node_id) if
> both are wrong I will look it up in my code to remember.
> In my code I am constantly getting confused between ob.id
> and node.id
> I usually check by temporary inserting Nodeid:{$node.id}**
> (it could be $node.node_id -- if I am
> it will print Nodeid:**.
>
> I check this agaist what eZPublish gives me:
> site/content/view/nodeid
>
> I hope this give you a clue or two,
> Michael
> (ps sorry for spelling and not being exact, but I am very
> tired and in crunch mode to release our site with eZPub
> 3..hopefully today.)

Thanks Michael for all your insights. Please post the URL of the site when it is up.

Monday 13 January 2003 12:39:57 am

Thanks for the post Michael... Its $node.node_id. I have been looking for this as I had not been able to find a list of items in the Documentation yet, so it really helped out.

A few variables I have so far:
site.meta.author, site.title, module_result.uri

I think the documentation will list these when it is released. But these where the ones i got from index.php.

Monday 13 January 2003 11:50:08 am

> Why "list" or "tree" functions only return folders?
>
> I have a site structure like this
>
> Main Node
> --Folder 1 (class_id=21; contentclass_id or class_type=1)
> ----Article1 (class_id=33; contentclass_id=2)
> ----Article2 (class_id=34; contentclass_id=2)
> ----Folder 1.1 (class_id= 35; contentclass_id=1)
> ----Folder 1.2 (class_id=36; contentclass_id=1)
>
> If I try:
> {let mylist=fetch(content, list, hash(parent_node_id, 21,
> sort_by, array(published,false())))}
> {section name=mysection loop=$mylist}
> ...
> {/section}
> {/let}
>
> I only receive two items: Folder 1.1 and Folder 1.2.
> It should return four items, two articles and two folders.
>
> Well, I will use a filter:
> {let mylist=fetch(content, list, hash(parent_node_id, 21,
> sort_by, array(published,false()),class_filter_type,
> include, class_filter_array, array(2)))}
>
> And I receive nothing ????
>
> If I use any combination of filter (include, exclude, etc) I
> receive nothing.
>
> How can I receive a list of only article objects in my
> Folder 1 using the template function "fetch"?

Did you install the demo data? If so it might be that some policies are still active that will limit the classes an anonymous user will see.
Go to /role/list and edit the anonymous role, you'll probably see an entry for content/read with one or two classes as limitation.
Add a new entry which allows content/read/* (ie no limitation).

Monday 13 January 2003 12:35:29 pm

> ... it might be that some
> policies are still active that will limit the classes an
> anonymous user will see.

Yes, it is. I trace code and query string has a condition clause for content_class_id (or something so) IN (1,7).

> Go to /role/list and edit the anonymous role, you'll
> probably see an entry for content/read with one or two
> classes as limitation.
> Add a new entry which allows content/read/* (ie no
> limitation).

Ok, thanks. I am at work now. When I go back home I will try.

Regards
Adolfo Barragán

expandshrink

You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu

Proudly Developed with from