Forums / Developer / mofiying the header

mofiying the header

Author Message

johann savalle

Saturday 09 July 2005 8:34:46 pm

Hello,

I need to change the header of a template, in php it would be done like this:

header("Content-Type: application/msword");
header('Content-Disposition: attachment; filename="filename.doc"'); 

but using php in a template is problematic.
(afaik, it requires kernel hacking... unless recent update non-documented)

Is there a simple way of doing that with eZ ?
any idea is welcome.

johann

johann savalle

Sunday 10 July 2005 10:21:55 pm

feel free to answer...

the first three answers will get an invitation to a wonderfull trip to the wild south of east asia, great activities : visit of the death canyon, partying with a local tribe of cannibals...

hurry up ! not many places left...

Pål J Didriksen

Monday 11 July 2005 4:03:45 am

Not sure if I understand exactly what you want to do, but you can send variables to templates from php, like this:

$tpl->setVariable( 'MyVariableName', $MyValue );

To be able to use the template-functions, you should probably also include this: (I'm not too experienced in this field, so please excuse me if I'm wrong, or leave something out...)

include_once( "kernel/common/template.php" );
$tpl =& templateInit();

$result = array();
$result['content'] =& $tpl->fetch( "design:MyTemplate.tpl" );
$result['path'] = array( array( 'url' => false,
                                'text' => ezi18n( 'design/standard/MyModule', 'MyModule' ) ) );

Then you should be able to use your variable by simply inserting <b>{$MyVariableName}</b> in your template.

johann savalle

Monday 11 July 2005 6:00:55 am

yes, this okay, but a template is an html file in ez, and there is no way I can change the filetype header from html to word.
Usually this is possible when programming in php, but even if I put some php code like the one above, it will not work since ez send his file header first.

So I was wondering if there is any chance to do that with any eZ function that would be hidden or unknow...

K259

Monday 11 July 2005 6:30:43 am

Check out:

/lib/ezutils/classes/ezmimetype.php

You can also change:
kernel/content/view.php
Changes here will override the global header information.

eZ debug

Timing: Jan 19 2025 00:09:02
Script start
Timing: Jan 19 2025 00:09:02
Module start 'content'
Timing: Jan 19 2025 00:09:04
Module end 'content'
Timing: Jan 19 2025 00:09:04
Script end

Main resources:

Total runtime1.6790 sec
Peak memory usage4,096.0000 KB
Database Queries202

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0107 587.6094180.8438
Module start 'content' 0.01071.5165 768.4531569.8984
Module end 'content' 1.52720.1517 1,338.3516337.3828
Script end 1.6789  1,675.7344 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00410.2415210.0002
Check MTime0.00140.0849210.0001
Mysql Total
Database connection0.00130.077510.0013
Mysqli_queries1.591094.76152020.0079
Looping result0.00230.13622000.0000
Template Total1.634097.320.8170
Template load0.00210.124320.0010
Template processing1.631997.199020.8160
Template load and register function0.00020.011510.0002
states
state_id_array0.00140.085310.0014
state_identifier_array0.00090.051320.0004
Override
Cache load0.00180.1061320.0001
Sytem overhead
Fetch class attribute can translate value0.00150.090340.0004
Fetch class attribute name0.00140.081360.0002
XML
Image XML parsing0.00320.191440.0008
class_abstraction
Instantiating content class attribute0.00000.000760.0000
General
dbfile0.00940.5612270.0003
String conversion0.00000.000530.0000
Note: percentages do not add up to 100% because some accumulators overlap

CSS/JS files loaded with "ezjscPacker" during request:

CacheTypePacklevelSourceFiles
CSS0extension/community/design/community/stylesheets/ext/jquery.autocomplete.css
extension/community_design/design/suncana/stylesheets/scrollbars.css
extension/community_design/design/suncana/stylesheets/tabs.css
extension/community_design/design/suncana/stylesheets/roadmap.css
extension/community_design/design/suncana/stylesheets/content.css
extension/community_design/design/suncana/stylesheets/star-rating.css
extension/community_design/design/suncana/stylesheets/syntax_and_custom_tags.css
extension/community_design/design/suncana/stylesheets/buttons.css
extension/community_design/design/suncana/stylesheets/tweetbox.css
extension/community_design/design/suncana/stylesheets/jquery.fancybox-1.3.4.css
extension/bcsmoothgallery/design/standard/stylesheets/magnific-popup.css
extension/sevenx/design/simple/stylesheets/star_rating.css
extension/sevenx/design/simple/stylesheets/libs/fontawesome/css/all.min.css
extension/sevenx/design/simple/stylesheets/main.v02.css
extension/sevenx/design/simple/stylesheets/main.v02.res.css
JS0extension/ezjscore/design/standard/lib/yui/3.17.2/build/yui/yui-min.js
extension/ezjscore/design/standard/javascript/jquery-3.7.0.min.js
extension/community_design/design/suncana/javascript/jquery.ui.core.min.js
extension/community_design/design/suncana/javascript/jquery.ui.widget.min.js
extension/community_design/design/suncana/javascript/jquery.easing.1.3.js
extension/community_design/design/suncana/javascript/jquery.ui.tabs.js
extension/community_design/design/suncana/javascript/jquery.hoverIntent.min.js
extension/community_design/design/suncana/javascript/jquery.popmenu.js
extension/community_design/design/suncana/javascript/jScrollPane.js
extension/community_design/design/suncana/javascript/jquery.mousewheel.js
extension/community_design/design/suncana/javascript/jquery.cycle.all.js
extension/sevenx/design/simple/javascript/jquery.scrollTo.js
extension/community_design/design/suncana/javascript/jquery.cookie.js
extension/community_design/design/suncana/javascript/ezstarrating_jquery.js
extension/community_design/design/suncana/javascript/jquery.initboxes.js
extension/community_design/design/suncana/javascript/app.js
extension/community_design/design/suncana/javascript/twitterwidget.js
extension/community_design/design/suncana/javascript/community.js
extension/community_design/design/suncana/javascript/roadmap.js
extension/community_design/design/suncana/javascript/ez.js
extension/community_design/design/suncana/javascript/ezshareevents.js
extension/sevenx/design/simple/javascript/main.js

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/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
10content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
3content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
4content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
1content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/pagelayout.tplEdit templateOverride template
 Number of times templates used: 25
 Number of unique templates used: 7

Time used to render debug report: 0.0002 secs