T3 Community Discussion & Support

Let's build the best free Joomla template framework, together!
  1. Luke devon
  2. General Discussion
  3. Thursday, 08 August 2013
  4.  Subscribe via email
Hi

I have few third party style sheets and java scripts to be embedded with T3 frame work. I have placed those files in the head.php as follows,

CSS Files

<?php
if(is_file(T3_TEMPLATE_PATH . '/css/sIFR.css')) {
$this->addStyleSheet(T3_TEMPLATE_URL.'/css/sIFR.css');
}
?>

<?php
if(is_file(T3_TEMPLATE_PATH . '/css/slider.css')) {
$this->addStyleSheet(T3_TEMPLATE_URL.'/css/slider.css');
}
?>

<style type="text/css">
<!--
@import url(T3_TEMPLATE_URL.'css/csi.css');
@import url(T3_TEMPLATE_URL.'css/menu.css');
-->
</style>

Java scripts

<script type="text/javascript" src="<?php echo T3_URL ?>/js/sifr.js"></script>
<script type="text/javascript" src="<?php echo T3_URL ?>/js/sifr-config.js"></script>

<script type="text/javascript">
var _lofmain = $('lofslidecontent45');
var _lofscmain = _lofmain.getElement('.lof-main-wapper');
var _lofnavigator = _lofmain.getElement('.lof-navigator-outer .lof-navigator');
var object = new LofFlashContent( _lofscmain,
_lofnavigator,
_lofmain.getElement('.lof-navigator-outer'),
{ fxObject:{ transition:Fx.Transitions.Quad.easeInOut, duration:800},
interval:5000,
direction:'opacity' } );
object.start( true, _lofmain.getElement('.preload') );
</script>

<script type="text/javascript">
var menu=new menu.dd("menu";);
menu.init("menu","menuhover";);
</script>

--------------------------------------------------------------------------------------------------------------------------------------------------------------

But I think some where is wrong . Styles and JS functions are not working. How can I "import url" ( somethig.css ) in to head.php ? How can I pass the path correctly ?
Can I execute javascript functions as I mentioned above in the head.php ?

Please help.

Thanks in advance
Luke.
Comment
There are no comments made yet.
Accepted Answer Pending Moderation
0
Votes
Undo
Hi Luke devon,

As you can see in the head.php (above)

<?php
if(is_file(T3_TEMPLATE_PATH . '/css/slider.css')) {
$this->addStyleSheet(T3_TEMPLATE_URL.'/css/slider.css');
}
?>

Just copy and correct the path to other files.
Joomla provide addStyleSheet, addScript, addScriptDeclaration function, so you should use them.

One other way is use assets.xml. Please check any recent template of JoomlArt to see how to use.

Regards
Comment
There are no comments made yet.
  1. more than a month ago
  2. General Discussion
  3. # 1
Accepted Answer Pending Moderation
0
Votes
Undo
Hi

I just corrected the path to js files, like this

<?php
if(is_file(T3_TEMPLATE_PATH . '/js/slider/lofslidernews.mt11.js')) {
$this->addScript(T3_TEMPLATE_URL.'/js/slider/lofslidernews.mt11.js');
}
?>,

and I used addScriptDeclaration for some java scripts which i want to use for some functions of my slider.

<?php

$this->addScriptDeclaration
('

var _lofmain = $('lofslidecontent45');
var _lofscmain = _lofmain.getElement('.lof-main-wapper');
var _lofnavigator = _lofmain.getElement('.lof-navigator-outer .lof-navigator');
var object = new LofFlashContent( _lofscmain,
_lofnavigator,
_lofmain.getElement('.lof-navigator-outer'),
{ fxObject:{ transition:Fx.Transitions.Quad.easeInOut, duration:800},
interval:5000,
direction:'opacity' } );
object.start( true, _lofmain.getElement('.preload') );');
?>

but now page wont be displayed. May be the way i declared the function is wrong. I have googled a lot and could not find something useful. Could you please help me further ?

Many thanks
Luke.
Comment
There are no comments made yet.
  1. more than a month ago
  2. General Discussion
  3. # 2
Accepted Answer Pending Moderation
0
Votes
Undo
Hi Luke devon,

You should check again your PHP syntax in the addScriptDeclaration function above.
You should escape the string.

T3_TEMPLATE_PATH . '/js/slider/lofslidernews.mt11.js'
=> should map to /templates/your-temp-name/js/slider/lofslidernews.mt11.js

You should check if the file is exist in that folder.

Regards
Comment
There are no comments made yet.
  1. more than a month ago
  2. General Discussion
  3. # 3
  • Page :
  • 1


There are no replies made for this post yet.
However, you are not allowed to reply to this post.