Forums / Developer / how to specify content type of template?
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
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"
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
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>