WebsiteBaker Logo
  • *
  • Templates
  • Help
  • Add-ons
  • Download
  • Home
*
Welcome, Guest. Please login or register.

Login with username, password and session length
 

News


WebsiteBaker 2.13.9 is now available!


R.I.P Dietmar (luisehahne) and thank you for all your valuable work for WB
https://forum.websitebaker.org/index.php/topic,32355.0.html


* Support WebsiteBaker

Your donations will help to:

  • Pay for our dedicated server
  • Pay for domain registration
  • and much more!

You can donate by clicking on the button below.


  • Home
  • Help
  • Search
  • Login
  • Register

  • WebsiteBaker Community Forum »
  • WebsiteBaker Support (2.8.x) »
  • jQuery »
  • Implementing jQuery
  • Print
Pages: [1]   Go Down

Author Topic: Implementing jQuery  (Read 10095 times)

mahalleday

  • Guest
Implementing jQuery
« on: November 02, 2009, 04:52:41 AM »
I am trying to spice up my show_menu2 menu with some jquery I have called jquery.js and my menu.js sctipts in the head section of my template as follows.

Code: [Select]
<head>
<!--Start of Dynamic Head Contnet-->
<title><?php page_title(); ?></title>
<meta http-equiv="Content-Type" content="text/html; charset=<?php if(defined(&#39;DEFAULT_CHARSET&#39;)) { echo DEFAULT_CHARSET; } else { echo &#39;utf-8&#39;; }?>" />
<meta name="description" content="<?php page_description(); ?>" />
<meta name="keywords" content="<?php page_keywords(); ?>" />
<link rel="stylesheet" type="text/css" href="<?php echo TEMPLATE_DIR; ?>/screen.css" media="screen" />
<script type="text/javascript" src="jquery.js" />
<script type="text/javascript" src="menu.js" />
<?php
// automatically include optional WB module files (frontend.css, frontend.js)
    
if (function_exists(&#39;register_frontend_modfiles&#39;)) {
        
register_frontend_modfiles(&#39;css&#39;);
        
register_frontend_modfiles(&#39;js&#39;);
    
}
?>

<!--End of Dynamic Head Content-->
</head>

The problem  I am having is that the template is not rendered at all.  If i place the call the the js files to be above where I call the register frontend mod files functions the template renders but the module css files aren't included.

Logged

Offline crnogorac081

  • Posts: 2168
  • Gender: Male
Re: Implementing jQuery
« Reply #1 on: November 02, 2009, 09:29:46 AM »
Hi,

in your code, jquery.js and menu.js are placed in your root.. are they ? if they are not, you must use <?php echo TEMPLATE_DIR; ?> or <?php echo WB_URL; ?>/ folder / folder / ...  / ... / to define the path to these java scripts..

cheers
Logged
Web developer

aldus

  • Guest
Re: Implementing jQuery
« Reply #2 on: November 02, 2009, 09:33:55 AM »
Hello

Well - the <script>-tag can't be written in the "short" [xhtml-|xml-] form - so the "normal" //close//-tag is needed.*)
e.g.
Code: [Select]
<script type="text/javascript" src="<?php echo TEMPLATE_DIR; ?>/jquery.js" ></script>
<script type="text/javascript" src="<?php echo TEMPLATE_DIR; ?>/menu.js" ></script>

Also, as crnogorac081 described, the (whole?) complete path to the scripts ...

Kind regards
Aldus

*) http://www.w3.org/TR/html4/interact/scripts.html#h-18.2
18.2.1 ff.
[...]Start tag: required, End tag: required[...]
« Last Edit: November 02, 2009, 10:17:33 AM by aldus »
Logged

mahalleday

  • Guest
Re: Implementing jQuery
« Reply #3 on: November 03, 2009, 03:27:50 AM »
It was the closing script tag.  I can't believe I would forget something so simple.  Thanks
Logged

  • Print
Pages: [1]   Go Up
  • WebsiteBaker Community Forum »
  • WebsiteBaker Support (2.8.x) »
  • jQuery »
  • Implementing jQuery
 

  • SMF 2.0.19 | SMF © 2017, Simple Machines
  • XHTML
  • RSS
  • WAP2