Forums / General / dead end? section basic problem

dead end? section basic problem

Author Message

Bnei Baruch

Sunday 10 October 2004 12:05:44 pm

OK this time probably we located the hourses way too far before the carriage
we have few websites that intreduces our matirials to verious different kind of people. for example scientists, kids, students and so on.
since all those sites are actualy built on the same content and what differentiates one from each other is the tree sturcture and order and the design we publish the articles.
example:
a good example is a line of products. lets say we would sell cars and would like to publish the cars all around the world. with consideration of the cultural differences. so we will put on the american website the troofy car on the main page , and on the japanees country the sports car.
we wouldn't like to duplicate all this data for each website so we came up with an idea that actualy now discovered as a wrong aproach according to ez basics.
we came up with a folder named library . under this folder we created all the articles that will be used ever on each one of the websites.
for each site we created a different folder and created a siteaccess for this folder
inorder to publish the articles needed for each website we went on the admin pannel and added locations for each article to the needed locations on the various folders.
so we will have the same entry point for the articles published all over the folder(sites). once an article has been edited on the library folder , all the sites will be updated.
THE PROBLEM:
each ez object can have only one section. the main location of an object stores the section number of the folder that the object was created at.
each website design is defined by the object section. so we got to a point that we can't declare which design to genarate for an article since the section we get is from the original folder (main location) where the article was published at the beginning.
NOTICE: the same article is published on more then one site, few instances , so changing the main location for the article is an imposible option for me.

Please help
hope i explain it clear
ask if i didn't

Lior

Paul Borgermans

Sunday 10 October 2004 1:29:09 pm

Hi Lior,

I understand your problem quite clearly and it has been discussed in the past here. To me it is still .. ahum ... a design flaw in ez publish. The current implementation of the additional locations and the (non)inheritance of sections makes it behave just as a link, nothing more.

Now, I'm pretty sure you can work around this in the templates, but it is not straight forward. Since you delved arleady quite deep into ezpublish, this is what I would do if you followed the traditional approach to have folders as containers for children (it is actuallay an approach which will be included in the next update of the ez book):

<i>make an override template for your folder which fetches your children as usual, but instead of using the url_alias to create the links to your "full object view", create a link to your main folder with additional url arguments on what to display</i>

For example, Say your library node and additional locations is as follows with your effective siteaccess as other main trees in your site:

<library>    <siteaccess a>    <siteaccess b>

<item1>      <item1>          <item2>
<item2>      <item3>          <item3>
<item3>                       <item4>
<item4>

The re-appearance of items under siteaccess1 and siteaccess2 mean their alternate locations. For simplicity, assume these items are all articles of the same class.

Now, for siteaccess1 you can create a full view template for the article class called for example article_view_full_a.tpl. The trick is now to assign this to a "custom" view mode, say "full_a" in your override.ini tied to the siteaccess a. Note that you are not limited to traditional line/view/embed views in ezp :-) Similar for siteaccess2, where you create another alternative full view to your article class.

Now for your folder view templates in the various siteaccesses, create overrides that will take into account the above.

It should be something like this (the simpliest for clarity, but it is the principle that counts):

{*override for a folder view mode full*}
{section show=$view_parameters.show}
   {* we are called with the request for a full view *}
   {let thisnode=fetch(content,node,hash(node_id,$view_parameters.show)}
   {node_view_gui viewmode="full_a" content_node=$thisnode}
   {/let}
{section-else}
   {* we need to display a list of children *}
   {let children=fetch(content,list,hash(parent_node_id,$node.node_id))}
   <ul>
   {section loop=$children var=child}
   <li><a href=concat($node.url_alias,'/(show)/',$child.node_id)|ezurl}>{$child.name}</a></li>
   {/section}
   </ul>
{/section}

hth

-paul

eZ Publish, eZ Find, Solr expert consulting and training
http://twitter.com/paulborgermans

Paul Borgermans

Sunday 10 October 2004 1:33:18 pm

If our siteaccesses are well separated, you can of course still use the "full" view mode, but simply redefined in each siteaccess design/override folders. The pagelayouts like this will be as intended too (coupled to your siteaccess)

hth

-paul

eZ Publish, eZ Find, Solr expert consulting and training
http://twitter.com/paulborgermans

Rami Grossman

Monday 11 October 2004 12:49:12 am

Hi Paul,
Thanks for the reply.
I work with Lior.
The problem is not only how to view the article itself but we use the secsion of each object to show different design for each object. for example we have objects that will be shown under the section "University" and others unders "free lessons". Its very natural to override the pagelayout for each section with its own design. But with the limitation that eZ has with the multi sections for each object according to its locations we can't use this feature.
We can work around it maybe if we put a piece of the code intended to be in the pagelayout in the object override tpl and use like you said different views for each design section, but its like walking on the hands and this way we don't use the most powerful feature of eZ.

Are there any other sujestions?

Rami

Lior Solomon

Wednesday 13 October 2004 7:48:39 am

Thank you Paul for the reply
what would you think about this solution:
since i dont want to complicate the process for the editor, cause once i will use your solution publishing links on any article will ask for knowing which parameters to pass and so on. i came up with this idea tell me what you think:
create a module or actualy an ez function(i'm sure that is posible) that i will pass the object id to this function and it will use the db to discover what is the section of the parent folder. since parent folders will always have the real section then i can tell by that to which section the article belongs.
and then i dont need to change any of the url structure.
what do you think?
is it posible to create a builtin function in ez?
so tpl will use it?