Intelligent Node Duplication or Saved Search?

Author Message

Russell Michell

Tuesday 10 June 2008 3:05:11 pm

Hi there helpful folks of the eZ community!

In our current and soon to be past CMS, there is actually a very useful feature called "Smart Folders" (Now "Collections") which I'd like to be able to achieve in eZ Publish 4.0 if possible.

A "Smart Folder" is basically a "Saved Search" encapsulated as a single content-object and created from within the admin interface of the CMS:

1). Create a "Smart Folder" object in a specific location, say "/News/Tech"
2). Add some search criteria to it:
2a). Get all "Article" objects,
2b). Located in "/Products" and "/Solutions",
2c). With a title that contains the string "technology"
3). Save.

When viewing the Smart Folder in this case, it would act just like a folder of Article-objects for example, except each Article might be physically located in "/Products" or "/Solutions" and had a title with "technology...whatever" in it.

This basically means that you needn't put all your "news" Article content in one place, it could be located anywhere. Only using a Smart Folder they would appear as though they had become collated in one place, similar to eZ's node duplication but with some "intelligence"

Does this type of content-object exist natively in eZ or is it something that's perhaps an extension or even able to be built from scratch within the eZ Components framework? If so, is anyone able to point me in the right direction?

Many thanks for reading :-)

Russell Michell, Wellington, New Zealand.
We're building! http://www.theruss.com/blog/
I'm on Twitter: http://twitter.com/therussdotcom

Believe nothing, consider everything.

Felix Laate

Tuesday 17 June 2008 11:57:28 pm

Hi Russ,

you can create a class with the attributes:

Title (textline)
Contentclasses (multiselect)
Locations (objectrelationlist)

Add the classes and the class_id you whant to be selectable to the multiselect.

When you create objects of this class, you will provide which classes to include, where to fetch nodes from and the title of this object.

Then, in your template, you create a fetch that fetches nodes of the specified class(es) at the specified locations.

The you should have your Einstein-folders :-)

Felix

Publlic Relations Manager
Greater Stavanger
www.greaterstavanger.com

Russell Michell

Sunday 22 June 2008 4:34:31 pm

Hi Felix and thanks for your input.

I got as far as creating the new content class you described. However the "objectrelationlist" datataype wasn't obvious from the "add attribute" drop-down list. I had to look in the HTML source to see that "Object Relations" (plural) in the list, was actually the "objectrelationlist" datatype - perhaps it needs to be re-labelled in that drop-down menu.

You described the process pretty well but I actually got stuck at "Then, in your template, you create a fetch that fetches nodes of the specified class(es) at the specified locations."

Which template is this? What's a "Fetch"? Do I need to create a new "blah.tpl" template and hand-code some template logic each time a new "Einstein Folder" ;-) is created?

The idea behind the Smart Folder was so that once a Smart Folder content-type was created by an admin, it was just as easy for any eZ user to create a "Folder" or an "Article" content-type, as it was to create a "Smart Folder" content-type and configure it to "collect" articles, folders etc from different parts of the folder hierarchy as I described. Once published, and viewed, the Smart Folder would display all the collected content as a simple list (<ul>, <dl> or whatever).

Thanks a lot for your time so far Felix. My apologies if I have missed something or for just being new to eZ! :-)

Russ

Russell Michell, Wellington, New Zealand.
We're building! http://www.theruss.com/blog/
I'm on Twitter: http://twitter.com/therussdotcom

Believe nothing, consider everything.

André R.

Monday 23 June 2008 1:50:48 am

>Which template is this? What's a "Fetch"? Do I need to create a new "blah.tpl" template and >hand-code some template logic each time a new "Einstein Folder" ;-) is created?

You need to take a look at some documentation for some of the basic concepts in ezp:
http://ez.no/ezpublish/documentation/building_an_ez_publish_site/prerequisits

The thing he is talking about is custom template code to handle the search based on what been inserted into into the smart folder object. aka the content/view/full template aka override/templates/full/smart_folder.tpl. you also need a override so the template is used, but that is explained in the above doc page.

I have actually created a thing like this for a customer, we called it virtual folders, but its's the same concept. Beside the stuff mentioned above I also created a custom edit template so some ajax and custom drop downs where used for class / class attribute filtering (for the search).

search:
http://ez.no/doc/ez_publish/technical_manual/4_0/reference/modules/content/fetch_functions/search

Node fetch:
http://ez.no/doc/ez_publish/technical_manual/4_0/reference/modules/content/fetch_functions/list
http://ez.no/doc/ez_publish/technical_manual/4_0/reference/modules/content/fetch_functions/tree

eZ Online Editor 5: http://projects.ez.no/ezoe || eZJSCore (Ajax): http://projects.ez.no/ezjscore || eZ Publish EE http://ez.no/eZPublish/eZ-Publish-Enterprise-Subscription
@: http://twitter.com/andrerom

Russell Michell

Thursday 26 June 2008 9:16:43 pm

Excellent!

Thank-you Andre :-)

After a day or two following that tutorial and a day creating template code for my Smart Folder, it works just as I intended.

I really appreciate your help..

Cheers!
Russ

Russell Michell, Wellington, New Zealand.
We're building! http://www.theruss.com/blog/
I'm on Twitter: http://twitter.com/therussdotcom

Believe nothing, consider everything.

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