Jump to content

Recommended Posts

Posted

Hi,

 

Sorry if this is the wrong place.

 

I would like to put two scripts on to one webpage but i'm new to scripting and don't understand how to do it. If i just copy them one after the other i get errors and the slider displays the slides below each other as if they aren't in a slider, if i take script 2 out the slider then works.

 

Script 1

 



                 define(IMAGE1,'slide1.jpg');// default width 550px height 300px /
                 define(IMAGE2,'slide2.jpg');
                 define(IMAGE3,'slide3.jpg');
                 define(IMAGE4,'slide4.jpg');
                 define(IMAGE5,'slide5.jpg');
         define(IMAGE6,'slide6.jpg');
         define(IMAGE7,'slide7.jpg');

                 define(URL1,'');
                 define(URL2,'');
                 define(URL3,'');
                 define(URL4,'');
                 define(URL5,'');
         define(URL6,'');
         define(URL7,'');


               
?>
               

               <br />
<br />
                                $(document).ready(function(){ <br />
                        $("#slider").easySlider()}<br />
                                auto: true,<br />
                                continuous: true,<br />
                                numeric: true<br />
                };<br />
});           <br />
                
 

               
                               
                                                                                                      
                                                               <?php  echo $template->get_template_dir('',DIR_WS_TEMPLATE, $current_page_base,'images').'/'.IMAGE1 ?>
                                                               <?php  echo $template->get_template_dir('',DIR_WS_TEMPLATE, $current_page_base,'images').'/'.IMAGE2 ?>
                                                               <?php  echo $template->get_template_dir('',DIR_WS_TEMPLATE, $current_page_base,'images').'/'.IMAGE3 ?> 
                                                               <?php  echo $template->get_template_dir('',DIR_WS_TEMPLATE, $current_page_base,'images').'/'.IMAGE4 ?>
                                                               <?php  echo $template->get_template_dir('',DIR_WS_TEMPLATE, $current_page_base,'images').'/'.IMAGE5 ?>        
                               <?php echo $template->get_template_dir('',DIR_WS_TEMPLATE, $current_page_base,'images').'/'.IMAGE6 ?>
                               <?php echo $template->get_template_dir('',DIR_WS_TEMPLATE, $current_page_base,'images').'/'.IMAGE7 ?>                        
                                               
                               

 

Script 2

 



//<![CDATA[<br />
  cookieControl({<br />
      introText:'<p>This site uses some unobtrusive cookies to store information on your computer.',<br />
      fullText:'<p>Some cookies on this site are essential, and the site will not work as expected without them. These cookies are set when you submit a form, login or interact with the site by doing something that goes beyond clicking on simple links.<br><br>We also use some non-essential cookies to anonymously track visitors or enhance your experience of the site. If youre not happy with this, we wont set these cookies but some nice features of the site may be unavailable.<br><br>By using our site you accept the terms of our <a href="">Privacy Policy.',<br />
      position:'left', // left or right<br />
      shape:'diamond', // triangle or diamond<br />
      theme:'light', // light or dark<br />
      startOpen:true,<br />
      autoHide:6000,<br />
      subdomains:true,<br />
      onAccept:function(){ccAddAnalytics()},<br />
      onReady:function(){},<br />
      onCookiesAllowed:function(){ccAddAnalytics()},<br />
      onCookiesNotAllowed:function(){},<br />
      countries:'United Kingdom' // Or supply a list ['United Kingdom', 'Greece']<br />
      });<br />
<br />
      function ccAddAnalytics() {<br />
        jQuery.getScript("", function() {<br />
          var GATracker = _gat._createTracker('');<br />
          GATracker._trackPageview();<br />
        });<br />
      }<br />
   //]]><br />
 

 

What i have a the minute

 


Contact Sales On:*(0191) 460 6613



                 define(IMAGE1,'slide1.jpg');// default width 550px height 300px /
                 define(IMAGE2,'slide2.jpg');
                 define(IMAGE3,'slide3.jpg');
                 define(IMAGE4,'slide4.jpg');
                 define(IMAGE5,'slide5.jpg');
         define(IMAGE6,'slide6.jpg');
         define(IMAGE7,'slide7.jpg');

                 define(URL1,'');
                 define(URL2,'');
                 define(URL3,'');
                 define(URL4,'');
                 define(URL5,'');
         define(URL6,'');
         define(URL7,'');


               
