diff options
author | Craig Andrews <candrews@integralblue.com> | 2009-08-05 19:35:42 -0400 |
---|---|---|
committer | Craig Andrews <candrews@integralblue.com> | 2009-08-05 19:35:42 -0400 |
commit | 6a76addbe8bbfafd1a1dd6ed7ffbf8afebff5abe (patch) | |
tree | 8d33dda21111bf73bb5462d5b691d9431672e715 | |
parent | feac024348e0584c84fd5392c503d912000d30bc (diff) |
Added cssLink() and script() functions to htmloutputter
-rw-r--r-- | lib/htmloutputter.php | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/lib/htmloutputter.php b/lib/htmloutputter.php index 5da1fbe14..0b4c1405a 100644 --- a/lib/htmloutputter.php +++ b/lib/htmloutputter.php @@ -340,6 +340,42 @@ class HTMLOutputter extends XMLOutputter } /** + * output a script (almost always javascript) tag + * + * @param string $src relative or absolute script path + * @param string $type 'type' attribute value of the tag + * + * @return void + */ + function script($src, $type='text/javascript') + { + $this->element('script', array('type' => $type, + 'src' => common_path($src) . '?version=' . LACONICA_VERSION), + ' '); + } + + /** + * output a css link + * + * @param string $relative relative path within the theme directory + * @param string $theme 'theme' that contains the stylesheet + * @param string media 'media' attribute of the tag + * + * @return void + */ + function cssLink($relative,$theme,$media) + { + if (!$theme) { + $theme = common_config('site', 'theme'); + } + + $this->element('link', array('rel' => 'stylesheet', + 'type' => 'text/css', + 'href' => theme_path($relative, $theme) . '?version=' . LACONICA_VERSION, + 'media' => $media)); + } + + /** * output an HTML textarea and associated elements * * @param string $id element ID, must be unique on page |