Forums / Install & configuration / Again fetch functions in templates

Again fetch functions in templates

Author Message

Adolfo Barragán

Sunday 12 January 2003 3:53:46 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"?

Thanks in advance
Adolfo Barragán

Bruce Morrison

Sunday 12 January 2003 2: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.

My Blog: http://www.stuffandcontent.com/
Follow me on twitter: http://twitter.com/brucemorrison
Consolidated eZ Publish Feed : http://friendfeed.com/rooms/ez-publish

Tony Wood

Sunday 12 January 2003 3:39:57 pm

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.

Tony Wood : twitter.com/tonywood
Vision with Technology
Experts in eZ Publish consulting & development

Power to the Editor!

Free eZ Training : http://www.VisionWT.com/training
eZ Future Podcast : http://www.VisionWT.com/eZ-Future

Jan Borsodi

Monday 13 January 2003 2: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).

--
Amos

Documentation: http://ez.no/ez_publish/documentation
FAQ: http://ez.no/ez_publish/documentation/faq

Adolfo Barragán

Monday 13 January 2003 3:35:29 am

> ... 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