My favorites | Sign in
Project Home Downloads Wiki Issues Source
Search
for
soscontentMethAddHeadContent  
This method adds items for the head section of HTML.
Updated Dec 1, 2011 by sosensible

Introduction

The top section of a web page has <head>...</head> sections. This method captures content targeted at that section of the page. This will most often be either JavaScript or CSS content items.

Details

(check COOP:CSS/Script tags for use case example) Add your content here. Format your content with:

  • Text in bold or italic
  • Headings, paragraphs, and lists
  • Automatic links to other wiki pages

Inside custom tags (we do this in COOP) we use the argument collection to pass things into the object method.

root.coop.sosContent.addHeadContent(argumentCollection:attributes);

Outside custom tags we tend to use named methods like the following examples.

CSS Examples

CSS Include

sosContent.addHeadContent(
  id : 'page_remote_css',
  type : 'CSS',
  src : '../css/my.css'
);

CSS Predifined

sosContent.addHeadContent( id : "jQueryUI_css" );

CSS Inline

sosContent.addHeadContent(
  id : 'page_css',
  type : 'CSS',
  value : '<style>
#myForm input{ width:400px; }
</style>'
);

Yes we could have put much more CSS content in here but we were shooting to keep it simple and just illustrate.

JS Example

v

sosContent.addHeadContent(
  id : 'page_remote_js',
  type : 'JS',
  src : '../js/my.js'
);

JS Predifined

sosContent.addHeadContent( id : "jQueryUI" );

JS Inline

sosContent.addHeadContent(
  id : 'page_js',
  type : 'JS',
  after : 'jQuery',
  value : '<script>
alert("This page has been loaded.");
</script>'
);

see getHeadCSSContent(), getHeadJSContent() for information about how to pull this content back out.


Sign in to add a comment
Powered by Google Project Hosting