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....
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).
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....
since im impatientand like to solve problems myself too, i just went ahead and made a quick way for getting what i want.....
i defined an array with extensions for wich i want the link to get a new window, i defined this BEFORE the while loop....Code:$popups = array("pdf", "xls", "doc"); while ($arrayline < $matches && $arrayline < $result_limit) { $ipage = $output[$arrayline][0]; $score = $output[$arrayline][1]; $tempaddress = explode("/", $urls[$ipage]); $tempcount = count($tempaddress); $tempfile = $tempaddress[$tempcount-1]; $tempsplit = explode(".", $tempfile); $extensie = substr($tempsplit[1], 0, 3); if (in_array($extensie, $popups)) { $target="target=\"_blank\""; } else $target = ""; print " </p>\n";
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....
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 (in_array($extensie, $popups)) { $link1="<a href=\"#\" onClick=\"openWindow('".rtrim($urls[$ipage])."')\"" . $target . ">"; } else $link1 ="<a href=\"".rtrim($urls[$ipage])."\"" . $target . ">"; print " </p>\n"; print "<div class=\"result_title\">"; if ($DisplayNumber == 1) print "".($arrayline+1)."."; if ($DisplayTitle == 1) { print $link1; if ($Highlighting == 1) PrintHighlightDescription(rtrim($titles[$ipage])); else print rtrim($titles[$ipage]); print "</a>"; } else print $link1.rtrim($urls[$ipage])."</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....
Thanks for posting those tips. It might be useful for someone else trying to do the same thing.
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....
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
... 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
@sizbut i will use the javascript example i made in this example, for the reason that it has a complete url in the variable......
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 touchCode:$popups = array("pdf", "xls", "doc"); while ($arrayline < $matches && $arrayline < $result_limit) { $ipage = $output[$arrayline][0]; $score = $output[$arrayline][1]; $tempaddress = explode("/", $urls[$ipage]); $tempcount = count($tempaddress); $tempfile = $tempaddress[$tempcount-1]; $tempsplit = explode(".", $tempfile); $extensie = substr($tempsplit[1], 0, 3); if (in_array($extensie, $popups)) { $link1="<a href=\"#\" onClick=\"openWindow('".rtrim($urls[$ipage])."')\"" . $target . ">"; } else $link1 ="<a href=\"".rtrim($urls[$ipage])."\"" . $target . ">"; print " </p>\n";
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 (in_array($extensie, $popups)) { $link1="<img src=\"./images/$extensie.gif\" align=\"left\"><a href=\"#\" onClick=\"openWindow('".rtrim($urls[$ipage])."')\"" . $target . ">"; } else $link1 ="<img src=\"./images/standard.gif\" align=\"left\"><a href=\"".rtrim($urls[$ipage])."\"" . $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....