Forums / Developer / Redirection in my own php

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