Forums / Developer / Getting a preview of a page

Getting a preview of a page

Author Message

Michael de Vries

Thursday 26 March 2009 3:26:54 am

Hey all,

For my plugin I'm writing (a plugin to create content in some system and then push it to eZ Publish using SOAP) I want to create a preview to show in the external system.

The result I want is to have the actual HTML of a page, so I can show it in my external system in a brwoser. So, what I tried is to create a page (done) and set it to hidden (it's only a preview, done). Now I know eZ Publish has a preview function built in (versionview), but it requires you to log in, because it is in the admin part of eZ Publish.

So, I tried to log in the user and then get the HTML of the page by using the eZHTTPTool, but the eZHTTPTool seems to ignore my logged in user.

// Log in the user
$user->loginCurrent( );

// Fetch the data
$data = eZHTTPTool::sendHTTPRequest( "http://localhost/ezpublish/index.php/ezwebin_site_admin/content/versionview/148/2", 80, false, 'eZ publish', true );

No when I look at $data, it contains the HTML of the login page. I also inserted $user->isLoggedIn, to check if the user was logged in and it returned true.

How can I get the HTML of a hidden page without the user having to login manually?

Jean-Yves Zinsou

Tuesday 31 March 2009 4:14:55 am

Hi there,
may be you can set fake user with the ability to see the hidden nodes and log him in by script, get the date, and then log him out ?

Do Androids Dream of Electric Sheep?
I dream of eZpubliSheep....
------------------------------------------------------------------------
http://www.alma.fr