?>
               

               <br />
<br />
                                $(document).ready(function(){ <br />
                        $("#slider").easySlider()}<br />
                                auto: true,<br />
                                continuous: true,<br />
                                numeric: true<br />
                };<br />
});           <br />
                
 

               
                               
                                                                                                      
                                                               <?php  echo $template->get_template_dir('',DIR_WS_TEMPLATE, $current_page_base,'images').'/'.IMAGE1 ?>
                                                               <?php  echo $template->get_template_dir('',DIR_WS_TEMPLATE, $current_page_base,'images').'/'.IMAGE2 ?>
                                                               <?php  echo $template->get_template_dir('',DIR_WS_TEMPLATE, $current_page_base,'images').'/'.IMAGE3 ?> 
                                                               <?php  echo $template->get_template_dir('',DIR_WS_TEMPLATE, $current_page_base,'images').'/'.IMAGE4 ?>
                                                               <?php  echo $template->get_template_dir('',DIR_WS_TEMPLATE, $current_page_base,'images').'/'.IMAGE5 ?>        
                               <?php echo $template->get_template_dir('',DIR_WS_TEMPLATE, $current_page_base,'images').'/'.IMAGE6 ?>
                               <?php echo $template->get_template_dir('',DIR_WS_TEMPLATE, $current_page_base,'images').'/'.IMAGE7 ?>                        
                                               
                               



//<![CDATA[<br />
  cookieControl({<br />
      introText:'<p>This site uses some unobtrusive cookies to store information on your computer.',<br />
      fullText:'<p>Some cookies on this site are essential, and the site will not work as expected without them. These cookies are set when you submit a form, login or interact with the site by doing something that goes beyond clicking on simple links.<br><br>We also use some non-essential cookies to anonymously track visitors or enhance your experience of the site. If youre not happy with this, we wont set these cookies but some nice features of the site may be unavailable.<br><br>By using our site you accept the terms of our <a href="">Privacy Policy.',<br />
      position:'left', // left or right<br />
      shape:'diamond', // triangle or diamond<br />
      theme:'light', // light or dark<br />
      startOpen:true,<br />
      autoHide:6000,<br />
      subdomains:true,<br />
      onAccept:function(){ccAddAnalytics()},<br />
      onReady:function(){},<br />
      onCookiesAllowed:function(){ccAddAnalytics()},<br />
      onCookiesNotAllowed:function(){},<br />
      countries:'United Kingdom' // Or supply a list ['United Kingdom', 'Greece']<br />
      });<br />
<br />
      function ccAddAnalytics() {<br />
        jQuery.getScript("", function() {<br />
          var GATracker = _gat._createTracker('');<br />
          GATracker._trackPageview();<br />
        });<br />
      }<br />
   //]]><br />
 

 

Again sorry for not fully understanding this any help would be great.

 

Kenny

Posted

It's important you understand the script if you want to use it. I've helped a lot of people who have tried to do something the easy way but when a problem occurs you're stuck in the mud. It would be really beneficial to learn what the code is doing.

 

From what I can see, you are not declaring standard html tags? This is a first. Also keep in mind that PHP is executed by the server - and JavaScript by the Browser - so sometimes you must change the order of your code. Keep all functional PHP at the top of the page (declaring, queries, etc). You also need to keep that in mind when passing JS data to PHP (which often times is a headache for a new coder)

 

<?php

...

?>

 

 

...

...

 

(Declare doctype also!)

 

Code like "$template->get_template_dir", do you even know what this is trying to pull?

You also have "" down near the bottom of the page. Why are you using the opening and closing javascript tags there?

 

JavaScript Where To => This is a good explanation of where to put JS depending on the function.

  • Thanks 1
Posted
Because functions are called lower on down the page (in the case of Script 1 AND especially Script 2) place them in the head tags, then call/reference them in the body tag.
Posted

I would also recommend (if this is for a client) using CSS rather than inline styles, and not using span altogether (at least how you are). span and html font tags are considered depreciated.

 

This will give you a uniformed look to each element using a particular CSS class and more control over global font types, sizes, colors, etc. Post if you need any more help!

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...