How to set opening RSS in browser as Chrome, IE ?

Notice: This thread is very old.
Zuben45
Generous Backer | 268
+
0
-

Good morning, I need help.
I created my small system of rss :). In browser Firefox is function beautiful, when I set after url /rss, then it load RSS. But when I try it in other browser, then browser start download file :(. Do you know what with it ? Thank you very much.

petr.pavel
Backer | 504
+
0
-

Wrong content-type? Give us the url.

P.S. Not really a Nette related question. You should post elsewhere.

Zuben45
Generous Backer | 268
+
0
-

petr.pavel wrote:

Wrong content-type? Give us the url.

P.S. Not really a Nette related question. You should post elsewhere.

I have good contenttype –

{contentType 'application/rss+xml', 'utf-8'}

and my code:

{ifset $rss}
{contentType 'application/rss+xml', 'utf-8'}
<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:cf="http://www.microsoft.com/schemas/rss/core/2005" xmlns:dc="http://purl.org/dc/elements/1.1/">
<channel xmlns:cfi="http://www.microsoft.com/schemas/rss/core/2005/internal" cfi:lastdownloaderror="None">
{foreach $games as $hra}
	<title cf:type="text">Gcore.cz - {$hra->name|firstUpper}</title>
	<link>http://www.gcore.cz/</link>
	<description cf:type="text">Herní portál pro všechny, které baví hry</description>
	<language>cs</language>
	<lastBuildDate>Sat, 25 Jan 2014 12:19:00 +0100</lastBuildDate>
	<image>
		<url>{$baseImage}/gcore_logo.png</url>
		<title>Herní portál pro všechny, které baví hry</title>
		<link>http://www.gcore.cz/</link>
	</image>

	<item>
		<title>{$hra->name|firstUpper}</title>
		<description><![CDATA[<img src="{$baseGames}/{$hra->name|webalize}/bigest.jpg" id="title_img"><br />{!$hra->info|firstUpper}]]></description>
		<guid isPermaLink="true">{$basePath}/gamelist/show/{$hra->id}-{$hra->name|webalize}/rss</guid>
		<category>Games</category>
	</item>
  <item>
   {foreach $games as $info}
    <title>Informace o hře</title>
      <description><![CDATA[Žánr: {$info->zanr}<br />
        Singleplayer: {$info->singleplayer}<br />
        Multiplayer: {$info->multiplayer}<br />
        Vydání: {$info->release_game|date:"d.m.Y"}<br />
        Tvůrci: {$info->studio}<br />
        Vydávatel: {$info->vydavatel}<br />
        Distributor: {$info->distributor}]]></description>
  </item>
  <item>
      <title>Platformy</title>
            <description><![CDATA[{!$presenter->getPlatforms($info->id,"pc")}
            {!$presenter->getPlatforms($info->id,"mac")}
            {!$presenter->getPlatforms($info->id,"ios")}
            {!$presenter->getPlatforms($info->id,"xbox_one")}
            {!$presenter->getPlatforms($info->id,"xbox_360")}
            {!$presenter->getPlatforms($info->id,"ps1")}
            {!$presenter->getPlatforms($info->id,"ps2")}
            {!$presenter->getPlatforms($info->id,"ps3")}
            {!$presenter->getPlatforms($info->id,"ps4")}
            {!$presenter->getPlatforms($info->id,"wii")}
            {!$presenter->getPlatforms($info->id,"nintendo")}
            {!$presenter->getPlatforms($info->id,"android")}
            {!$presenter->getPlatforms($info->id,"symbian")}
            {!$presenter->getPlatforms($info->id,"wphone")}]]></description>
  {/foreach}
  </item>

	<item>
		<title>Shrnutí</title>
		<description><![CDATA[Cena: {$hra->price_dig} Kč (DIG), {$hra->price_box} Kč (BOX)<br>{if $hra->price_box == 0 && $hra->price_dig == 0}
          <a href="{$hra->link_shop}" target="_blank"><img src="{$baseImage}/todownload.png"></a>
        {else}
          <a href="{$hra->link_shop}" target="_blank"><img src="{$baseImage}/toshop.png"></a>
        {/if}]]></description>
	</item>

	<item>
		<title>HW požadavky</title>
		<description><![CDATA[      <h2>Minimální</h2>
          <p>Procesor: {$hra->min_procesor_mhz} GHz - {$hra->min_procesor_jadra} jádro</p>
          <p>RAM: {if $hra->min_ram >= 1024}{$hra->min_ram/1024} GB{else}{$hra->min_ram} MB{/if}</p>
          <p>Grafika: {if $hra->min_grafic >= 1024}{$hra->min_grafic/1024} GB{else}{$hra->min_grafic} MB{/if}</p>
          <p>OS: {$hra->min_os}</p>
          <p>Místo na disku: {$hra->hdd} GB</p>     <h2>Optimální</h2>
          <p>Procesor: {$hra->opt_procesor_mhz} GHz - {$hra->opt_procesor_jadra} jádro</p>
          <p>RAM: {if $hra->opt_ram >= 1024}{$hra->opt_ram/1024} GB{else}{$hra->opt_ram} MB{/if}</p>
          <p>Grafika: {if $hra->opt_grafic >= 1024}{$hra->opt_grafic/1024} GB{else}{$hra->opt_grafic} MB{/if}</p>
          <p>OS: {$hra->opt_os}</p>
          <p>Místo na disku: {$hra->hdd} GB</p>]]></description>
		<guid isPermaLink="true">{$basePath}/gamelist/show/{$hra->id}-{$hra->name|webalize}/rss</guid>
		<category>Games</category>
	</item>

	<item>
      {var pocet = count($medias->where('guid = ?', $hra->id))}
      {if $pocet != 0}
		<title>Videa ke hře</title>
		<description><![CDATA[
      {foreach $medias as $media}
       {if $media->guid == $hra->id} <iframe width="340" height="215" src="http://www.youtube.com/embed/{$media->url}?vq=hd1080" frameborder="0" allowfullscreen></iframe>
       {/if}
      {/foreach}  ]]></description>
      {/if}
	</item>
{/foreach}
<item>
  {if $user->isLoggedIn()}
    <description><![CDATA[{form commentForm}
          <div class="comment-form">
            {control $form errors}
            <div>{input section_id value=>$hra->id} {input section_name value=>$hra->name}{input rss value=>"TRUE"}</div>
            <div>{label text /}</div>
            <div>{input text}</div>

            <div>{input send_comment}</div>
          </div>
    {/form}]]></description>
  {/if}
</item>
	<item>
		<title>Komentáře</title>
		<description><![CDATA[        {var $x = 1}
         {while $comment = $comments->fetch()}
         {var $user_info = $presenter->getSelectUserInfo($comment->user_id)}
         {if ($x % 2) == 0 }
             {var $class = "first_comment"}
         {else}
             {var $class = "second_comment"}
         {/if}
           <section id="{$comment->comment_id}" class="{$class}">
            <div class="comment_top">
              <a href="#{$comment->comment_id}" class="after">#{$comment->comment_id}</a> <a href="#{$comment->comment_id}" class="after">{$user_info->username|firstUpper}</a>
              <a href="#{$comment->comment_id}" class="before">{$comment->date|timeAgoInWords}</a>
            </div>
            <div class="comment_info">
              <div class="comment_show"><img src="{$user_info->avatar}" alt="user_avatar"></div>
              <div class="comment_show"><p>{$comment->text}</p></div>
            </div>


           </section>
           {var $x++}
         {/while}
         {control paginator_comments}     ]]></description>
		<guid isPermaLink="true">{$basePath}/gamelist/show/{$hra->id}-{$hra->name|webalize}/rss</guid>
		<category>Games</category>
	</item>

</channel>
</rss>


{else}

In this forum IE and Chrome work nice, but in my not (it download file) :/

Michalek
Member | 192
+
0
-

Just try this (without quotes)

{contentType application/rss+xml; charset=utf-8}
Zuben45
Generous Backer | 268
+
0
-

Michalek wrote:

Just try this (without quotes)

{contentType application/rss+xml; charset=utf-8}

wow, nice its now compatibility with IE and Chrome, but Firefox not :(

EDIT: SOLVED, I delete “magic” world rss, and its function in every browsers :)

{contentType application/xml; charset=utf-8}

Last edited by Zuben45 (2014-01-26 21:43)