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

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

eZ debug

Timing: Jan 18 2025 15:50:54
Script start
Timing: Jan 18 2025 15:50:54
Module start 'layout'
Timing: Jan 18 2025 15:50:54
Module start 'content'
Timing: Jan 18 2025 15:50:55
Module end 'content'
Timing: Jan 18 2025 15:50:55
Script end

Main resources:

Total runtime0.0185 sec
Peak memory usage4,096.0000 KB
Database Queries3

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0078 587.9141152.6250
Module start 'layout' 0.00780.0027 740.539139.4453
Module start 'content' 0.01060.0055 779.984489.4453
Module end 'content' 0.01610.0024 869.429730.3047
Script end 0.0185  899.7344 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.003217.0543140.0002
Check MTime0.00136.7517140.0001
Mysql Total
Database connection0.00116.093010.0011
Mysqli_queries0.002814.882730.0009
Looping result0.00000.065610.0000
Template Total0.001910.110.0019
Template load0.00105.532110.0010
Template processing0.00084.565910.0008
Override
Cache load0.00073.927810.0007
General
dbfile0.00031.587680.0000
String conversion0.00000.037340.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 1
 Number of unique templates used: 1

Time used to render debug report: 0.0001 secs