[ Index ]
 

Code source de Symfony 1.0.0

Accédez au Source d'autres logiciels libresSoutenez Angelica Josefina !

title

Body

[fermer]

/lib/helper/ -> AssetHelper.php (sommaire)

AssetHelper.

Author: Fabien Potencier <fabien.potencier@symfony-project.com>
Author: David Heinemeier Hansson
Version: SVN: $Id: AssetHelper.php 3313 2007-01-20 07:00:37Z fabien $
Poids: 486 lignes (14 kb)
Inclus ou requis:0 fois
Référencé: 0 fois
Nécessite: 0 fichiers

Définit 18 fonctions

  auto_discovery_link_tag()
  javascript_path()
  javascript_include_tag()
  stylesheet_path()
  stylesheet_tag()
  use_stylesheet()
  use_javascript()
  decorate_with()
  image_path()
  image_tag()
  _compute_public_path()
  include_metas()
  include_http_metas()
  include_title()
  get_javascripts()
  include_javascripts()
  get_stylesheets()
  include_stylesheets()

Fonctions
Fonctions qui ne font pas partie d'une Classe:

auto_discovery_link_tag($type = 'rss', $url_options = array()   X-Ref
Returns a <link> tag that browsers and news readers
can use to auto-detect a RSS or ATOM feed for the current page,
to be included in the <head> section of a HTML document.

<b>Options:</b>
- rel - defaults to 'alternate'
- type - defaults to 'application/rss+xml'
- title - defaults to the feed type in upper case

<b>Examples:</b>
<code>
echo auto_discovery_link_tag('rss', 'module/feed');
=> <link rel="alternate" type="application/rss+xml" title="RSS" href="http://www.curenthost.com/module/feed" />
echo auto_discovery_link_tag('rss', 'module/feed', array('title' => 'My RSS'));
=> <link rel="alternate" type="application/rss+xml" title="My RSS" href="http://www.curenthost.com/module/feed" />
</code>

param: string feed type ('rss', 'atom')
param: string 'module/action' or '@rule' of the feed
param: array additional HTML compliant <link> tag parameters
return: string XHTML compliant <link> tag

javascript_path($source, $absolute = false)   X-Ref
Returns the path to a JavaScript asset.

<b>Example:</b>
<code>
echo javascript_path('myscript');
=> /js/myscript.js
</code>

<b>Note:</b> The asset name can be supplied as a...
- full path, like "/my_js/myscript.css"
- file name, like "myscript.js", that gets expanded to "/js/myscript.js"
- file name without extension, like "myscript", that gets expanded to "/js/myscript.js"

param: string asset name
param: bool return absolute path ?
return: string file path to the JavaScript file

javascript_include_tag()   X-Ref
Returns a <script> include tag per source given as argument.

<b>Examples:</b>
<code>
echo javascript_include_tag('xmlhr');
=> <script language="JavaScript" type="text/javascript" src="/js/xmlhr.js"></script>
echo javascript_include_tag('common.javascript', '/elsewhere/cools');
=> <script language="JavaScript" type="text/javascript" src="/js/common.javascript"></script>
<script language="JavaScript" type="text/javascript" src="/elsewhere/cools.js"></script>
</code>

param: string asset names
return: string XHTML compliant <script> tag(s)

stylesheet_path($source, $absolute = false)   X-Ref
Returns the path to a stylesheet asset.

<b>Example:</b>
<code>
echo stylesheet_path('style');
=> /css/style.css
</code>

<b>Note:</b> The asset name can be supplied as a...
- full path, like "/my_css/style.css"
- file name, like "style.css", that gets expanded to "/css/style.css"
- file name without extension, like "style", that gets expanded to "/css/style.css"

param: string asset name
param: bool return absolute path ?
return: string file path to the stylesheet file

stylesheet_tag()   X-Ref
Returns a css <link> tag per source given as argument,
to be included in the <head> section of a HTML document.

<b>Options:</b>
- rel - defaults to 'stylesheet'
- type - defaults to 'text/css'
- media - defaults to 'screen'

<b>Examples:</b>
<code>
echo stylesheet_tag('style');
=> <link href="/stylesheets/style.css" media="screen" rel="stylesheet" type="text/css" />
echo stylesheet_tag('style', array('media' => 'all'));
=> <link href="/stylesheets/style.css" media="all" rel="stylesheet" type="text/css" />
echo stylesheet_tag('random.styles', '/css/stylish');
=> <link href="/stylesheets/random.styles" media="screen" rel="stylesheet" type="text/css" />
<link href="/css/stylish.css" media="screen" rel="stylesheet" type="text/css" />
</code>

param: string asset names
param: array additional HTML compliant <link> tag parameters
return: string XHTML compliant <link> tag(s)

use_stylesheet($css, $position = '', $options = array()   X-Ref
Adds a stylesheet to the response object.


use_javascript($js, $position = '')   X-Ref
Adds a javascript to the response object.


decorate_with($layout)   X-Ref
Decorates the current template with a given layout.

param: mixed The layout name or path or false to disable the layout

image_path($source, $absolute = false)   X-Ref
Returns the path to an image asset.

<b>Example:</b>
<code>
echo image_path('foobar');
=> /images/foobar.png
</code>

<b>Note:</b> The asset name can be supplied as a...
- full path, like "/my_images/image.gif"
- file name, like "rss.gif", that gets expanded to "/images/rss.gif"
- file name without extension, like "logo", that gets expanded to "/images/logo.png"

param: string asset name
param: bool return absolute path ?
return: string file path to the image file

image_tag($source, $options = array()   X-Ref
Returns an <img> image tag for the asset given as argument.

<b>Options:</b>
- 'absolute' - to output absolute file paths, useful for embedded images in emails
- 'alt'  - defaults to the file name part of the asset (capitalized and without the extension)
- 'size' - Supplied as "XxY", so "30x45" becomes width="30" and height="45"

<b>Examples:</b>
<code>
echo image_tag('foobar');
=> <img src="images/foobar.png" alt="Foobar" />
echo image_tag('/my_images/image.gif', array('alt' => 'Alternative text', 'size' => '100x200'));
=> <img src="/my_images/image.gif" alt="Alternative text" width="100" height="200" />
</code>

param: string image asset name
param: array additional HTML compliant <img> tag parameters
return: string XHTML compliant <img> tag

_compute_public_path($source, $dir, $ext, $absolute = false)   X-Ref
Pas de description

include_metas()   X-Ref
Prints a set of <meta> tags according to the response attributes,
to be included in the <head> section of a HTML document.

<b>Examples:</b>
<code>
include_metas();
=> <meta name="title" content="symfony - open-source PHP5 web framework" />
<meta name="robots" content="index, follow" />
<meta name="description" content="symfony - open-source PHP5 web framework" />
<meta name="keywords" content="symfony, project, framework, php, php5, open-source, mit, symphony" />
<meta name="language" content="en" /><link href="/stylesheets/style.css" media="screen" rel="stylesheet" type="text/css" />
</code>

<b>Note:</b> Modify the sfResponse object or the view.yml to change, add or remove metas.

return: string XHTML compliant <meta> tag(s)

include_http_metas()   X-Ref
Returns a set of <meta http-equiv> tags according to the response attributes,
to be included in the <head> section of a HTML document.

<b>Examples:</b>
<code>
include_http_metas();
=> <meta http-equiv="content-type" content="text/html; charset=utf-8" />
</code>

<b>Note:</b> Modify the sfResponse object or the view.yml to change, add or remove metas.

return: string XHTML compliant <meta> tag(s)

include_title()   X-Ref
Returns the title of the current page according to the response attributes,
to be included in the <title> section of a HTML document.

<b>Note:</b> Modify the sfResponse object or the view.yml to modify the title of a page.

return: string page title

get_javascripts()   X-Ref
Returns <script> tags for all javascripts configured in view.yml or added to the response object.

You can use this helper to decide the location of javascripts in pages.
By default, if you don't call this helper, symfony will automatically include javascripts before </head>.
Calling this helper disables this behavior.

return: string <script> tags

include_javascripts()   X-Ref
Prints <script> tags for all javascripts configured in view.yml or added to the response object.


get_stylesheets()   X-Ref
Returns <link> tags for all stylesheets configured in view.yml or added to the response object.

You can use this helper to decide the location of stylesheets in pages.
By default, if you don't call this helper, symfony will automatically include stylesheets before </head>.
Calling this helper disables this behavior.

return: string <link> tags

include_stylesheets()   X-Ref
Prints <link> tags for all stylesheets configured in view.yml or added to the response object.




Généré le : Fri Mar 16 22:42:14 2007 par Balluche grâce à PHPXref 0.7