Page 1 of 2 12 LastLast
Results 1 to 10 of 15
  1. #1
    Join Date
    Feb 2006
    Posts
    235
    Plugin Contributions
    1

    New page with scripts in header

    I would like to add a new page to zen cart. List the link to it in my more info box.
    The new page I would like to add needs some scripts to be placed in the header of the page..
    Could this be acomplished with ez-pages?
    What would be the best way to do this ?

  2. #2
    Join Date
    Feb 2006
    Posts
    235
    Plugin Contributions
    1

    Default Re: New page with scripts in header

    I woudl like to incorporate this effect on one of my extra pages...

    http://www.dhtmlgoodies.com/scripts/...ent-slide.html

    The script requires an entry in the head of the document...
    Can this be done ?
    www.planetebio.net - Eat Right Feel Good !

  3. #3
    Join Date
    May 2004
    Location
    Hong Kong
    Posts
    1,291
    Plugin Contributions
    1

    Default Re: New page with scripts in header

    For JavaScript only, there is a doc in the default install of Zen Cart.
    In your installed Zen Cart, pleae refer to the file of:
    docs/read_me_jscript.html

    .
    A New Starter again

  4. #4
    Join Date
    Feb 2006
    Posts
    235
    Plugin Contributions
    1

    Default Re: New page with scripts in header

    Thanks for pointing in the right direction...
    :)
    www.planetebio.net - Eat Right Feel Good !

  5. #5
    Join Date
    Feb 2006
    Posts
    235
    Plugin Contributions
    1

    Default Re: New page with scripts in header

    Wow great...was able to get it going...

    need this portion:

    "Initialize show content
    You can automatically expand content when the pages load. This is done by calling the showHideContent function manually. Example:

    <script type="text/javascript">
    showHideContent(false,1); // Automatically expand first item
    </script>

    This will automatically show the first item."

    I tried as on_load_.js did not work

    Tried as <?php echo '<script type="text/javascript">
    initShowHideDivs();
    showHideContent(false,1); // Automatically expand first item
    </script>' ?> ...did not work...

    Any suggestions on were I'm going wrong ?
    www.planetebio.net - Eat Right Feel Good !

  6. #6
    Join Date
    May 2004
    Location
    Hong Kong
    Posts
    1,291
    Plugin Contributions
    1

    Default Re: New page with scripts in header

    For the use of JavaScript in Zen Cart, the basic is to strip both of the header and footer of the normal JavaScript.
    And in the body of your jscript_YOUR_JS.js OR on_load_YOUR_JS.js should only contain the JavaScript code's main body.
    e.g.
    The normal JavaScript code file should contain:
    Code:
    <script type="text/javascript">
    ...
    THE CODE BODY 
    ...
    </script>
    And for use in Zen Cart, only the code body should only be contained:
    Code:
    ...
    THE CODE BODY 
    ...
    And no header and footer are needed, because Zen Cart will handle the rest.

    You can check the results by viewing of the web page source.
    1. To check wether it loaded in the header or not, for the jscript_YOUR_JS.js
    2. For the on_load, if it loaded, it will also show with the JavaScript codes.


    If you use the browser Firefox, get the extension FireBug to help.

    What is it?
    FireBug lets you explore the far corners of the DOM by keyboard or mouse. All of the tools you need to poke, prod, and monitor your JavaScript, CSS, HTML and Ajax are brought together into one seamless experience, including a debugger, error console, command line, and a variety of fun inspectors.
    A New Starter again

  7. #7
    Join Date
    Feb 2006
    Posts
    235
    Plugin Contributions
    1

    Default Re: New page with scripts in header

    Thanks, I did strip out the <script> tags.....

    if i view source on the http://www.dhtmlgoodies.com/scripts/...ent-slide.html the script type="text/javascript">
    initShowHideDivs();
    showHideContent(false,1); // Automatically expand first item
    </script> code is in the body...

    if I try on_load.js = showHideContent(false,1); will not work..

    I tried on the define_page2"<?php echo '<script type="text/javascript">
    initShowHideDivs();
    showHideContent(false,1); // Automatically expand first item
    </script>' ?>" ...did not work...

    PS I just started using Firefox....will install FireBug , Thanks
    www.planetebio.net - Eat Right Feel Good !

  8. #8
    Join Date
    May 2004
    Location
    Hong Kong
    Posts
    1,291
    Plugin Contributions
    1

    Default Re: New page with scripts in header

    For example,
    with refer to your page source, there are a jscript_imagehover.js already loaded.

    HTML Code:
    <script type="text/javascript" src="includes/templates/template_default/jscript/jscript_imagehover.js"></script>
    </head>
    This is for the jscript_YOUR_JS.js things, it load before the </head>


    And for the on_load things, the page source look like something below:
    HTML Code:
    </head>
    
    <body id="indexBody" onload="function(){
    //   var t=new Date().getTime();
      RUZEE.Borders.render();
    //   alert('took ' + (new Date().getTime()-t) + ' ms');
    };">
    
    <div id="mainWrapper">
    It load after the </head>
    Do you notice the different?

    .
    A New Starter again

  9. #9
    Join Date
    May 2004
    Location
    Hong Kong
    Posts
    1,291
    Plugin Contributions
    1

    Default Re: New page with scripts in header

    Add more info. for time out of editing for the above post.

    The on_laod load after the </head> tag and inside the <body> and </body> tag.


    Do you notice the different?
    A New Starter again

  10. #10
    Join Date
    Feb 2006
    Posts
    235
    Plugin Contributions
    1

    Default Re: New page with scripts in header

    I just tried
    on_load_page2.js:
    showHideContent(false,1);
    Seems fine in IE but not in firefox...
    www.planetebio.net - Eat Right Feel Good !

 

 
Page 1 of 2 12 LastLast

Similar Threads

  1. Create new page with different look? (no header, sidebox, etc)
    By Cindy2010 in forum Templates, Stylesheets, Page Layout
    Replies: 2
    Last Post: 12 Jan 2011, 08:45 AM
  2. Adding New Pages with PHP scripts
    By High Flyin' Ryan in forum Customization from the Admin
    Replies: 2
    Last Post: 14 Dec 2010, 09:18 PM
  3. Missing files in upload thru Simple Scripts New install
    By kachinas in forum Templates, Stylesheets, Page Layout
    Replies: 3
    Last Post: 17 Jan 2009, 06:53 PM
  4. Replies: 6
    Last Post: 15 Jun 2008, 04:17 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR