Redirection in my own php

Author Message

Victor Dujardin

Thursday 23 July 2009 3:07:40 am

Heath

Thursday 23 July 2009 5:33:16 am

Hello,

How you redirect depends mostly on where you want to go and how best to redirect to that location, etc.

I might suggest for you to start (and remain for a time) with using standard php redirection as eZ publish api for redirection is a little confusing and not often clearly understood as in how to use when in practice it's not really required to be used by the user.

  $location = '/'. $parameterUrl .$s;
  // die( print_r( $location ) );

  header( "Location: " . $location );
  die();

Cheers,
Heath

[1] <i>http://projects.ez.no/bcposttoview</i>
[0] <i>http://svn.projects.ez.no/bcposttoview/trunk/extension/bcposttoview/modules/customfilter02/action.php</i>

Brookins Consulting | http://brookinsconsulting.com/
Certified | http://auth.ez.no/certification/verify/380350
Solutions | http://projects.ez.no/users/community/brookins_consulting
eZpedia community documentation project | http://ezpedia.org

Victor Dujardin

Thursday 23 July 2009 6:05:51 am

Thank you Heath.

My problem is that i don't want to use

header("Location: ... ")

because I have to hardcode my site url prefixes like in

header("Location: /ezpublish-4.0.1/index.php/fre/folder/node/(status)/done")

I just want to code my node number. Is that possible?

Heath

Thursday 23 July 2009 7:19:03 am

No worries :)

I understand your reasons. These are sound.

Remember you can use 'relative urls' which while a static string i think is almost the same as a static node id. Both which could regardless be fetched from a settings file variable. I would use settings for these values regardless (re: using a custom settings file, try it)

You can fetch a node and it's url and concatenate the node url with your calculated redirect view parameters but ... do this with your own php and the header tag yourself as I am not aware of an existing method which allows you to pass only a nodeid + view_parameters for redirection.

Perhaps there is one I'm not aware of (I have not seen it) but it should not be hard to write I've already cited an example for the bulk of the work. Simply augment this to use a php fetch of a content object node and url in place of redirect url string.

Update: Look at how existing default kernel modules access settings via php. in ezp/kernel/content (look at these files and search for the string 'ini', your sure to find an example).

Cheers,
Heath

[0] http://serwatka.net/blog/fetching_ez_publish_content_objects_with_php
[1] http://pubsvn.ez.no/doxygen/trunk/html/classeZContentObjectTreeNode.html#bd3dd7846ef218d480047e1ac26ed1fa
[2] http://pubsvn.ez.no/doxygen/trunk/html/ezcontentobjecttreenode_8php-source.html#l01784

[5] http://pubsvn.ez.no/doxygen/trunk/html/annotated.html
[7] http://pubsvn.ez.no/doxygen/trunk/html/classeZRedirectManager.html
[9] http://pubsvn.ez.no/doxygen/trunk/html/classeZHTTPTool.html

Brookins Consulting | http://brookinsconsulting.com/
Certified | http://auth.ez.no/certification/verify/380350
Solutions | http://projects.ez.no/users/community/brookins_consulting
eZpedia community documentation project | http://ezpedia.org

Victor Dujardin

Thursday 23 July 2009 9:14:20 am

Thanks again Heath.

I tried to read the files you mentioned. But, as I am not a programer, event not a computer science engineer, I didn't get a half of what I read. And I also read the links you wrote and I understood a little bit more.

For the part I understood, I tried many solutions but always got errors like :

Fatal error: Class 'eZPersistentObject' not found in C:\wamp\www\ezpublish-4.0.1\kernel\classes\ezcontentobjecttreenode.php on line 68

I tried to solve them but no result.

Could you explain me, regarding my level?

Thanks.

Victor

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 10:57:41
Script start
Timing: Jan 18 2025 10:57:41
Module start 'layout'
Timing: Jan 18 2025 10:57:41
Module start 'content'
Warning: PHP: E_WARNING Jan 18 2025 10:57:42
DOMDocument::loadXML(): Opening and ending tag mismatch: literal line 2 and paragraph in Entity, line: 9 in /home/ze/public_html/share.se7enx.com/kernel/classes/datatypes/ezxmltext/ezxmloutputhandler.php on line 174
Warning: PHP: E_WARNING Jan 18 2025 10:57:42
DOMDocument::loadXML(): Opening and ending tag mismatch: paragraph line 2 and section in Entity, line: 11 in /home/ze/public_html/share.se7enx.com/kernel/classes/datatypes/ezxmltext/ezxmloutputhandler.php on line 174
Timing: Jan 18 2025 10:57:42
Module end 'content'
Timing: Jan 18 2025 10:57:42
Script end

Main resources:

Total runtime1.3300 sec
Peak memory usage4,096.0000 KB
Database Queries63

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0129 589.0469152.6250
Module start 'layout' 0.01290.0042 741.671939.4453
Module start 'content' 0.01711.3109 781.1172583.1406
Module end 'content' 1.32800.0019 1,364.257817.0000
Script end 1.3299  1,381.2578 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00360.2702160.0002
Check MTime0.00140.1028160.0001
Mysql Total
Database connection0.00140.106310.0014
Mysqli_queries1.250694.0322630.0199
Looping result0.00070.0522610.0000
Template Total1.283596.520.6417
Template load0.00230.173220.0012
Template processing1.281196.328320.6406
Template load and register function0.00020.014910.0002
states
state_id_array0.00180.134610.0018
state_identifier_array0.00160.118620.0008
Override
Cache load0.00200.1530480.0000
Sytem overhead
Fetch class attribute can translate value0.00120.089320.0006
Fetch class attribute name0.00100.074570.0001
XML
Image XML parsing0.00450.334920.0022
class_abstraction
Instantiating content class attribute0.00010.0041100.0000
General
dbfile0.00600.4525230.0003
String conversion0.00000.000840.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
5content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
5content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
12content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
4content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
5content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 33
 Number of unique templates used: 7

Time used to render debug report: 0.0001 secs