PassMark Logo
Home » Forum

Announcement

Collapse
No announcement yet.

changing from asp to cgi

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

  • changing from asp to cgi

    Hi

    I am in the process of developing a search facility for a business directory. We have over 200,000 company pages that will need to be indexed.

    The search results need to be customised, as each result item may differ from the other depending if the results shows a paid for company listing or a free company listing...the difference being a paid for listing will show an image of their company logo and the free one will not.

    I orginally achieved this using a METAIMAGE field and editing the search.asp script. The Meta field would show if it was a paid for lisiting and wouldn't show if it is a free listing. I also used Custom META fields for the Company ID, Company Website and Company Name which all needed to be shown in the search results.

    Now I need to use .cgi as I didn't realise there is a 63000 page limit using .asp. The trouble is I have no .cgi coding experience and am unsure how to customise the results layout like I did for the .asp.

    Can anyone help me achieve what I want with cgi?

    Kind regards

  • #2
    ok,

    so ive kind of figured out i need to be using xml with the cgi..

    This is an example of the page as it stands...

    http://www.ogbit.com/dynamic/search/search_results.asp?zoom_sort=0&zoom_query=peter&zo om_per_page=100


    the trouble is it doesn't seem to be picking up on the xsl file i created.

    The XSLT URL is

    http://www.ogbit.com/dynamic/search/template.xsl

    Is this the correct format..any ideas what I am doing wrong? The documention for this subject is pretty vague

    Comment


    • #3
      Originally posted by pieman1981 View Post
      The search results need to be customised, as each result item may differ from the other depending if the results shows a paid for company listing or a free company listing...the difference being a paid for listing will show an image of their company logo and the free one will not.

      I orginally achieved this using a METAIMAGE field and editing the search.asp script. The Meta field would show if it was a paid for lisiting and wouldn't show if it is a free listing. I also used Custom META fields for the Company ID, Company Website and Company Name which all needed to be shown in the search results.
      I presume you mean the ZOOMIMAGE meta tag.

      From your description alone of your requirements, there's no need to modify "search.asp" to achieve any of the above requirements. But I suspect there's more that you mentioned that you wanted to change? Such as more radical layout changes? It's worth pointing out that CSS and the "Advanced Template" tags can go a long way though.

      Do you have an example of the layout you are trying to achieve?

      Originally posted by pieman1981 View Post
      so ive kind of figured out i need to be using xml with the cgi..

      This is an example of the page as it stands...

      http://www.ogbit.com/dynamic/search/search_results.asp?zoom_sort=0&zoom_query=peter&zo om_per_page=100

      the trouble is it doesn't seem to be picking up on the xsl file i created.

      The XSLT URL is

      http://www.ogbit.com/dynamic/search/template.xsl

      Is this the correct format..any ideas what I am doing wrong? The documention for this subject is pretty vague
      One big reason why it's not picking up your XSL file is because you have declared the page as HTML at the top of the output from your "search_results.asp" script ("View source" on that page). Your DOCTYPE and everything else is telling the browser to treat it as XHTML and not XML.

      It's a bit hard to document what you can do with the XML output because you can essentially do anything with it. The option is really there for more experienced developers. You could parse the XML tree one node at a time and render your output based on the values. Using XSL is just another possibility, there is no one way to handle XML data.

      Having said that, if there is enough interest from users to learn about applying XSL to transform Zoom's XML output, we could get around to writing a tutorial one day. But it's one of those things: most people who don't know how to use it wouldn't need it (and the normal customization options are better methods for them), while those who do know what it is and how to use it, wouldn't need a bare basics tutorial. But like I said, if there's enough interest, we'll try to spare the time.
      --Ray
      Wrensoft Web Software
      Sydney, Australia
      Zoom Search Engine

      Comment


      • #4
        Thanks for your reply..

        Am I right in thinking that a temporary xml file is created each time a new search is performed?

        What was trying to explain (very badly) is that each item of the search result may have different content. For example, if the company has a website stored in the database it will show the website, if it has a logo (as per a check in the database) it will show that etc. For those companies that dont have either of these it wont show.

        Not sure the best way to do this

        Comment


        • #5
          Originally posted by pieman1981 View Post
          Am I right in thinking that a temporary xml file is created each time a new search is performed?
          No. There is no XML file ever created on disk. It is XML formated output which is sent to "stdout". When you execute a CGI or any process from a script, you can typically capture and process this output.

          Originally posted by pieman1981 View Post
          What was trying to explain (very badly) is that each item of the search result may have different content. For example, if the company has a website stored in the database it will show the website, if it has a logo (as per a check in the database) it will show that etc. For those companies that dont have either of these it wont show.
          Alot of this can be done through Zoom settings.

          For example, you can associate an image with a page by use of the ZOOMIMAGE meta tag, as described here:
          Q. How do I associate a thumbnail with a particular page?

          In context of your situation, this would mean that you would insert this tag on the "paid for" company listing. I'm not sure if your listing is a link to the client's website or if it is a page on your own website (e.g. you have a classifieds website with a page per client). If it is the former, and you don't control the content on your client's page, you could potentially use offline .desc files to do this.

          I just realized I mentioned this tag already, but you never confirmed if that's what you are already doing. It's all a bit confusing lacking the context of what you are doing.

          It's still not clear what you were customizing the search.asp script to do that it was previously not able to do.

          By default, it already only shows images or custom meta field content only if it exists. If it doesn't exist for a page, it doesn't show it.
          --Ray
          Wrensoft Web Software
          Sydney, Australia
          Zoom Search Engine

          Comment


          • #6
            Hi,

            The company pages are pages on our website. The problem is that these company pages are static HTML templates that have been created dynamically from database content. In an ideal world, I would would have had a simple piece of asp logic that would only show the ZOOMIMAGE tag on the company page if the company was a paid for client (known by reading the database). However, seeing as these files are static HTML files, I am unable to put any asp in the page, so would have to put the ZOOMIMAGE tag on every page, which would result in layout breakage for some result items.

            I am currently trying to use an asp function similar to to http://www.w3schools.com/xsl/xsl_server.asp that reads the XML produced and transform it with an XSL file. However, am unsure how to read the XML as it is produced in a file anywhere.

            Have tried creating a variable like
            templateXML = (oExec.StdOut.ReadAll())
            but am unsure how to load it into a function that can transform it.

            Do you know of any code snippets anywhere that would help?

            thanks for your help ray

            Comment


            • #7
              So what I have done is created an xml file for each search, prob not the best way of doing but it works!

              my next question is is it possible to use :

              <!--ZOOM_SHOW_SUGGESTION-->
              <!--ZOOM_SHOW_PAGENUMBERS-->

              when using xml / cgi?

              Comment


              • #8
                Originally posted by pieman1981 View Post
                The company pages are pages on our website. The problem is that these company pages are static HTML templates that have been created dynamically from database content. In an ideal world, I would would have had a simple piece of asp logic that would only show the ZOOMIMAGE tag on the company page if the company was a paid for client (known by reading the database). However, seeing as these files are static HTML files, I am unable to put any asp in the page, so would have to put the ZOOMIMAGE tag on every page, which would result in layout breakage for some result items.
                It's hard to imagine how you plan to manage such a website (you mentioned over 200,000 pages) without a database. To be honest, it would really make sense to do so. Changing something right now across the website must be a nightmare, and you must be really restricted.

                I don't know how many "paid" listings you already have, but I am assuming you are inferring to the idea that it is not possible to manually insert a ZOOMIMAGE meta tag on each paid listing. But it just seems to me, that you must have some process to allow you to change a business from being a normal listing to a paid listing, and in doing so, I would've imagined there might be some flexibility to change that page (e.g. it might have a special icon or layout for the page to indicate they are a premium listing).

                If not that, you also implied you had scripting to check if a listing is sponsored. You could use this same scripting to code something that actually modifies the static HTML pages and insert the meta tags as necessary. That, to me, would make the most sense even if you don't want to take on the task of converting your website to a dynamically driven one.

                Originally posted by pieman1981 View Post
                I am currently trying to use an asp function similar to to http://www.w3schools.com/xsl/xsl_server.asp that reads the XML produced and transform it with an XSL file. However, am unsure how to read the XML as it is produced in a file anywhere.

                Have tried creating a variable like
                templateXML = (oExec.StdOut.ReadAll())
                but am unsure how to load it into a function that can transform it.

                Do you know of any code snippets anywhere that would help?
                You are misunderstanding how XML and XSL works. XSL transformations are performed by the browser. The server simply sends the XML to the client, the XML contains reference to an XSL file, and the browser will then render the page according to this.

                This also doesn't really relate to the primary problem here. For your requirement, you would need to parse the XML data, and insert images for the nodes which match your paid entries. If you are going this far, you might as well just output the HTML as required directly, as opposed to appending to the XML data and relying on XSL to transform its presentation.

                Frankly, this method is not really the most sensible choice for the problem at hand, and I would have to say, the former recommendations of inserting ZOOMIMAGE tags (programmatically or manually) is much more appropriate.

                Originally posted by pieman1981 View Post
                my next question is is it possible to use :

                <!--ZOOM_SHOW_SUGGESTION-->
                <!--ZOOM_SHOW_PAGENUMBERS-->

                when using xml / cgi?
                No, they're not part of the XML output. The idea is that XML is the raw result set, these are merely presentation features. When you are using the raw set is when you want to post-process and present your results any way you see fit. If you need such features, you would code your own to say "if results < 3 and user is searching within a category, suggest searching without a category", and the XML data contains the number of results, etc. to do this. Likewise with the page numbers, it is up to you how you paginate the results. It would make no sense for the XML data to say "this is the pagination of results", when you may then take the data and manipulate it such that it is no longer true.
                --Ray
                Wrensoft Web Software
                Sydney, Australia
                Zoom Search Engine

                Comment

                Working...
                X