eZ Community » Forums » eZ Publish 5 Platform » Interaction between custom bundles...
expandshrink

Interaction between custom bundles and the manged content

Interaction between custom bundles and the manged content

Thursday 20 June 2013 4:20:22 pm - 8 replies

Hi,

I am beginning to develop in EZ5, I have created my bundle with its templates, controller etc. and all works fine.

My problem is how to make the dynamic content that my bundle handles with the content management. I know that I can use "ez_content:viewLocation" or viewContent, but what I would like to do is to have more flexibility and configure from the manager interface what content is displayed on the page e.g. below the data and view my bundle produces.

Is this possible ? Pointers to documentation or examples would  be greatly appreciated.

 

Thanks

Thursday 20 June 2013 4:27:41 pm

Hi Francesco

I'm not sure I understand what you want to achieve. Could you be more precise or provide an example ?

Thanks

Friday 21 June 2013 9:13:31 am

Hi Jérôme, thanks for the reply. I'll try to be clearer:

I have created a bundle, it fetches some data via SOAP and presents it to the user on a few different pages.

Now all the templates used are in my bundle Resources/views/ directory.

I have a requirement that our marketing department should be able to manage the content of a portion of each page, let's say the footer. This is so they can put there adverts, news articles etc. of their choosing.

The creation and choice of which content to show on which page should happen via the admin interface so that they are free to change the content any time they like without me having to edit templates or config files.

In short: I would like to display on top of a page dynamic content managed by my bundle's controller and, on the bottom of the same page, content managed via the admin interface.

 

Thanks

Edit:
For example, in an e-commerce site, at the checkout page the list of items in the shopping cart comes form the controller. Below it the marketing guy can decide to show an advert today, a news item next week etc.

Modified on Friday 21 June 2013 2:54:31 pm by Francesco Nardone

Friday 21 June 2013 2:37:17 pm

The reply has been removed because of violation of forum rules.

Monday 24 June 2013 12:02:17 pm

Quote from Francesco Nardone :

In short: I would like to display on top of a page dynamic content managed by my bundle's controller and, on the bottom of the same page, content managed via the admin interface.

This is perfectly possible, just use sub-requests ! You can of course use ez_content:viewLocation, but you can actually point to your very own controllers ! There you can do your SOAP requests, or even use the public API to fetch content from eZ's repository.

Have a look at Symfony documentation for this happy.gif Emoticon (you can even handle cache separately thanks to ESIs or Hincludes).

Monday 24 June 2013 10:11:53 pm

The reply has been removed because of violation of forum rules.

Thursday 27 June 2013 10:01:10 am

Quote from Jérôme Vieilledent :
Quote from Francesco Nardone :

In short: I would like to display on top of a page dynamic content managed by my bundle's controller and, on the bottom of the same page, content managed via the admin interface.

This is perfectly possible, just use sub-requests ! You can of course use ez_content:viewLocation, but you can actually point to your very own controllers ! There you can do your SOAP requests, or even use the public API to fetch content from eZ's repository.

Have a look at Symfony documentation for this happy.gif Emoticon (you can even handle cache separately thanks to ESIs or Hincludes).

 Hi Jerome and thanks again for the reply.

The problem is that ez_content:viewLocation wants a location ID: this is going to be different if I deploy the bundle on different installations and I would rather prefer not to have an internal ID in a configuration file.

My problem is that, from the admin interface, it must be possible to change which ezcontent to show on each of the pages generated by my bundle.

Ideally I would like to have a way to be able write, for example, "{% viewLocation( mybundle.checkoutPage.bottom.contentId ) %}" and have in admin an easy way to drop a content in the 'mybundle.checkoutPage.bottom' parameter.

Thursday 27 June 2013 11:21:11 am

What you ask for is typically accomplished by creating a kind of "site design" object:

- create a site-design class, and one content object

- in this class, you can f.e. use an object-relations attribute to link other contents which should make the page footer (or other similar content-related techniques)

- in the pagelayout template, you fetch the sitedesignobject, and from there advance to find out the items to display

- in the ini file you only write down the node id of sitedesign object, all the rest is done by template

- editor will manage the rest on his own

Your case is  abit different, since eZ does not have a clue about which pages exist in your custom bundles. But you can find a workaround:

- add a "show on pages" attribute to your contents, type tags, and let editor use tags which correspond to your custom bundle pages. in template, fetch content filtering by that attribute

- create some kind of content structure in eZ which maps to your custom bundles pages, and link content to that

- etc

Modified on Thursday 27 June 2013 11:21:31 am by Gaetano Giunta

Tuesday 02 July 2013 4:03:53 pm

Thank you for the reply Gaetano.

It is true that the admin interface has no way of knowing which pages my bundle generates. What I was expecting was a way to create, from the admin interface, a data structure onto which I could hang arbitrary content items or simple text parameters. This structure should then be accessible via the public API (something like "$contentItem = ezparam->get('my_bag_of_stuff.something.bottom')" where the 'my_bag_of_stuff.something.bottom' needn't correspond to a real path or a particular page/template, it's just some data in a structure.

This is my first time working with an extendable CMS and I was expecting this type of functionality (or something like it) to be available as a matter of course. Maybe I was expecting too much (I have no experience with other commercial CMS, so maybe nobody does it).

Having to fish out internal IDs and write them to config files seems very awkward to me.

Anyhow, thanks again, I'll try to do something with tags (at the moment I get a server error whenever I try to add a tag attribute to a class)

expandshrink

You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu

Proudly Developed with from