how to specify content type of template?

Author Message

Vytautas Germanavičius

Friday 28 April 2006 12:14:28 am

Is anywhere described, how to specify content type of template?

{set-block scope=root variable=cache_ttl}0{/set-block}

Bertrand Dunogier

Saturday 29 April 2006 1:54:29 pm

If I understand correctly, you want to have a page with a specific content/type, like text/xml ? You would have to patch kernel/layout/set.php to do that, since a template by itself does not have a specific content type (a page is made of several templates, not just one).

I'm not sure that patch is available in the contributions, I would have to check that.

Bertrand Dunogier
eZ Systems Engineering, Lyon
http://twitter.com/bdunogier
http://gplus.to/BertrandDunogier

André R.

Sunday 30 April 2006 5:39:01 am

Bertrand : If he is talking about mime Content Type:
Dosn't v3.8 have support for setting that per siteaccess??
Seem a lot easier and more upgradeable then patching kernel files.

vytis: If you are talking about eZ Content types = class types, then you should explain what you are after a little bit better..

eZ Online Editor 5: http://projects.ez.no/ezoe || eZJSCore (Ajax): http://projects.ez.no/ezjscore || eZ Publish EE http://ez.no/eZPublish/eZ-Publish-Enterprise-Subscription
@: http://twitter.com/andrerom

Vytautas Germanavičius

Monday 01 May 2006 11:55:00 pm

I'm talking about mime types.
I want to create template for CSS file. Current system returns this as "text/html", and mozilla ignores it, because content type of CSS file must be "text/css"

{set-block scope=root variable=cache_ttl}0{/set-block}

Marc Boon

Monday 08 May 2006 12:35:24 am

From site.ini in 3.8:

[HTTPHeaderSettings]
# Enable/disable custom HTTP header data.
CustomHeader=disabled

# Header list. Contains all HTTP which should override standard ones.
HeaderList[]
HeaderList[]=Cache-Control
HeaderList[]=Pragma
HeaderList[]=Expires

# Default Cache-Control header
# HTTP Headers are specified using the following format :
# <HTTP header>[<eZ publish path|module{/view}>]=<value>{;<depth>{;<level>}}
#
# Example :
# # Set Pragma HTTP header to no-cache for whole site, except /news, and 2 levels below news.
# Pragma[]
# Pragma[/]=no-cache;2
# Pragma[/news]=;2;0

To achieve what you need, you could try something like this:

[HTTPHeaderSettings]
# Enable/disable custom HTTP header data.
CustomHeader=enabled

# Header list. Contains all HTTP headers which should override standard ones.
HeaderList[]
HeaderList[]=Content-Type

Content-Type[]
Content-Type[/css]=text/css

Marc Boon

Monday 08 May 2006 12:43:47 am

Alternatively, you could use Apache to change the Content-Type for specific files by specifying it in .htaccess:

<Files filename>
  ForceType text/css
</Files>

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 21 2025 00:26:17
Script start
Timing: Jan 21 2025 00:26:17
Module start 'layout'
Timing: Jan 21 2025 00:26:17
Module start 'content'
Timing: Jan 21 2025 00:26:17
Module end 'content'
Timing: Jan 21 2025 00:26:17
Script end

Main resources:

Total runtime0.0189 sec
Peak memory usage2,048.0000 KB
Database Queries3

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0059 588.0313151.2266
Module start 'layout' 0.00590.0056 739.257836.6797
Module start 'content' 0.01160.0058 775.937598.3125
Module end 'content' 0.01730.0015 874.250037.9922
Script end 0.0188  912.2422 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.002513.2178140.0002
Check MTime0.00115.9538140.0001
Mysql Total
Database connection0.00105.531510.0010
Mysqli_queries0.005629.650330.0019
Looping result0.00000.153010.0000
Template Total0.00115.810.0011
Template load0.00084.280710.0008
Template processing0.00031.521310.0003
Override
Cache load0.00063.038910.0006
General
dbfile0.00115.684580.0001
String conversion0.00000.063240.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