<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>4's symfony blog &#187; mate</title>
	<atom:link href="http://www.foolbirds.com/t/mate/feed" rel="self" type="application/rss+xml" />
	<link>http://www.foolbirds.com</link>
	<description>all about symfony</description>
	<lastBuildDate>Fri, 14 Oct 2011 12:36:02 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>在symfony中如何删除 head mate name=title</title>
		<link>http://www.foolbirds.com/symfony_delete_mate_name_title.html</link>
		<comments>http://www.foolbirds.com/symfony_delete_mate_name_title.html#comments</comments>
		<pubDate>Mon, 17 May 2010 03:43:35 +0000</pubDate>
		<dc:creator>szn000</dc:creator>
				<category><![CDATA[symfony]]></category>
		<category><![CDATA[mate]]></category>
		<category><![CDATA[title]]></category>

		<guid isPermaLink="false">http://www.foolbirds.com/?p=1154</guid>
		<description><![CDATA[SYMFONY 自带的 生成标签的函数(setTitle()) 会默认生成一个 &#60;META NAME=&#8217;TITLE&#8217;&#8230;&#62;这样的一个 标签，这个标签会在 SETTITLE 里受影响 即 同时设置两个TITLE 一个是 &#60;TITLE&#62;一个是&#60;META&#62; 根据客户需求有些时候需要删掉 META NAME=&#8217;TITLE&#8217; 这种，办法如下
新建MyProject/app/MyApp/lib/myWebResponse.class.php 文件
插入如下代码
]]></description>
			<content:encoded><![CDATA[<p>SYMFONY 自带的 生成标签的函数(setTitle()) 会默认生成一个 &lt;META NAME=&#8217;TITLE&#8217;&#8230;&gt;这样的一个 标签，这个标签会在 SETTITLE 里受影响 即 同时设置两个TITLE 一个是 &lt;TITLE&gt;一个是&lt;META&gt; 根据客户需求有些时候需要删掉 META NAME=&#8217;TITLE&#8217; 这种，办法如下<br />
新建MyProject/app/MyApp/lib/myWebResponse.class.php 文件<br />
插入如下代码<br />
<code><?php<br />
class myWebResponse extends sfWebResponse<br />
{<br />
   protected $title = null;<br />
 /*<br />
 * 在Web Response 里搜索Title<br />
 *<br />
 * 返回Title字符串<br />
 */<br />
 public function getTitle()<br />
 {<br />
    return $this->title;<br />
 }<br />
 /*<br />
 * 设置Title为响应Title<br />
 *<br />
 * 参数 title string ,Title内容<br />
 * 参数 rscape boolean true, 用以确认是否格式化字符串<br />
 * 参数 replace boolean true, 用以确认是否覆盖字符串<br />
 */<br />
 public function setTitle($title, $escape = true, $replace = true)<br />
 {<br />
   if (is_null($title))<br />
   {<br />
      unset($this->title);<br />
      return;<br />
   }<br />
   // 注意: 如果你使用i18n 曾转码 该判断将不会工作<br />
   // 查看 include_metas() 在源文件的 AssetHelper<br />
   if ($escape)<br />
   {<br />
      $title = htmlspecialchars($title, ENT_QUOTES, $this->options['charset']);<br />
   }<br />
   if ($replace || is_null($this->title))<br />
   {<br />
      $this->title = $title;<br />
   }<br />
  }<br />
}</code></p>
<p>在文件MyProjiect/apps/MyApps/config/factories.yml<br />
里使用 myWebResponse 替换 sfWebResponse<br />
例如 在factories.yml中添加(替换成)如下代码<br />
<code>all:<br />
  response:<br />
    class: myWebResponse<br />
    param:<br />
      send_http_headers: false</code><br />
上面代码中的all可以替换成相应的模式(生产,开发等)<br />
执行 symfony cc (用于清理symfony产生的缓存文件)</p>
<p>注:该程序执行原理是重写了sfWebResponse setTitle 和 getTitle 两个方法<br />
   使setTitle 添加title的时候不添加 mate name = title<br />
   sfWebResponse setTitle源代码如下<br />
 <code> public function setTitle($title, $escape = true)<br />
  {<br />
    $this->addMeta('title', $title, true, $escape);<br />
  }</code></p>
<h3  class="related_post_title">随机日志</h3><ul class="related_post"><li><a href="http://www.foolbirds.com/symfony-creadential.html" title="symfony 权限访问控制（多用户访问证书）">symfony 权限访问控制（多用户访问证书）</a></li><li><a href="http://www.foolbirds.com/component-slot-in-symfony.html" title="Symfony中组件槽(Component Slot)的应用">Symfony中组件槽(Component Slot)的应用</a></li><li><a href="http://www.foolbirds.com/add-table-prefix-in-symfony.html" title="Add table prefix  in symfony－在symfony中使用表前缀">Add table prefix  in symfony－在symfony中使用表前缀</a></li><li><a href="http://www.foolbirds.com/get-var-in-templates.html" title="如何在视图里接收变量">如何在视图里接收变量</a></li><li><a href="http://www.foolbirds.com/redirect-and-forward-in-symfony.html" title="跳并快乐着－symfony跳转指南">跳并快乐着－symfony跳转指南</a></li><li><a href="http://www.foolbirds.com/python3-is-typ.html" title="python3 判断 变量类型">python3 判断 变量类型</a></li><li><a href="http://www.foolbirds.com/write-symfony-qrcode-plugin.html" title="symfony插件编写一例:QRcodePlugin">symfony插件编写一例:QRcodePlugin</a></li><li><a href="http://www.foolbirds.com/symfony-cmd.html" title="symfony命令行详解">symfony命令行详解</a></li><li><a href="http://www.foolbirds.com/vim%e9%85%8d%e5%90%88phpcs%e5%ae%9e%e7%8e%b0p%e8%87%aa%e5%8a%a8%e8%af%ad%e6%b3%95%e6%a3%80%e6%9f%a5.html" title="vim配合phpcs实现自动语法检查">vim配合phpcs实现自动语法检查</a></li><li><a href="http://www.foolbirds.com/about-upload-images-path.html" title="关于上传图片后显示上传图片的路径问题">关于上传图片后显示上传图片的路径问题</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.foolbirds.com/symfony_delete_mate_name_title.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

