Announcement

Collapse
No announcement yet.

Has anybody hacked SearchScript.pl...

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

    Has anybody hacked SearchScript.pl...

    ...or the script that generates the lists used in the JavaScriptArrayLayout selectors?

    Why?
    Because I want to use UTF-8 encoding so that all the fancy chars in my product and section names show up properly!

    Oh dear, why don't they show up?
    Because somewhere in the SearchScript.pl, and presumably somewhere in some other script that generates the Act_sections.js, Act_section_tree.js and other 'JavaArray' code snippets, there is a call to a function to 'html-ify' the text of section names and product names.

    That sounds good tho' - turning all the £ signs to & pound ;'s etc makes the text more generic doesn't it?
    ONLY if the html-ification is done in the context of the correct character encoding!

    Sorry, I'm from Actinic Support, you've lost me...
    OK - if we assume all encodings use one byte per character, then simply reading a byte and deciding whether it needs converting to an html entity would be painless and only require a single byte:->htmlified value lookup table.

    BUT, this is the modern world, and it is the brilliance of the UTF-8 encoding that allows it to provide almost the full range of unicode chars without embedding nulls in strings and without screwing up the normal ascii collation order - the only price we pay for this is that there are sometimes more than a single byte to represent a character.

    So this is what happens - the simple translation takes two and three byte sequences and converts each byte individually to html entities, which is how they end up being displayed by a browser, as individual entites from the ISO-8859-1 ascii character set.

    So - I just want to get in there and modify the scripts that generate the section lists and the search results and STOP the brain-dead attempt at htmification of the multi-byte sequences!

    Anybody know how I can do that?

    #2
    I just want to get in there and modify the scripts that generate the section lists and the search results and STOP the brain-dead attempt at htmification of the multi-byte sequences
    You can create your own JavaScript arrays - see the Advanced Guide "Advanced v8 List Functionality" Just put something in your overall layout that uses the EntireSectionList and wrap it in a condition so the code only runs once (e.g. SectionId==1). Switch to PHP and you can write files into Site1 that are subsequently uploaded.

    As for SearchScript.pl all the source of all the Perl is there.

    Although, personally, I think you'll turn up a lot of new problems trying to make Actinic into something it isn't.
    Norman - www.drillpine.biz
    Edinburgh, U K / Bitez, Turkey

    Comment


      #3
      Thanks Norman,

      I will take a look at that Advanced List stuff - I heed your warning too about trying to do this but I'm afraid I have no real choice as my data comes from another source. Still, it'll all be good character building stuff!

      Oh - also I should apologise in general for making a slight joke at the expense of Actinic Support - I have in fact had a good few problems either sorted out by those good people or at least I have been pointed in the right direction, sorry folks and keep up the good work

      Comment


        #4
        Am i being a bit dim now...

        ... cos I can't see where it explains how to generate my own JavaScript arrays, it just tells me how to manipulate the ones already prepared.

        I'd love to be able to do it in PHP, don't mind doing it in JavaScript, would prefer not to touch perl - but I don't know how to iterate over the database tables to get at the 'raw' section and product names.

        Maybe this is all a bit too much

        Comment


          #5
          You cannot do this in JavaScript. JS has no capability to write files. You have to use PHP to write a JS file and later you can use that in your pages.

          You make a block based on EntireSectionList. Then everything within that block gets repeatedly executed for each Section. You use PHP to open a file outside the block and write lines to it from within.

          E.g. (pseudo code)

          If HOME PAGE
          {
          Open file
          <block ENTIRE SECTION LIST>
          $name = <SECTION NAME>;
          $link = <SECTION LINK>;
          write <a href="$link">$name</a>;
          </block>
          Close file
          }
          Norman - www.drillpine.biz
          Edinburgh, U K / Bitez, Turkey

          Comment


            #6
            See http://community.actinic.com/showthread.php?t=24497 (post #7) for an example of creating a Site Map. If you changed this to write JS to a file you'd be close.
            Norman - www.drillpine.biz
            Edinburgh, U K / Bitez, Turkey

            Comment

            Working...
            X