Page 1 of 2 12 LastLast
Results 1 to 10 of 13

Thread: category new window / same window

  1. #1
    Join Date
    Feb 2005
    Posts
    31

    Default 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. #2
    Join Date
    Dec 2004
    Location
    Sydney, Australia
    Posts
    3,573

    Default

    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

  3. #3
    Join Date
    Feb 2005
    Posts
    31

    Default

    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....

  4. #4
    Join Date
    Feb 2005
    Posts
    31

    Default

    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....

  5. #5
    Join Date
    Feb 2005
    Posts
    31

    Default

    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 "".&#40;$arrayline+1&#41;.".";
    
        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....

  6. #6
    Join Date
    Dec 2004
    Location
    Sydney, Australia
    Posts
    3,573

    Default

    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

  7. #7
    Join Date
    Feb 2005
    Posts
    31

    Default

    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....

  8. #8
    Join Date
    Jan 2005
    Location
    Great Britain
    Posts
    56

    Default

    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

  9. #9
    Join Date
    Jan 2005
    Location
    Great Britain
    Posts
    56

    Default

    ... 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

  10. #10
    Join Date
    Feb 2005
    Posts
    31

    Default

    @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....

Similar Threads

  1. Results page in new window
    By Tony in forum Zoom Search Engine V4 (Old Version)
    Replies: 3
    Last Post: 10-25-2005, 08:35 AM
  2. Window Position and Size
    By SShipe in forum Zoom Search Engine V4 (Old Version)
    Replies: 2
    Last Post: 07-08-2005, 03:49 AM
  3. Launching a search in a new window
    By Anonymous in forum Zoom Search Engine V4 (Old Version)
    Replies: 1
    Last Post: 03-15-2005, 09:27 PM
  4. New window if search button is pressed
    By Anonymous in forum Zoom Search Engine V4 (Old Version)
    Replies: 1
    Last Post: 01-19-2005, 10:06 PM
  5. New window or not?
    By tj in forum Zoom Search Engine V4 (Old Version)
    Replies: 1
    Last Post: 01-12-2005, 06:50 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •