Jump to content
twols

Setting different MIME-Types for a template

Recommended Posts

Hello guys!

Is it possible to render a template depending on the URL? The "normal" page by using the html-Template and with the ".xml" extension a different template? I would write a module or something, but may be there is smarter way for solving my problem :)

Share this post


Link to post
Share on other sites

I think PW has you covered there,

post-378-0-47608800-1461151833_thumb.png

There's a Content-Type select on the Files tab for each template. The note underneath says 'To add more content types see contentTypes in /wire/config.php (and add them in /site/config.php).'.

  • Like 2

Share this post


Link to post
Share on other sites

Thank you, @DaveP, but the "standard" way of PW is allowing only one mime type per template. I want to represent the same listing of posts in html or xml format. But may be I should simply create two templates and two pages. Though it is not that clean and creates additional content used only for structuring formats.

Share this post


Link to post
Share on other sites

File extentions in the url are parsed as part of the page name. So you either need two different pages anyway or you need to handle everything on the parent page's template and use urlSegments. Alternatively you could also hook into the initial request parsing and implement your own "file type" routing logic.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...