Commit 39de5e0b authored by Andy Hausmann's avatar Andy Hausmann

Added t3jquery support and ViewHelper to add stuff to the Page Renderer.

parent 57053a84
<?php
class Tx_Flexslider_ViewHelpers_AddFileViewHelper extends Tx_Fluid_Core_ViewHelper_AbstractTagBasedViewHelper {
/**
* Adds JS
*
* @param string $file
* @return void
*/
public function render($file = NULL) {
$mediaTypeSplit = strrchr($file, '.');
$fileRef = $GLOBALS['TSFE']->tmpl->getFileName($file);
if ($fileRef) {
if ($mediaTypeSplit == '.js') {
$GLOBALS['TSFE']->additionalHeaderData['flexSliderJs'] = '<script src="' . $fileRef . '" type="text/javascript"></script>';
}
elseif ($mediaTypeSplit == '.css') {
$GLOBALS['TSFE']->additionalHeaderData['flexSliderCss'] =
'<link rel="stylesheet" type="text/css" media="all" href="' . $fileRef . '" />';
}
}
}
}
?>
\ No newline at end of file
<?php
class Tx_Flexslider_ViewHelpers_AddJQueryViewHelper extends Tx_Fluid_Core_ViewHelper_AbstractTagBasedViewHelper {
/**
* Adds T3Jquery as Lib
*
* If T3Jquery is available, it adds it's script file(s)
* Otherwise, it includes the script of this Ext.
*
* @param string $altJQueryFile
* @return void
*/
public function render($altJQueryFile = NULL) {
// checks if t3jquery is loaded
if (t3lib_extMgm::isLoaded('t3jquery')) {
require_once(t3lib_extMgm::extPath('t3jquery').'class.tx_t3jquery.php');
}
// if t3jquery is loaded and the custom Library had been created
if (T3JQUERY === true) {
tx_t3jquery::addJqJS();
} else {
if ($altJQueryFile) {
$fileRef = $GLOBALS['TSFE']->tmpl->getFileName($altJQueryFile);
$GLOBALS['TSFE']->additionalHeaderData['flexSliderJQuery'] =
'<script src="' . $fileRef . '" type="text/javascript"></script>';
}
}
}
}
?>
\ No newline at end of file
This diff is collapsed.
script=Resources/Public/Js/jquery.flexslider-min.js
components=jQuery,Core
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment