ONE fetch for Several Folders

Author Message

Leandro Alves

Tuesday 29 June 2004 9:02:08 am

Hi!

I am trying to use one fetch for several folders, but I have a problem!

I have this structure:

Root Folder (node_id = 2)
|_Sales
...|_News (node_id = 10)
......|article 1
......|article 2
...|_Documents
......|article X
|_Account
...|_News (node_id = 20)
......|article 3
......|text 1

I want to fetch all articles that are only in both folders "News" (Node 10 and 20)..

<b>I don't want any of others articles...</b>

I tried with the <i>search operator</i> with this code, but it didn't resolve my problem:

{let search=fetch(content,search,hash(text,'article',subtree_array, array(10,20)))}

{section var=SearchResult loop=$search['SearchResult']}
<a href={$SearchResult.item.url_alias|ezurl}>{$SearchResult.item.name|wash}</a>
{attribute_view_gui attribute=$SearchResult.object.data_map.intro}
{/section}

{/let}

<b>Problem</b>

1. The parameter text in search operator is required, so What can I do to fetch <b>ALL articles</b> in both folders??
In this case the fetch only catch the article with the "article" word, but not all. The fetch didn't catch the article "text 1" in "Account/News"...

For test I changed my site.ini.append allowing empty searches but it didn't work with the fetch operator too...

[SearchSettings]
AllowEmptySearch=enabled

I tried several forms in "(text,'article')"...
One of its:
{let search=fetch(content,search,hash(text,'', subtree_array, array( 10, 20 )))}

But nothing worked...

I prefer don't allow empty searches, It was only a test...

What can I do in this case?

<b>There is other form to fetch all articles in the specific folders?</b>

Thanks a lot!
Leandro

Mark Gilbert

Thursday 01 July 2004 5:44:21 am

One solution is to create a "News" Class. When you add news to your sight always use the News Class. Then you can do a fetch based on the root - node id of 2 fetching only the "News" class you created. Creating the "News" class would be easy. Just copy the "Article" class and name it "News".

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.