Development

#7282 (addLink() to header)

You must first sign up to be able to contribute.

Ticket #7282 (closed enhancement: wontfix)

Opened 3 years ago

Last modified 3 years ago

addLink() to header

Reported by: PieR. Assigned to: fabien
Priority: minor Milestone:
Component: view Version: 1.3.0 alpha1
Keywords: header view link Cc:
Qualification: Unreviewed

Description

In the sfWebResponse class is missing a method (addLink) to do that for example : <link rel="canonical" href="/my-link" /> <link rel="search" type="application/opensearchdescription+xml" href="http://ak.style.dailymotion.com/css/opensearch.xml" title="Rechercher des vidéos sur Dailymotion" /> <link rel="apple-touch-icon" href="http://ak.style.dailymotion.com/images/apple-touch-icon.png" /> <link rel="shortcut icon" type="image/x-icon" href="/images/favicon.ico" />

Thanks

Change History

10/06/09 00:53:31 changed by FabianLange

this is about the same as discussed in #1126 I am willing to see more potential in this ticket because it brings better examples than the one we had in 1126. I am closing #1126 and hoping someone comes up with a good patch for this :-)

10/06/09 09:41:11 changed by fabien

I'm strongly against added this to the sfWebResponse class. Why not create a helper for this?

10/23/09 10:05:40 changed by jfischer

I created a simple add_link helper that fills a slot named "links". See http://jnotes.jonasfischer.net/2009/10/symfony-link-tags-e-g-canonical/ for example usage. Perhaps this helps?

/**
* Add link tag to slot 'links'
*
* @param String $href [Absolute or internat URI]
* @param String $rel [value for 'rel' attribtue, e.g. 'canonical']
*
* @return void
*/
function add_link($href, $rel)
{
  $slot = $slot  = get_slot('links');
  try {
    $href = url_for($href, true);
    $slot  .= "\n<link rel=\"$rel\" href=\"$href\" />";
  } catch (InvalidArgumentException $e) {
    $slot  .= "\n<!-- Could not add Link '$href': Only absolute or internal URIs allowed -->";
  }
  slot('links', $slot);
}

11/17/09 00:15:35 changed by Kris.Wallsmith

  • status changed from new to closed.
  • resolution set to wontfix.