Difference between revisions of "JDocumentRendererHead/fetchHead"
From Joomla! Documentation
< API15:JDocumentRendererHead
m (added Category:Security mod error page using HotCat) |
|||
(One intermediate revision by one other user not shown) | |||
Line 3: | Line 3: | ||
<span class="editsection" style="font-size:76%;"> | <span class="editsection" style="font-size:76%;"> | ||
− | <nowiki>[< | + | <nowiki>[<! removed edit link to red link >]</nowiki> |
</span> | </span> | ||
− | + | <! removed transcluded page call, red link never existed > | |
===Syntax=== | ===Syntax=== | ||
Line 109: | Line 109: | ||
// Generate script file links | // Generate script file links | ||
foreach ($document->_scripts as $strSrc => $strType) { | foreach ($document->_scripts as $strSrc => $strType) { | ||
− | $strHtml .= $tab.' | + | $strHtml .= $tab.'<script type="'.$strType.'" src="'.$strSrc.'"></script>'.$lnEnd; |
} | } | ||
Line 115: | Line 115: | ||
foreach ($document->_script as $type => $content) | foreach ($document->_script as $type => $content) | ||
{ | { | ||
− | $strHtml .= $tab.' | + | $strHtml .= $tab.'<script type="'.$type.'">'.$lnEnd; |
// This is for full XHTML support. | // This is for full XHTML support. | ||
Line 140: | Line 140: | ||
<span class="editsection" style="font-size:76%;"> | <span class="editsection" style="font-size:76%;"> | ||
− | <nowiki>[< | + | <nowiki>[<! removed edit link to red link >]</nowiki> |
</span> | </span> | ||
− | + | <! removed transcluded page call, red link never existed > | |
===Examples=== | ===Examples=== | ||
Line 155: | Line 155: | ||
format= ,,, | format= ,,, | ||
</dpl> | </dpl> | ||
+ | [[Category:Archived pages API15]] | ||
+ | [[Category:Security mod error page]] |
Revision as of 20:43, 12 May 2013
The "API15" namespace is an archived namespace. This page contains information for a Joomla! version which is no longer supported. It exists only as a historical reference, it will not be improved and its content may be incomplete and/or contain broken links.
Description[edit]
Generates the head html and return the results as a string
[<! removed edit link to red link >]
<! removed transcluded page call, red link never existed >
Syntax[edit]
fetchHead(&$document)
Parameter Name | Default Value | Description |
---|---|---|
&$document |
Returns[edit]
string
Defined in[edit]
libraries/joomla/document/html/renderer/head.php
Importing[edit]
jimport( 'joomla.document.html.renderer.head' );
Source Body[edit]
function fetchHead(&$document)
{
// get line endings
$lnEnd = $document->_getLineEnd();
$tab = $document->_getTab();
$tagEnd = ' />';
$strHtml = '';
// Generate base tag (need to happen first)
$base = $document->getBase();
if(!empty($base)) {
$strHtml .= $tab.'<base href="'.$document->getBase().'" />'.$lnEnd;
}
// Generate META tags (needs to happen as early as possible in the head)
foreach ($document->_metaTags as $type => $tag)
{
foreach ($tag as $name => $content)
{
if ($type == 'http-equiv') {
$strHtml .= $tab.'<meta http-equiv="'.$name.'" content="'.$content.'"'.$tagEnd.$lnEnd;
} elseif ($type == 'standard') {
$strHtml .= $tab.'<meta name="'.$name.'" content="'.str_replace('"',"'",$content).'"'.$tagEnd.$lnEnd;
}
}
}
$strHtml .= $tab.'<meta name="description" content="'.$document->getDescription().'" />'.$lnEnd;
$strHtml .= $tab.'<meta name="generator" content="'.$document->getGenerator().'" />'.$lnEnd;
$strHtml .= $tab.'<title>'.htmlspecialchars($document->getTitle()).'</title>'.$lnEnd;
// Generate link declarations
foreach ($document->_links as $link) {
$strHtml .= $tab.$link.$tagEnd.$lnEnd;
}
// Generate stylesheet links
foreach ($document->_styleSheets as $strSrc => $strAttr )
{
$strHtml .= $tab . '<link rel="stylesheet" href="'.$strSrc.'" type="'.$strAttr['mime'].'"';
if (!is_null($strAttr['media'])){
$strHtml .= ' media="'.$strAttr['media'].'" ';
}
if ($temp = JArrayHelper::toString($strAttr['attribs'])) {
$strHtml .= ' '.$temp;;
}
$strHtml .= $tagEnd.$lnEnd;
}
// Generate stylesheet declarations
foreach ($document->_style as $type => $content)
{
$strHtml .= $tab.'<style type="'.$type.'">'.$lnEnd;
// This is for full XHTML support.
if ($document->_mime == 'text/html' ) {
$strHtml .= $tab.$tab.'<!--'.$lnEnd;
} else {
$strHtml .= $tab.$tab.'<![CDATA['.$lnEnd;
}
$strHtml .= $content . $lnEnd;
// See above note
if ($document->_mime == 'text/html' ) {
$strHtml .= $tab.$tab.'-->'.$lnEnd;
} else {
$strHtml .= $tab.$tab.']]>'.$lnEnd;
}
$strHtml .= $tab.'</style>'.$lnEnd;
}
// Generate script file links
foreach ($document->_scripts as $strSrc => $strType) {
$strHtml .= $tab.'<script type="'.$strType.'" src="'.$strSrc.'"></script>'.$lnEnd;
}
// Generate script declarations
foreach ($document->_script as $type => $content)
{
$strHtml .= $tab.'<script type="'.$type.'">'.$lnEnd;
// This is for full XHTML support.
if ($document->_mime != 'text/html' ) {
$strHtml .= $tab.$tab.'<![CDATA['.$lnEnd;
}
$strHtml .= $content.$lnEnd;
// See above note
if ($document->_mime != 'text/html' ) {
$strHtml .= $tab.$tab.'// ]]>'.$lnEnd;
}
$strHtml .= $tab.'</script>'.$lnEnd;
}
foreach($document->_custom as $custom) {
$strHtml .= $tab.$custom.$lnEnd;
}
return $strHtml;
}
[<! removed edit link to red link >] <! removed transcluded page call, red link never existed >
Examples[edit]
<CodeExamplesForm />