Forums / Developer / how to specify content type of template?

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>

eZ debug

Timing: Jan 20 2025 23:43:46
Script start
Timing: Jan 20 2025 23:43:46
Module start 'content'
Timing: Jan 20 2025 23:43:46
Module end 'content'
Timing: Jan 20 2025 23:43:46
Script end

Main resources:

Total runtime0.2066 sec
Peak memory usage2,048.0000 KB
Database Queries141

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0094 589.4141180.8281
Module start 'content' 0.00940.0063 770.242298.0547
Module end 'content' 0.01570.1908 868.2969525.7500
Script end 0.2065  1,394.0469 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00391.8874200.0002
Check MTime0.00150.7379200.0001
Mysql Total
Database connection0.00080.410410.0008
Mysqli_queries0.147771.47731410.0010
Looping result0.00160.79571390.0000
Template Total0.190392.110.1903
Template load0.00100.503810.0010
Template processing0.189391.596110.1893
Override
Cache load0.00070.353310.0007
Sytem overhead
Fetch class attribute can translate value0.00090.416810.0009
XML
Image XML parsing0.00030.143310.0003
General
dbfile0.00271.3023200.0001
String conversion0.00000.011730.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
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/pagelayout.tplEdit templateOverride template
 Number of times templates used: 1
 Number of unique templates used: 1

Time used to render debug report: 0.0002 secs