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

eZ debug

Timing: Jan 30 2025 00:49:41
Script start
Timing: Jan 30 2025 00:49:41
Module start 'content'
Timing: Jan 30 2025 00:49:41
Module end 'content'
Timing: Jan 30 2025 00:49:41
Script end

Main resources:

Total runtime0.0124 sec
Peak memory usage2,048.0000 KB
Database Queries4

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0060 588.2578180.8203
Module start 'content' 0.00600.0036 769.0781101.9297
Module end 'content' 0.00960.0028 871.007878.7031
Script end 0.0124  949.7109 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.002217.5310120.0002
Check MTime0.00107.9485120.0001
Mysql Total
Database connection0.00086.506710.0008
Mysqli_queries0.002116.772640.0005
Looping result0.00000.097920.0000
Template Total0.002620.910.0026
Template load0.00075.773310.0007
Template processing0.001915.083010.0019
Override
Cache load0.00053.897510.0005
General
dbfile0.00032.2098100.0000
String conversion0.00000.046130.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/pagelayout.tplEdit templateOverride template
 Number of times templates used: 1
 Number of unique templates used: 1

Time used to render debug report: 0.0001 secs