Results 1 to 10 of 29

Hybrid View

  1. #1
    Join Date
    Nov 2010
    Posts
    52
    Plugin Contributions
    0

    Default Re: Using javascript and a separate css for the header.

    tried your first suggestion page went blank (only page background showing)

    Second suggestion just simply did not work. As you can see the page is completely blank with NO CODE AT ALL. Here is the code I uses for the selected_seasonal_image.php file (which is located in /includes/extra_configures)

    Code:
    <?php
    // convert your javascript logic for calculating the right image here
    // and set $selectedSeasonalImage to that image filename as the last thing you do in this file.
    
    
    function disable(){return false}
    function setImgByDate(imgRef,dateList) {
    imgRef.onload = disable;
    var today = new Date();
    var month = 1+today.getMonth();
    if (month<10) month = "0"+month;
    var date = today.getDate();
    if (date<10) date = "0"+date;
    var MMDD = ""+month+date;
    for (var i=0; i<dateList.length; i++) {
    if (MMDD>=dateList[i][0] && MMDD<=dateList[i][1]) {
    imgRef.src = dateList[i][2];
    return;
    }
    }
    }
    
    $selectedSeasonalImage = [
    [ "1025", "1030", "http://www.oceanabyssaquatics.ca/store/includes/templates/abyss/images/logohalow.jpg" ],
    [ "1101", "1111", "http://www.oceanabyssaquatics.ca/store/includes/templates/abyss/images/logoremem.jpg" ],
    [ "1112", "1130", "http://www.oceanabyssaquatics.ca/store/includes/templates/abyss/images/logoautumn.jpg" ],
    [ "1201", "1209", "http://www.oceanabyssaquatics.ca/store/includes/templates/abyss/images/logowinter.jpg" ],
    [ "1210", "1223", "http://www.oceanabyssaquatics.ca/store/includes/templates/abyss/images/logogreetings.jpg" ],
    [ "1224", "1226", "http://www.oceanabyssaquatics.ca/store/includes/templates/abyss/images/logoxmas.jpg" ],
    [ "1227", "1230", "http://www.oceanabyssaquatics.ca/store/includes/templates/abyss/images/logowinter.jpg" ],
    [ "1231", "1231", "http://www.oceanabyssaquatics.ca/store/includes/templates/abyss/images/logonewyear.jpg" ],
    [ "0101", "0103", "http://www.oceanabyssaquatics.ca/store/includes/templates/abyss/images/logonewyear.jpg" ],
    [ "0104", "0206", "http://www.oceanabyssaquatics.ca/store/includes/templates/abyss/images/logowinter.jpg" ],
    [ "0207", "0214", "http://www.oceanabyssaquatics.ca/store/includes/templates/abyss/images/logovalen.jpg" ],
    [ "0215", "0309", "http://www.oceanabyssaquatics.ca/store/includes/templates/abyss/images/logowinter.jpg" ],
    [ "0310", "0317", "http://www.oceanabyssaquatics.ca/store/includes/templates/abyss/images/logostpatty.jpg" ],
    [ "0318", "0319", "http://www.oceanabyssaquatics.ca/store/includes/templates/abyss/images/logowinter.jpg" ],
    [ "0320", "0331", "http://www.oceanabyssaquatics.ca/store/includes/templates/abyss/images/logospring.jpg" ],
    [ "0401", "0401", "http://www.oceanabyssaquatics.ca/store/includes/templates/abyss/images/logofool.jpg" ],
    [ "0402", "0421", "http://www.oceanabyssaquatics.ca/store/includes/templates/abyss/images/logospring.jpg" ],
    [ "0422", "0423", "http://www.oceanabyssaquatics.ca/store/includes/templates/abyss/images/logogood.jpg" ],
    [ "0424", "0425", "http://www.oceanabyssaquatics.ca/store/includes/templates/abyss/images/logoeaster.jpg" ],
    [ "0426", "0523", "http://www.oceanabyssaquatics.ca/store/includes/templates/abyss/images/logospring.jpg" ],
    [ "0524", "0525", "http://www.oceanabyssaquatics.ca/store/includes/templates/abyss/images/logovictor.jpg" ],
    [ "0526", "0620", "http://www.oceanabyssaquatics.ca/store/includes/templates/abyss/images/logospring.jpg" ],
    [ "0621", "0630", "http://www.oceanabyssaquatics.ca/store/includes/templates/abyss/images/logosummer.jpg" ],
    [ "0701", "0702", "http://www.oceanabyssaquatics.ca/store/includes/templates/abyss/images/logocanada.jpg" ],
    [ "0703", "0921", "http://www.oceanabyssaquatics.ca/store/includes/templates/abyss/images/logosummer.jpg" ],
    [ "0922", "1001", "http://www.oceanabyssaquatics.ca/store/includes/templates/abyssimages/logoautumn.jpg" ],
    [ "1002", "1010", "http://www.oceanabyssaquatics.ca/store/includes/templates/abyss/images/logothanks.jpg" ],
    [ "1011", "1024", "http://www.oceanabyssaquatics.ca/store/includes/templates/abyss/images/logoautumn.jpg" ],
    As you can see I used the fullpath to the images in the code (just to be sure.

  2. #2
    Join Date
    Nov 2010
    Posts
    52
    Plugin Contributions
    0

    Default Re: Using javascript and a separate css for the header.

    What next?

  3. #3
    Join Date
    Jan 2004
    Posts
    66,444
    Plugin Contributions
    279

    Default Re: Using javascript and a separate css for the header.

    1. Probably a typo of some sort. Or an error on my part. mismatched quotation marks and apostrophes?
    Reference: https://www.zen-cart.com/tutorials/index.php?article=82

    2. You can't just dump javascript code into a PHP file and have it magically work as PHP. You'll have to rewrite your logic into PHP format.




    Edit: yup, missing apostrophe at the end of my suggested change.
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  4. #4
    Join Date
    Nov 2010
    Posts
    52
    Plugin Contributions
    0

    Default Re: Using javascript and a separate css for the header.

    Quote Originally Posted by DrByte View Post
    1. Probably a typo of some sort. Or an error on my part. mismatched quotation marks and apostrophes?
    Reference: https://www.zen-cart.com/tutorials/index.php?article=82

    2. You can't just dump javascript code into a PHP file and have it magically work as PHP. You'll have to rewrite your logic into PHP format.




    Edit: yup, missing apostrophe at the end of my suggested change.
    Rewriting the logic is completely alien to me

    Like I mentioned before my thing is HTML, XHTML, CSS ...javascript and php are like Chinese to me. I can implement scripts (and I have done so hundreds of times with pre-made scripts). But trying to implement them into a complex language like php is completely foreign.

  5. #5
    Join Date
    Aug 2005
    Location
    Arizona
    Posts
    27,755
    Plugin Contributions
    9

    Default Re: Using javascript and a separate css for the header.

    Like I mentioned before my thing is HTML, XHTML, CSS ...javascript and php are like Chinese to me. I can implement scripts (and I have done so hundreds of times with pre-made scripts). But trying to implement them into a complex language like php is completely foreign.
    Have you has success with this in just a html page??

    Edited:
    I believe that your demo page might have been this??
    Zen-Venom Get Bitten

  6. #6
    Join Date
    Nov 2010
    Posts
    52
    Plugin Contributions
    0

    Default Re: Using javascript and a separate css for the header.

    Quote Originally Posted by kobra View Post
    Have you has success with this in just a html page??

    Edited:
    I believe that your demo page might have been this??
    Yes the demo page shows how it should work. The top part (logo banner with the fall leaves) is the script I am workin on now. The part below is the ad banner (this will eventually be at the very top of the main content column) and uses jquery and 3 js files.

    As you can see from my mockup (demo) page...the design is sound...it's just a matter of implementation into a language I have almost no clue about; namely php.
    Last edited by Tantirx; 26 Nov 2010 at 06:33 AM.

  7. #7
    Join Date
    Aug 2005
    Location
    Arizona
    Posts
    27,755
    Plugin Contributions
    9

    Default Re: Using javascript and a separate css for the header.

    Looking at your 2 pages I did not see alignment in the js being used??
    The ZenCart is using jscript_seasons.js and seasons is not seen on your mockup page??

    If this is square and correct try entering in a COPY for your template in the tpl_header.php file and change from
    Code:
    <!--bof-branding display-->
    <div id="logoWrapper">
        <div id="logo"><?php echo '<a href="' . HTTP_SERVER . DIR_WS_CATALOG . '">' . zen_image($template->get_template_dir(HEADER_LOGO_IMAGE, DIR_WS_TEMPLATE, $current_page_base,'images'). '/' . HEADER_LOGO_IMAGE, HEADER_ALT_TEXT) . '</a>'; ?></div>
    And replace with this and see what results
    Code:
    <!--bof-branding display-->
    <div id="logoWrapper">
        <div id="logo"><a href="http://www.oceanabyssaquatics.ca/store/"><img src="./logo.jpg" onload="setImgByDate(this,holiday)"></div>
    If this works should later add the html ALT entry
    Last edited by kobra; 26 Nov 2010 at 07:00 AM.
    Zen-Venom Get Bitten

  8. #8
    Join Date
    Nov 2010
    Posts
    52
    Plugin Contributions
    0

    Default Re: Using javascript and a separate css for the header.

    Quote Originally Posted by kobra View Post
    Looking at your 2 pages I did not see alignment in the js being used??
    The ZenCart is using jscript_seasons.js and seasons is not seen on your mockup page??

    If this is square and correct try entering in a COPY for your template in the tpl_header.php file tpl_header.php and change from
    Code:
    <!--bof-branding display-->
    <div id="logoWrapper">
        <div id="logo"><?php echo '<a href="' . HTTP_SERVER . DIR_WS_CATALOG . '">' . zen_image($template->get_template_dir(HEADER_LOGO_IMAGE, DIR_WS_TEMPLATE, $current_page_base,'images'). '/' . HEADER_LOGO_IMAGE, HEADER_ALT_TEXT) . '</a>'; ?></div>
    And replace with this and see what results
    Code:
    <!--bof-branding display-->
    <div id="logoWrapper">
        <div id="logo"><a href="http://www.oceanabyssaquatics.ca/store/"><img src="./logo.jpg" onload="setImgByDate(this,holiday)"></div>
    If this works should later add the html ALT entry
    Yes the js file names are different on the mockup page. I renamed them based on the tutorials for adding js to ZC . The js on the mockup page was called holiday.js the code is identical.

  9. #9
    Join Date
    Jan 2004
    Posts
    66,444
    Plugin Contributions
    279

    Default Re: Using javascript and a separate css for the header.

    Quote Originally Posted by Tantirx View Post
    Rewriting the logic is completely alien to me

    Like I mentioned before my thing is HTML, XHTML, CSS ...javascript and php are like Chinese to me. I can implement scripts (and I have done so hundreds of times with pre-made scripts). But trying to implement them into a complex language like php is completely foreign.
    Fine.
    Use the corrected code I posted for approach #1, and live with the consequences of using javascript to accomplish what you're after.
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

 

 

Similar Threads

  1. v154 Need a javascript expert! Can't trigger css class using href...
    By Feznizzle in forum General Questions
    Replies: 10
    Last Post: 27 May 2016, 05:45 PM
  2. Loss of CSS styles images and main header logo on SSL when using the server's browser
    By oldwolfe in forum Installing on a Linux/Unix Server
    Replies: 1
    Last Post: 13 Oct 2009, 02:13 PM
  3. Using Separate Image for Shopping Cart Header
    By Craig Robbo in forum Templates, Stylesheets, Page Layout
    Replies: 2
    Last Post: 5 Feb 2009, 11:06 AM
  4. Using a CSS Navigation Menu for the top NAV bar
    By spikeycactus in forum Templates, Stylesheets, Page Layout
    Replies: 8
    Last Post: 30 Oct 2008, 10:59 AM

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