PassMark Logo
Home » Forum

Announcement

Collapse
No announcement yet.

category new window / same window

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

  • category new window / same window

    hi

    im using categories now since i find them really now i had a taste of it

    but what i miss is the option to have some pages pop up and some pages go into the same window

    example:

    categorie
    pages
    pdf files

    for the category pages i want it to go into the same window when they click the link....

    for the category pdf files i want a new page to pop up

    not using frames, right now i only see the option: to pop-up or not to pop-up

    in the future could there be an option for this?
    If i think as i thought, i will do as i did and if i do what i did i will think as i thought....

  • #2
    That's the first time we've had that request, and it seems to be a pretty rare requirement.... we'll consider it if there's more demand for it.

    However, if you're using either the PHP, ASP or Javascript version, you can achieve this by customizing the search script. You will require some familiarity with the scripting language in question however (and should note that support for customized script is limited).
    --Ray
    Wrensoft Web Software
    Sydney, Australia
    Zoom Search Engine

    Comment


    • #3
      rare people come with rare requests ;D

      i am familiair with php scripting, so if there is no demand in a short time i will look into customising the search.php script for my request
      If i think as i thought, i will do as i did and if i do what i did i will think as i thought....

      Comment


      • #4
        since im impatient and like to solve problems myself too, i just went ahead and made a quick way for getting what i want.....


        Code:
        $popups = array("pdf", "xls", "doc");
        while &#40;$arrayline < $matches && $arrayline < $result_limit&#41;
        &#123;
            $ipage = $output&#91;$arrayline&#93;&#91;0&#93;;
            $score = $output&#91;$arrayline&#93;&#91;1&#93;;
        
        	$tempaddress = explode&#40;"/", $urls&#91;$ipage&#93;&#41;;
        	$tempcount = count&#40;$tempaddress&#41;;
        	$tempfile = $tempaddress&#91;$tempcount-1&#93;;
            $tempsplit = explode&#40;".", $tempfile&#41;;
            $extensie = substr&#40;$tempsplit&#91;1&#93;, 0, 3&#41;; 
        	
        	if &#40;in_array&#40;$extensie, $popups&#41;&#41; 
        	&#123; 
        	 $target="target=\"_blank\"";
        	&#125;
        	else
        	 $target = "";
        	
            print "
        
        </p>\n";
        i defined an array with extensions for wich i want the link to get a new window, i defined this BEFORE the while loop....
        this is called $popups

        then i took the full url as passed to the link itself and exploded it on the /
        called $tempaddress

        i counted the exploded items ($tempcount) and passed the last item ($tempcount - 1) to the $tempfile

        to get the extension of the file i exploded the file on the .

        since i use dynamic content with php global variables wich would extend the extention of the url with ?id=1&... and so on i took the substring of the extension (wich i got out of $tempsplit[1]) and read the first 3 positions from the extension so the rest of the url that would be there isnt read

        now i got the extension pure


        with the IF construction i check with the in_array function if the extension is in the array....
        if the extension is in the array then i give the zoom variable $target a value (in this case target="_blank") to open a new window. If its not in the array then the target variable will be empty.


        since the zoom dudes are clever and allow the full string of the target to be set instead of only the value it is also possible to put in javascript popup windows instead of the target blank option



        the code might be made cleaner tho
        If i think as i thought, i will do as i did and if i do what i did i will think as i thought....

        Comment


        • #5
          and here is an example with a javascript popup
          the javascript code is defined in an external javascript file so u have to have that function made yourself.....


          Code:
          	if &#40;in_array&#40;$extensie, $popups&#41;&#41; 
          	&#123; 
          	 $link1="<a href=\"#\" onClick=\"openWindow&#40;'".rtrim&#40;$urls&#91;$ipage&#93;&#41;."'&#41;\"" . $target . ">";
          	&#125;
          	else
          	 $link1 ="<a href=\"".rtrim&#40;$urls&#91;$ipage&#93;&#41;."\"" . $target . ">";
          	
              print "
          
          </p>\n";
          
              print "<div class=\"result_title\">";
              if &#40;$DisplayNumber == 1&#41;
                  print "[b]".&#40;$arrayline+1&#41;.".[/b]";
          
              if &#40;$DisplayTitle == 1&#41;
              &#123;
                  print $link1;
                  if &#40;$Highlighting == 1&#41;
                      PrintHighlightDescription&#40;rtrim&#40;$titles&#91;$ipage&#93;&#41;&#41;;
                  else
                      print rtrim&#40;$titles&#91;$ipage&#93;&#41;;
                  print "</a>";
              &#125;
              else
                  print $link1.rtrim&#40;$urls&#91;$ipage&#93;&#41;."</a>";
          If i think as i thought, i will do as i did and if i do what i did i will think as i thought....

          Comment


          • #6
            Thanks for posting those tips. It might be useful for someone else trying to do the same thing.
            --Ray
            Wrensoft Web Software
            Sydney, Australia
            Zoom Search Engine

            Comment


            • #7
              same thoughts here, thats y i posted
              If i think as i thought, i will do as i did and if i do what i did i will think as i thought....

              Comment


              • #8
                wnoordhoek,

                I like the concept of your php script very much since my site if categorised into HTML pages and PDFs.

                ? Could you explain a bit more on where in a typical search.php you would insert your additional code.

                Meantime, on a similar topic, my categories are HTML and PDF and I wanted to replace the category name shown with each result with an icon for the file type.

                Having put a pdf.gif and html.gif file in my search folder, I added the following to my version of search.php.

                if ($UseCats)
                {
                $catindex = rtrim($catpages[$ipage]);
                // Mark: Insert Category Icons
                if (rtrim($catnames[$catindex]) == "PDF")
                { print " <span class=\"category\"> <img src=\"pdf.gif\"> ". rtrim($catnames[$catindex]) . "</span>"; }
                else {
                if (rtrim($catnames[$catindex]) == "HTML")
                { print " <span class=\"category\"> <img src=\"html.gif\"> ". rtrim($catnames[$catindex]) . "</span>"; }
                else {
                print " <span class=\"category\">". rtrim($catnames[$catindex]) . "</span>"; }
                }
                } print "</div>\n";

                I'm sure it could be done much better as I'm only a code tweaker rather than programmer but the effect was as required.
                Mark Gallagher

                Comment


                • #9
                  ... and for a bit more fun, I accompanied the PDF category results with a filesize measure. May need adjusting based on the relative path between your PHP search page and the indexed files.


                  if ($UseCats)
                  {
                  $catindex = rtrim($catpages[$ipage]);
                  // Mark: Insert Category Icons
                  // Mark: PDF Icon and file size.
                  if (rtrim($catnames[$catindex]) == "PDF")
                  { print " <span class=\"category\"> <img src=\"pdf.gif\"> ". rtrim($catnames[$catindex]);
                  $filepath = "..".rtrim($urls[$ipage]);
                  $filesize = filesize($filepath);
                  if ($filesize >= 1048576) { $filesize = number_format(($filesize / 1048576),2) . "MB"; }
                  elseif ($filesize >= 1024) { $filesize = number_format(($filesize / 1024),0) . "KB"; }
                  elseif ($filesize >= 0) { $filesize = $filesize . "Bytes"; }
                  print " ".$filesize."</span>";
                  }
                  // Mark: HTML Icon.
                  else {
                  if (rtrim($catnames[$catindex]) == "HTML")
                  { print " <span class=\"category\"> <img src=\"html.gif\"> ". rtrim($catnames[$catindex]) . "</span>"; }
                  else { print " <span class=\"category\">". rtrim($catnames[$catindex]) . "</span>"; }
                  }
                  }
                  print "</div>\n";


                  if ($DisplayMetaDesc == 1)
                  Mark Gallagher

                  Comment


                  • #10
                    @sizbut i will use the javascript example i made in this example, for the reason that it has a complete url in the variable......



                    Code:
                    $popups = array&#40;"pdf", "xls", "doc"&#41;;
                    while &#40;$arrayline < $matches && $arrayline < $result_limit&#41;
                    &#123;
                      $ipage = $output&#91;$arrayline&#93;&#91;0&#93;;
                      $score = $output&#91;$arrayline&#93;&#91;1&#93;;
                    
                      $tempaddress = explode&#40;"/", $urls&#91;$ipage&#93;&#41;;
                      $tempcount = count&#40;$tempaddress&#41;;
                      $tempfile = $tempaddress&#91;$tempcount-1&#93;;
                      $tempsplit = explode&#40;".", $tempfile&#41;;
                      $extensie = substr&#40;$tempsplit&#91;1&#93;, 0, 3&#41;; 
                    	
                      if &#40;in_array&#40;$extensie, $popups&#41;&#41; 
                      &#123; 
                        $link1="<a href=\"#\" onClick=\"openWindow&#40;'".rtrim&#40;$urls&#91;$ipage&#93;&#41;."'&#41;\"" . $target . ">";
                      &#125;
                      else
                       $link1 ="<a href=\"".rtrim&#40;$urls&#91;$ipage&#93;&#41;."\"" . $target . ">";
                    	
                      print "
                    
                    </p>\n";
                    in my code i do not touch anything else then the things u see posted by me, so the parts that u editted yourself (in your postings) i didnt touch


                    ok here ill go giving it a try
                    as u can see i have an array called popups containing the extensions from the documents that i have categorised in xoom search for wich i want the pop ups...

                    in the while loop u will see me exploding a few times (the php variant :P)

                    the end result is that in the variable $extensie i got the extension of the current link file (either doc/pdf/xls).....

                    so there u have an extension on wich u can base an img

                    u can play it 2 ways now.... u name the images like: pdf.gif doc.gif or whatever format u use.... but use the file type as name like in the $popups array and the $extensie is used....

                    u then (in my javascript example) can do something like:

                    Code:
                      if &#40;in_array&#40;$extensie, $popups&#41;&#41; 
                      &#123; 
                        $link1="<img src=\"./images/$extensie.gif\" align=\"left\"><a href=\"#\" onClick=\"openWindow&#40;'".rtrim&#40;$urls&#91;$ipage&#93;&#41;."'&#41;\"" . $target . ">";
                      &#125;
                      else
                       $link1 ="<img src=\"./images/standard.gif\" align=\"left\"><a href=\"".rtrim&#40;$urls&#91;$ipage&#93;&#41;."\"" . $target . ">";

                    as u can see in the first part of the if construction i used
                    <img src=\"./images/$extensie.gif\" align=\"left\">
                    i hooked the image with the $extensie variable wich means that the image is always shown as the document type that u got

                    in the other part i put in standard.gif that is the link that u use for normal links


                    and another thing....
                    the size estimate that u do i figure u can do that in the part where i do the explodes.... instead of inside the category things which u posted
                    u can put that in the first part of my if loop where i also use the $extensie variable for the image source.....


                    i hope this explanation is a bit what u wanted to see



                    *!*!*!*!* this is user editing in search.php wrensoft does NOT support this in any way as i understood, nor will i support it... im just giving examples
                    If i think as i thought, i will do as i did and if i do what i did i will think as i thought....

                    Comment


                    • #11
                      Cheers wnoordhoek, looks like I have some studying to do this weekend.

                      My PHP is already very different from the ZoomSearch original so I accept I deep into own risk territory.
                      Mark Gallagher

                      Comment


                      • #12
                        Solution for CGI

                        I checked the new version 6 of Zoom Search but it seems there is no new feature for this kind of demand.
                        I use the cgi/win32-platform. How can I achive to open doc, xls, pdf in new window ?

                        Comment


                        • #13
                          One of the new V6 features is an option to "Open all plugin file formats in a new window" so that you can have HTML files open in the same window, and PDF files open in a new window. In V4 and V5 all documents open in the same window, or they all open in a new window. You can activate this via check box on the "Scan options" configuration window.

                          Comment

                          Working...
                          X