Extra parameters - $view_parameters doesn't work?!

Author Message

rhodri davies

Wednesday 22 October 2003 8:59:31 am

Hi,

The last section on this page (http://www.ez.no/developer/ez_publish_3/documentation/customization/custom_design/file_placement) suggests that it is possible to pass extra parameters to pages as key/value pairs - however I am unable to get these extra parameters to work as the document suggests.

For example:

http://www.mysite.com/index.php/content/view/full/51/myval1/10/myval2/20

Will not render {$view_parameters.myval1} or {$view_parameters.myval2} with any values.

It seems as tho the line handling this in content/view.php

175: $viewParameters = array( 'offset' => $Offset );

only stores the offset parameter that is picked up in content/module.php

$ViewList["view"] = array(
"functions" => array( 'read' ),
"default_navigation_part" => 'ezcontentnavigationpart',
"script" => "view.php",
"params" => array( "ViewMode", "NodeID" ),
"unordered_params" => array( "language" => "Language",
"offset" => "Offset" )
);

I did try changing the line in view.php to

175: $viewParameters = $Params[ 'Parameters' ]; //array( 'offset' => $Offset );

But that gives a integer indexed array and not a string indexed array which would be more useful in this situation.

Is there a function in eZp to transpose this array from the sequential key/value pairs into a string indexed array which uses the key as the index value?

Regards

Rhodri Davies

rhodri davies

Wednesday 22 October 2003 9:37:26 am

I have written a quick patch for this:

Replace this line in view.php

$viewParameters = array( 'offset' => $Offset );

with this

$viewParameters = $Params[ 'Parameters' ];
$viewParameters = array_slice( $viewParameters, 2 );
$viewParameters = array_slice( $viewParameters, 0, count( $viewParameters ) - 1 );

$tempViewParameters = Array();

for ( $pcount=0; $pcount < count( $viewParameters ) - 1; $pcount = $pcount + 2) {

$tempViewParameters[ $viewParameters[ $pcount ] ] = $viewParameters[ $pcount + 1 ];

}
$viewParameters = $tempViewParameters;

It's may look a bit messy but that's because I've only started using php recently. Now I can send all the extra variables I want and they are all accessable via $viewParameters in the template. :-)

I would really like to know if this should already be in eZp or I've missed something.

Regards

Rhodri Davies

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 22:31:04
Script start
Timing: Jan 18 2025 22:31:04
Module start 'layout'
Timing: Jan 18 2025 22:31:04
Module start 'content'
Timing: Jan 18 2025 22:31:05
Module end 'content'
Timing: Jan 18 2025 22:31:05
Script end

Main resources:

Total runtime1.0262 sec
Peak memory usage4,096.0000 KB
Database Queries52

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0045 588.0469152.6406
Module start 'layout' 0.00450.0026 740.687539.4766
Module start 'content' 0.00711.0174 780.1641432.2188
Module end 'content' 1.02450.0017 1,212.38288.1250
Script end 1.0262  1,220.5078 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00310.3062160.0002
Check MTime0.00130.1252160.0001
Mysql Total
Database connection0.00070.063410.0007
Mysqli_queries0.976595.1552520.0188
Looping result0.00050.0502500.0000
Template Total0.994196.920.4971
Template load0.00210.201220.0010
Template processing0.992196.671820.4960
Template load and register function0.00020.018310.0002
states
state_id_array0.00160.157710.0016
state_identifier_array0.00100.099520.0005
Override
Cache load0.00170.1653430.0000
Sytem overhead
Fetch class attribute can translate value0.00050.049010.0005
Fetch class attribute name0.00190.181620.0009
XML
Image XML parsing0.00010.010310.0001
class_abstraction
Instantiating content class attribute0.00000.000720.0000
General
dbfile0.00060.0581100.0001
String conversion0.00000.000740.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
2content/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
4content/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: 14
 Number of unique templates used: 5

Time used to render debug report: 0.0001 secs