Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
F
flexslider
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
hebotek
flexslider
Commits
fdc2b94e
Commit
fdc2b94e
authored
Apr 21, 2012
by
Andy Hausmann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Revised the view helper calls and optimized them. Added option to move JS to the page footer.
parent
1774b11d
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
125 additions
and
35 deletions
+125
-35
AddCssJsViewHelper.php
Classes/ViewHelpers/AddCssJsViewHelper.php
+69
-0
AddFileViewHelper.php
Classes/ViewHelpers/AddFileViewHelper.php
+0
-28
AddJQueryViewHelper.php
Classes/ViewHelpers/AddJQueryViewHelper.php
+51
-5
constants.txt
Configuration/TypoScript/constants.txt
+2
-0
setup.txt
Configuration/TypoScript/setup.txt
+1
-0
List.html
Resources/Private/Templates/FlexSlider/List.html
+2
-2
No files found.
Classes/ViewHelpers/AddCssJsViewHelper.php
0 → 100644
View file @
fdc2b94e
<?php
/***************************************************************
* Copyright notice
*
* (c) 2012 Andy Hausmann <hi@andy-hausmann.de>
*
* All rights reserved
*
* This script is part of the TYPO3 project. The TYPO3 project is
* free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* The GNU General Public License can be found at
* http://www.gnu.org/copyleft/gpl.html.
*
* This script is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/
/**
*
* A view helper for adding CSS and JS files to teh frontend.
*
* This helper needs to be called once per file.
* It is not possible to add multiple files via array or such, yet.
*
* = Examples =
*
* <code title="Single argument">
* <fs:AddCssJs file="path/to/file.ext" />
* </code>
* <output>
* </output>
*
* @package flexslider
* @license http://www.gnu.org/licenses/gpl.html GNU General Public License, version 3 or later
*/
class
Tx_Flexslider_ViewHelpers_AddCssJsViewHelper
extends
Tx_Fluid_Core_ViewHelper_AbstractTagBasedViewHelper
{
/**
* Adds JS and CSS to the frontend
*
* @param string $file
* @param bool $moveToFooter
* @return void Flag to include file into footer - doesn't work for CSS files
*/
public
function
render
(
$file
=
NULL
,
$moveToFooter
=
FALSE
)
{
if
(
$file
)
{
// Get file extension (after last occurance of a dot)
$mediaTypeSplit
=
strrchr
(
$file
,
'.'
);
Tx_Flexslider_Utility_Div
::
addCssJsFile
(
$file
,
(
$mediaTypeSplit
==
'.js'
)
?
'flexSliderJs'
:
'flexSliderCss'
,
$moveToFooter
);
}
}
}
?>
\ No newline at end of file
Classes/ViewHelpers/AddFileViewHelper.php
deleted
100644 → 0
View file @
1774b11d
<?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
Classes/ViewHelpers/AddJQueryViewHelper.php
View file @
fdc2b94e
<?php
<?php
class
Tx_Flexslider_ViewHelpers_AddJQueryViewHelper
extends
Tx_Fluid_Core_ViewHelper_AbstractTagBasedViewHelper
{
/***************************************************************
* Copyright notice
*
* (c) 2012 Andy Hausmann <hi@andy-hausmann.de>
*
* All rights reserved
*
* This script is part of the TYPO3 project. The TYPO3 project is
* free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* The GNU General Public License can be found at
* http://www.gnu.org/copyleft/gpl.html.
*
* This script is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/
/**
*
* A view helper for adding jQuery to the frontend.
*
* = Examples =
*
* <code title="Single argument">
* <fs:AddJQuery altJQueryFile="path/to/alternativeJQueryFile.js" />
* </code>
* <output>
* </output>
*
* @package flexslider
* @license http://www.gnu.org/licenses/gpl.html GNU General Public License, version 3 or later
*/
class
Tx_Flexslider_ViewHelpers_AddJQueryViewHelper
extends
Tx_Fluid_Core_ViewHelper_AbstractTagBasedViewHelper
{
/**
/**
* Adds T3Jquery as Lib
* Adds T3Jquery as Lib
...
@@ -11,7 +51,6 @@ class Tx_Flexslider_ViewHelpers_AddJQueryViewHelper extends Tx_Fluid_Core_ViewHe
...
@@ -11,7 +51,6 @@ class Tx_Flexslider_ViewHelpers_AddJQueryViewHelper extends Tx_Fluid_Core_ViewHe
* @param string $altJQueryFile
* @param string $altJQueryFile
* @return void
* @return void
*/
*/
public
function
render
(
$altJQueryFile
=
NULL
)
{
public
function
render
(
$altJQueryFile
=
NULL
)
{
// checks if t3jquery is loaded
// checks if t3jquery is loaded
if
(
t3lib_extMgm
::
isLoaded
(
't3jquery'
))
{
if
(
t3lib_extMgm
::
isLoaded
(
't3jquery'
))
{
...
@@ -23,9 +62,16 @@ class Tx_Flexslider_ViewHelpers_AddJQueryViewHelper extends Tx_Fluid_Core_ViewHe
...
@@ -23,9 +62,16 @@ class Tx_Flexslider_ViewHelpers_AddJQueryViewHelper extends Tx_Fluid_Core_ViewHe
}
else
{
}
else
{
if
(
$altJQueryFile
)
{
if
(
$altJQueryFile
)
{
$fileRef
=
$GLOBALS
[
'TSFE'
]
->
tmpl
->
getFileName
(
$altJQueryFile
);
Tx_Flexslider_Utility_Div
::
addCssJsFile
(
$GLOBALS
[
'TSFE'
]
->
additionalHeaderData
[
'flexSliderJQuery'
]
=
$altJQueryFile
,
'<script src="'
.
$fileRef
.
'" type="text/javascript"></script>'
;
'flexSliderJQuery'
);
}
else
{
Tx_Flexslider_Utility_Div
::
renderFlashMessage
(
'jQuery not loaded'
,
'jQuery could not be loaded. Please check the path to the alternative jQuery library or simply use the Extension t3jquery.'
,
t3lib_FlashMessage
::
ERROR
);
}
}
}
}
}
}
...
...
Configuration/TypoScript/constants.txt
View file @
fdc2b94e
...
@@ -19,6 +19,8 @@ plugin.tx_flexslider {
...
@@ -19,6 +19,8 @@ plugin.tx_flexslider {
jQuery = EXT:flexslider/Resources/Public/Js/jquery-min.js
jQuery = EXT:flexslider/Resources/Public/Js/jquery-min.js
# String: File reference to flexslider library
# String: File reference to flexslider library
flexslider = EXT:flexslider/Resources/Public/Js/jquery.flexslider-min.js
flexslider = EXT:flexslider/Resources/Public/Js/jquery.flexslider-min.js
# Bool: Flag to define whether the script shoul be moved to the footer or not
moveToFooter = 0
}
}
}
}
}
}
\ No newline at end of file
Configuration/TypoScript/setup.txt
View file @
fdc2b94e
...
@@ -12,6 +12,7 @@ plugin.tx_flexslider {
...
@@ -12,6 +12,7 @@ plugin.tx_flexslider {
lib {
lib {
jQuery = {$plugin.tx_flexslider.settings.lib.jQuery}
jQuery = {$plugin.tx_flexslider.settings.lib.jQuery}
flexslider = {$plugin.tx_flexslider.settings.lib.flexslider}
flexslider = {$plugin.tx_flexslider.settings.lib.flexslider}
moveToFooter = {$plugin.tx_flexslider.settings.lib.moveToFooter}
}
}
# String: Select your animation type, "fade" or "slide"
# String: Select your animation type, "fade" or "slide"
animation = fade
animation = fade
...
...
Resources/Private/Templates/FlexSlider/List.html
View file @
fdc2b94e
...
@@ -7,8 +7,8 @@
...
@@ -7,8 +7,8 @@
<f:flashMessages
/>
<f:flashMessages
/>
<fs:AddJQuery
altJQueryFile=
"{settings.lib.jQuery}"
/>
<fs:AddJQuery
altJQueryFile=
"{settings.lib.jQuery}"
/>
<fs:Add
File
file=
"{settings.lib.flexslid
er}"
/>
<fs:Add
CssJs
file=
"{settings.lib.flexslider}"
moveToFooter=
"{settings.lib.moveToFoot
er}"
/>
<fs:Add
File
file=
"{settings.css}"
/>
<fs:Add
CssJs
file=
"{settings.css}"
/>
<script
type=
"text/javascript"
>
<script
type=
"text/javascript"
>
<!
[
CDATA
[
<!
[
CDATA
[
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment