Author
|
Message
|
Ivan Švogor
|
Monday 07 March 2011 8:17:57 am
Hi, I need to display some custom xml when user clicks on some link. No templates, no html, just XML. Something like rss... everything I need is in php, i just need to echo it.. Can anyone tell me how can this be done in ez publish? thanks
|
Damien Pobel
|
Monday 07 March 2011 8:35:42 am
Hi Ivan, you can write a module with a view that will output your XML. See this tutorial http://share.ez.no/learn/ez-publish/an-introduction-to-developing-ez-publish-extensions and especially the chapter on Creating a view Cheers
Damien
Planet eZ Publish.fr : http://www.planet-ezpublish.fr
Certification : http://auth.ez.no/certification/verify/372448
Publications about eZ Publish : http://pwet.fr/tags/keywords/weblog/ez_publish
|
Conrad Decker
|
Monday 07 March 2011 8:53:43 am
This won't help if everything you need is in PHP, but you can accomplish something similar using the layout module. You can create an alternate pagelayout file for each layout you create. For example, we've created an xml layout for exactly this reason. Take a look here: http://doc.ez.no/eZ-Publish/Technical-manual/4.x/Reference/Modules/layout, it might provide some insight.
|
Marko Žmak
|
Monday 07 March 2011 12:09:00 pm
Ivan, I suggest to take a look at Conrad's advice. A lot of things can be implemented using layouts and templates, and it gives you all the strength of the eZP template mechanism. For example, you can implement the complete RSS functionality. You can even set the ContentType for a specific layout, it goes like this:
[json]
PageLayout=pagelayout_json.tpl
ContentType=application/json
--
Nothing is impossible. Not if you can imagine it!
Hubert Farnsworth
|
Jurica Perić
|
Wednesday 23 March 2011 6:49:35 am
In my opinion the simplest way is to create new extension (or expand an existing one) and add new view. In php script of that view run all the php code you need, echo it and on the end of file add following lines:
echo $output;
eZDB::checkTransactionCounter(); eZExecution::cleanExit(); Hope new FOI pages will work with this :)
|
Marko Žmak
|
Wednesday 23 March 2011 7:22:08 am
"
In my opinion the simplest way is to create new extension (or expand an existing one) and add new view. In php script of that view run all the php code you need, echo it and on the end of file add following lines:
echo $output;
eZDB::checkTransactionCounter(); eZExecution::cleanExit(); Hope new FOI pages will work with this :)
"
Using layouts is far more easier and simpler than creating a whole new extension. Also you won't have any compatibility problems when upgrading as you could have with a custom extension. Furthermore, writing a custom extension is a new source of bugs and stability and security issues, while using the layout system and eZ templates is an implementation that lies on a thoroughly tested eZP PHP code. So if you don't need any special functionality that's not supported by the eZP template system I think that the layout solution is the best way to do it.
--
Nothing is impossible. Not if you can imagine it!
Hubert Farnsworth
|
Jurica Perić
|
Saturday 26 March 2011 3:01:41 am
You're missing one key word. He says everything is in php. So he can't just echo php in template. Yes, layouts are simpler and faster way if you have everything you need in template variables. But that's not the case here. And if he doesn't know about the functionality i was talking about, i doubt that he knows how to get something from php in tpl.
|