Passing Variables between different views within a module

Author Message

Daniel Scheiner

Sunday 23 April 2006 5:55:11 am

Hi!

I'm new to ezP so please forgive any questions that might turn out to be stupid or self-explanatory. =)

I'm trying to create my first module.
I have 2 PHP-files (guess you call them views) in my ezmymodul-folder.
The first file/view -let's call it view1.php- <b>will be the first to be called from another server and that server will pass some POST-Variables to my view1.php</b>.

So:
I extract the POST-vars with the help of eZHTTPTool in my view1.php:

$http =& eZHTTPTool::instance();
if ( $http->hasPostVariable( "keyword" ) )
    $Keyword = $http->postVariable( "keyword" );

Now I want to pass this $Keyword - Variable to my second view, view2.php.
But here's where I stumble...
1) How do I pass this Variable to my view2.php?
2) How do I access this Variable in view2.php?
3) Do I have to declare some Params in module.php for it to work?

I would really appreciate any help on this subject!

Thanks!

Daniel

Präßler Sven

Monday 24 April 2006 1:44:51 am

Yes define a param in the Module.php file for view2.

$ViewList['view2'] = array(
	'script' 	=> 	'view2.php',
	'params'		=>	array('keyword')
);

1. Pass the variable with the url like:

www.mysite.de/intranet/mymodule/view2/myvariable

2.Access the variable by using:

$view2Keyword = $Params['keyword'];

Nabil Alimi

Wednesday 26 April 2006 6:43:22 am

You can also use session vars depending on what your aim is.

My blog : http://www.starnab.com/ezpublish / http://www.starnab.com/ / http://www.assiki-consulting.com
eZ Publish Freelance developper. Feel free to contact me +33 674 367 057
nabil at assiki d0t 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 31 2025 00:38:06
Script start
Timing: Jan 31 2025 00:38:06
Module start 'layout'
Timing: Jan 31 2025 00:38:06
Module start 'content'
Timing: Jan 31 2025 00:38:06
Module end 'content'
Timing: Jan 31 2025 00:38:06
Script end

Main resources:

Total runtime0.0243 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.0061 588.3906151.2422
Module start 'layout' 0.00610.0038 739.6328220.7500
Module start 'content' 0.00990.0128 960.3828997.9922
Module end 'content' 0.02270.0016 1,958.375033.9922
Script end 0.0243  1,992.3672 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.002710.9930140.0002
Check MTime0.00114.6691140.0001
Mysql Total
Database connection0.00083.233110.0008
Mysqli_queries0.003213.173530.0011
Looping result0.00000.061810.0000
Template Total0.00114.710.0011
Template load0.00093.760810.0009
Template processing0.00020.905410.0002
Override
Cache load0.00062.547410.0006
General
dbfile0.00114.657380.0001
String conversion0.00000.034340.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