Announcement

Collapse
No announcement yet.

Non-JS YahooSections

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Non-JS YahooSections

    Hi All,

    I'd like to implement a non-JavaScript version of the current YahooSections product department links.

    Although the current script can be made more accessible (I have reformatted it to spit out the departments and sub-departments in un-ordered lists and nested unordered lists, then applied CSS), it still relies upon JavaScript compatible browsers and platform, that also have JavaScript enabled!

    Is there any way to recreate this where the departments can be rendered as HTML?

    Thanks,

    Billy

    #2
    You could always use some PHP on the server to read the Act_section_tree.js file and output it as HTML.
    Norman - www.drillpine.biz
    Edinburgh, U K / Bitez, Turkey

    Comment


      #3
      Hey Billy,
      Nowadays most browsers support JS Scripting, so I should not worry too much about it. Browsers like NE4 and Mac IE 5.0 are almost considered dead. However there is the possiblity that you may get some visitors come by your site with security settings on high, causing JS Blocking, in which case (for those very few people) you have the following options

      1. You do a NETQUOTEVAR:INCLUDE in your primary templates and create the sections listing file manually. (easiest)
      Variant: Or create a .net application that connects to the MS Access db and generates a file that contains 1st and 2nd level section listing (a lot tougher).

      2. You create a php script that reads the Act_section_tree.js js file that Norman mentioned and spits out the html equivalent. Ofcourse you will still have to include this someway in your templates. (most elegant solutions)

      - You could do this through server side includes on your store pages, so it would pull that area's data (the section list) from the php file. (requires your server to support SSI -Server Side Includes)
      - Another option is to convert all pages on your catalog to the .php extension and simply include the php script file in the correct location. (not sure how this would affect the weightage from an SE perpective, as I am not sure whether .html files are given a higher weight that .php files; though you could compensate with the .htaccess and mod_rewrite apache mechanism)

      Side note:
      The problem with using Act_section_tree.js is that if you have an extensive catalog, the download time on the first hit is humungous leading to a very frustrated customer. Luckily nowaday browser caching prevents that on subsequent page requests. (Remember, its the first hit from your customer that determins whether he/she remains on your site or not). I am currently designing a product around a schema I have that lets you restrict the depth of section listing to what ever level you want, thus decreasing the download time substantially.
      It should be out on Sure Solutions within the week, if interested. (it relies on a php/apache directive combination)
      Cheers
      Michael Coutinho
      Lead Developer | <a href="http://www.suresolutionsinc.com">Sure Solutions: http://www.suresolutionsinc.com</a>

      Comment


        #4
        I am currently designing a product around a schema I have that lets you restrict the depth of section listing to what ever level you want, thus decreasing the download time substantially
        I wrote a PHP add-on that does just that a few months ago. It also compresses the section tree code by removing redundant strings and shortening variable names.

        A huge site that had a 1.5Mb structure reduced to about 20Kb when restricted to 3 levels only.

        It's quite cunning as it interrogates the Act_section_tree.js and the replacement files dates and only creates the replacement structure if the Actinic file is newer. This hugely reduces server load as the PHP will only run once (for the first visitor) after an Actinic Update.
        Norman - www.drillpine.biz
        Edinburgh, U K / Bitez, Turkey

        Comment


          #5
          Wow, that is crazy. Mine works along similar lines, where it tests creation date to see if its newer than the created file. If not it will simply pass thru the file. However I go a step further where to the actinic designer he/she simply includes the Act_section_tree.js file. This gets redirected to the php file using mod_redirect, which simply pass thru the newly created file, if the creation date condition is satisfied or creates it (on the first visitor on a new uploaded site).
          Cheers
          Michael Coutinho
          Lead Developer | <a href="http://www.suresolutionsinc.com">Sure Solutions: http://www.suresolutionsinc.com</a>

          Comment


            #6
            Rather than using mod_redirect I found a way to trick Actinic into generating and uploading Act_section_tree.js but not in a way that causes the file to be loaded at run time. I use a different named file for the trimmed tree. Also the PHP is run within a JavaScript call - the javascript returned by the PHP is a single line indicating success / failure of the stripping routine.
            Code:
            <!-- trick Actinic into generating (but not loading) Act_section_tree.js
                 NB missing "</script>" below is deliberate -->
            <script language=JavaScript>
            var prunerstatus = '';
            // NETQUOTEVAR:SECTIONTREE_RAW
            <!-- now see if the filepruner server-side script needs to create a pruned tree -->
            <SCRIPT LANGUAGE="JavaScript" SRC="filepruner-3.php" TYPE="text/javascript"></SCRIPT>
            <script language="JavaScript">
            <!--
            if ( prunerstatus.indexOf('Error:') > -1 ) document.write('<b><font color=red>' + prunerstatus + '</font></b>');
            //-->
            var sfile = (location.href.indexOf('PreviewHTML') > -1) ? 'Act' : 'Pruned';
            // now we can load our reduced calorie section tree (or the full one if Previewing)
            document.write('<SCRIPT LANGUAGE="JavaScript" SRC="' + sfile + '_section_tree.js" TYPE="text/javascript"></SCR' + 'IPT>');
            </script>
            Norman - www.drillpine.biz
            Edinburgh, U K / Bitez, Turkey

            Comment

            Working...
            X