How to get my URL variables into my extension ?

Author Message

Damien MARTIN

Friday 17 July 2009 6:54:48 am

Hi there,

I have a new problem :

I'm programming a new extension who have to get variables from URLs :

<mywebsite>/teleform/telecharger/(document)/125

So, I would like to get the "document" parameter from my PHP code.

I tried :

$http = new eZHTTPTool();
$http->variable("document");

But my object is still empty.

I searched around the API but I feel lost...

What is the class that handle this kind of datas ?

Thanks,

Damien

Gaetano Giunta

Friday 17 July 2009 7:25:22 am

You should declare your view variables in the module.php file.

In this case, it is a named var (as opposed to positional ones), so you should add something like this:
$ViewList = array(
'telecharger' => array(
// other stuff here...
'unordered_params' => array( 'document' => 'document' )

Then you recover them as
$document= (string) $Params['document'];

Principal Consultant International Business
Member of the Community Project Board

Damien MARTIN

Friday 17 July 2009 7:36:19 am

Thank you very much Gaetano, it works very well !

:)

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:29:44
Script start
Timing: Jan 18 2025 10:29:44
Module start 'layout'
Timing: Jan 18 2025 10:29:44
Module start 'content'
Timing: Jan 18 2025 10:29:45
Module end 'content'
Timing: Jan 18 2025 10:29:45
Script end

Main resources:

Total runtime0.7753 sec
Peak memory usage4,096.0000 KB
Database Queries57

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0065 588.0469152.6406
Module start 'layout' 0.00650.0049 740.687539.4766
Module start 'content' 0.01130.7625 780.1641542.6641
Module end 'content' 0.77390.0014 1,322.828112.4375
Script end 0.7753  1,335.2656 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00330.4269160.0002
Check MTime0.00130.1664160.0001
Mysql Total
Database connection0.00090.113010.0009
Mysqli_queries0.717592.5426570.0126
Looping result0.00080.0972550.0000
Template Total0.745496.120.3727
Template load0.00210.265320.0010
Template processing0.743395.868120.3716
Template load and register function0.00010.016410.0001
states
state_id_array0.00080.109010.0008
state_identifier_array0.00080.105820.0004
Override
Cache load0.00180.2266300.0001
Sytem overhead
Fetch class attribute can translate value0.00060.075620.0003
Fetch class attribute name0.00110.147350.0002
XML
Image XML parsing0.00270.345020.0013
class_abstraction
Instantiating content class attribute0.00000.001360.0000
General
dbfile0.00250.3188220.0001
String conversion0.00000.001740.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
3content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
3content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
6content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
1content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
2content/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: 17
 Number of unique templates used: 7

Time used to render debug report: 0.0001 secs