2.635 views
Nee hoor zover ik het weet niet.
http://www.phpclub.nl/searchplugin/ om ze te instaleren. Ik moet alleen die instal script werkend krijgen...
http://www.phpclub.nl/searchplugin/ om ze te instaleren. Ik moet alleen die instal script werkend krijgen...
Je had ook gelijk de stylesheet mogen meekopieren :-)
Dit is de source van mijn pagina:
<?php //http://impasto.nl/schoolkrant/search.php?r=0&t=all&q=qqqqqqqqqqq
$idx = new searchplugin();
class searchplugin {
var $out = "";
var $searchpluginbase = "http://impasto.nl/schoolkrant/searchplugin/";
var $searchplugins = array();
var $title = 'The Hype Searchplugins';
//-------------------------------------------
// @constructor
//-------------------------------------------
function searchplugin() {
if ($this->isIE()) {
$this->IE();
$this->exit_it();
}
$this->searchplugins['The Hype Forum'] = array('searchpluginsrc' => 'TheHypeForum',
'searchpluginpic' => 'TheHypeForum.png',
'searchpluginname' => 'The Hype Forum',
'searchplugindesc' => 'Hiermee voeg je de zoekmachine '.
'van The Hype Forum toe aan je '.
'(Firefox) browser.',
);
$this->searchplugins['The Hype Website'] = array('searchpluginsrc' => 'TheHypeWebsite',
'searchpluginpic' => 'TheHypeWebsite.png',
'searchpluginname' => 'The Hype Website',
'searchplugindesc' => 'Hiermee voeg je de zoekmachine '.
'van The Hype Website toe aan je '.
'(Firefox) browser.',
);
include('SearchPluginTemplate.tpl.php');
$this->out = $template->page_header($this->title, $this->searchpluginbase);
$i = 0;
foreach ($this->searchplugins as $plugintitle => $info) {
if ( !$this->checkplugin(array($plugintitle => $info)) ) {
continue;
}
$this->out .= $template->plugin_row($plugintitle, $info);
$i++;
}
if ($i == 0) {
$this->out .= $template->no_plugins();
}
$this->out .= $template->page_footer();
$this->exit_it();
}
function isIE() {
if (stristr($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== false) {
return true;
}
return false;
}
function IE() {
include('SearchPluginMSIE.tpl.php');
$this->out = $template->SorryNoIE($this->title);
}
function exit_it() {
$this->SendRequiredHeaders();
echo $this->out;
exit(0);
}
function SendRequiredHeaders() {
$headers = array();
$h = &$headers;
$s = implode(' ', $_SERVER);
$h['application/xhtml+xml'] = 'Content-type: application/xhtml+xml;charset=utf-8';
$h[] = 'Expires: Mon, 26 Jul 1997 05:00:00 GMT';
$h[] = 'Last-Modified: '.gmdate("D, d M Y H:i:s").' GMT';
$h[] = 'Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0';
$h[] = 'Pragma: no-cache';
foreach ($h as $req => $header) {
if (!is_numeric($req) && !stristr($s, $req)) {
continue;
}
header($header);
}
}
function checkplugin($plugin) {
if (count($plugin) != 1) {
return false;
}
$reqkeys = array('searchplugindesc', 'searchpluginpic', 'searchpluginname', 'searchpluginsrc');
foreach($plugin as $plugintitle => $info) {
if (!is_string($plugintitle)) {
return false;
}
foreach($reqkeys as $rk) {
if (!array_key_exists($rk, $info)) {
return false;
}
}
}
return true;
}
} //einde class
?>
Template:
<?php
$template = new template;
class template {
function page_header($title, $base_url) {
return <<<EOF
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" >
<head>
<title>
{$title}
</title>
<script type="text/javascript">
<!--//-->
<![CDATA[//>
<!--
function addEngine(src, img, naam, cat) {
if ((typeof window.sidebar == "object") && (typeof window.sidebar.addSearchEngine == "function")) {
//cat="Web";
//cat=prompt("In what category should this engine be installed?","Web")
window.sidebar.addSearchEngine(
"{$base_url}"+src+".src",
"{$base_url}"+img,
naam,
naam );
} else {
alert("Jouw browser ondersteunt geen Search Plugins");
}
}
//-->
//<!]]>
</script>
<style type="text/css">
#container {
margin: 2px;
margin-top: 1px !important;
padding: 10px;
width: 450px;
font-family: verdana, Arial, sans-serif;
font-size: 14px;
color: #000000;
background-color: #FCFCFC;
border: 1px dashed #CCCCCC;
}
#tabletitle {
display: block;
border: 0px dotted #000000;
border-bottom-width: 1px;
font-weight: bold;
font-size: 19px;
padding: 2px;
margin: 2px;
color: #000000;
margin-bottom: 5px;
}
#tablefooter {
display: block;
border: 0px dotted #CFCFCF;
border-top-width: 1px;
font-style: italic;
font-size: 11px;
color: gray;
padding: 2px;
padding-left: 1px;
padding-right: 1px;
margin: 2px;
margin-top: 5px;
}
table {
border: 0px;
}
td {
padding-left: 1px;
}
td.nothing {
padding: 0px;
margin: 0px;
}
input {
background-color: #FCFCFC;
border: 1px dashed #CCCCCC;
}
input:focus {
background-color: #FCFCFC;
border: 1px dashed gray;
}
a.searchplugin {
font-color: #000000;
font-size: 17px;
}
.searchplugindesc {
font-color: #000000;
font-size: 12px;
font-style: italic;
}
</style>
</head>
<body>
<div id="container">
<table>
<tr>
<td class="nothing">
<span id="tabletitle">{$title}</span>
</td>
</tr>
EOF;
}
function plugin_row($plugintitle, $info) {
return <<<EOF
<tr>
<td>
<a href="#" onclick="addEngine('{$info['searchpluginsrc']}','{$info['searchpluginpic']}', '{$info['searchpluginname']}', 'The Hype AM');" class="searchplugin">
{$plugintitle}
</a><br />
<span class="searchplugindesc">
{$info['searchplugindesc']}
</span>
</td>
</tr>
EOF;
}
function no_plugins() {
return <<<EOF
<tr>
<td>
<span style="font-color: #FF0000;font-weight:bold;display: block;">
Foutje
</span>
<span style="font-color: #FF0000;display: block;">
Sorry, maar het lijkt erop dat er nu geen plugins beschikbaar zijn.
</span>
</td>
</tr>
EOF;
}
function page_footer() {
return <<<EOF
<tr>
<td class="nothing">
<span id="tablefooter">
<span style="font-weight: bold">Deïnstallatie instructies:</span><br />
Ga naar je Firefox profiel map, bij de normale Firefox 1.x meestal te vinden in
C:\Documents and Settings\????\Application Data\Mozilla\Firefox\Profiles\default.????,
ga naar de 'searchplugins' map en verwijder de bestanden 'TheHypeForum.src', 'TheHypeWebsite.src', 'TheHypeForum.png' en 'TheHypeWebsite.png'.
Start Firefox opnieuw op and it's done! :-)
</span>
</td>
</tr>
</table>
</div>
</body>
</html>
EOF;
}
}
?>
Werkt als een trein :-)
Dit is de source van mijn pagina:
<?php //http://impasto.nl/schoolkrant/search.php?r=0&t=all&q=qqqqqqqqqqq
$idx = new searchplugin();
class searchplugin {
var $out = "";
var $searchpluginbase = "http://impasto.nl/schoolkrant/searchplugin/";
var $searchplugins = array();
var $title = 'The Hype Searchplugins';
//-------------------------------------------
// @constructor
//-------------------------------------------
function searchplugin() {
if ($this->isIE()) {
$this->IE();
$this->exit_it();
}
$this->searchplugins['The Hype Forum'] = array('searchpluginsrc' => 'TheHypeForum',
'searchpluginpic' => 'TheHypeForum.png',
'searchpluginname' => 'The Hype Forum',
'searchplugindesc' => 'Hiermee voeg je de zoekmachine '.
'van The Hype Forum toe aan je '.
'(Firefox) browser.',
);
$this->searchplugins['The Hype Website'] = array('searchpluginsrc' => 'TheHypeWebsite',
'searchpluginpic' => 'TheHypeWebsite.png',
'searchpluginname' => 'The Hype Website',
'searchplugindesc' => 'Hiermee voeg je de zoekmachine '.
'van The Hype Website toe aan je '.
'(Firefox) browser.',
);
include('SearchPluginTemplate.tpl.php');
$this->out = $template->page_header($this->title, $this->searchpluginbase);
$i = 0;
foreach ($this->searchplugins as $plugintitle => $info) {
if ( !$this->checkplugin(array($plugintitle => $info)) ) {
continue;
}
$this->out .= $template->plugin_row($plugintitle, $info);
$i++;
}
if ($i == 0) {
$this->out .= $template->no_plugins();
}
$this->out .= $template->page_footer();
$this->exit_it();
}
function isIE() {
if (stristr($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== false) {
return true;
}
return false;
}
function IE() {
include('SearchPluginMSIE.tpl.php');
$this->out = $template->SorryNoIE($this->title);
}
function exit_it() {
$this->SendRequiredHeaders();
echo $this->out;
exit(0);
}
function SendRequiredHeaders() {
$headers = array();
$h = &$headers;
$s = implode(' ', $_SERVER);
$h['application/xhtml+xml'] = 'Content-type: application/xhtml+xml;charset=utf-8';
$h[] = 'Expires: Mon, 26 Jul 1997 05:00:00 GMT';
$h[] = 'Last-Modified: '.gmdate("D, d M Y H:i:s").' GMT';
$h[] = 'Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0';
$h[] = 'Pragma: no-cache';
foreach ($h as $req => $header) {
if (!is_numeric($req) && !stristr($s, $req)) {
continue;
}
header($header);
}
}
function checkplugin($plugin) {
if (count($plugin) != 1) {
return false;
}
$reqkeys = array('searchplugindesc', 'searchpluginpic', 'searchpluginname', 'searchpluginsrc');
foreach($plugin as $plugintitle => $info) {
if (!is_string($plugintitle)) {
return false;
}
foreach($reqkeys as $rk) {
if (!array_key_exists($rk, $info)) {
return false;
}
}
}
return true;
}
} //einde class
?>
Template:
<?php
$template = new template;
class template {
function page_header($title, $base_url) {
return <<<EOF
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" >
<head>
<title>
{$title}
</title>
<script type="text/javascript">
<!--//-->
<![CDATA[//>
<!--
function addEngine(src, img, naam, cat) {
if ((typeof window.sidebar == "object") && (typeof window.sidebar.addSearchEngine == "function")) {
//cat="Web";
//cat=prompt("In what category should this engine be installed?","Web")
window.sidebar.addSearchEngine(
"{$base_url}"+src+".src",
"{$base_url}"+img,
naam,
naam );
} else {
alert("Jouw browser ondersteunt geen Search Plugins");
}
}
//-->
//<!]]>
</script>
<style type="text/css">
#container {
margin: 2px;
margin-top: 1px !important;
padding: 10px;
width: 450px;
font-family: verdana, Arial, sans-serif;
font-size: 14px;
color: #000000;
background-color: #FCFCFC;
border: 1px dashed #CCCCCC;
}
#tabletitle {
display: block;
border: 0px dotted #000000;
border-bottom-width: 1px;
font-weight: bold;
font-size: 19px;
padding: 2px;
margin: 2px;
color: #000000;
margin-bottom: 5px;
}
#tablefooter {
display: block;
border: 0px dotted #CFCFCF;
border-top-width: 1px;
font-style: italic;
font-size: 11px;
color: gray;
padding: 2px;
padding-left: 1px;
padding-right: 1px;
margin: 2px;
margin-top: 5px;
}
table {
border: 0px;
}
td {
padding-left: 1px;
}
td.nothing {
padding: 0px;
margin: 0px;
}
input {
background-color: #FCFCFC;
border: 1px dashed #CCCCCC;
}
input:focus {
background-color: #FCFCFC;
border: 1px dashed gray;
}
a.searchplugin {
font-color: #000000;
font-size: 17px;
}
.searchplugindesc {
font-color: #000000;
font-size: 12px;
font-style: italic;
}
</style>
</head>
<body>
<div id="container">
<table>
<tr>
<td class="nothing">
<span id="tabletitle">{$title}</span>
</td>
</tr>
EOF;
}
function plugin_row($plugintitle, $info) {
return <<<EOF
<tr>
<td>
<a href="#" onclick="addEngine('{$info['searchpluginsrc']}','{$info['searchpluginpic']}', '{$info['searchpluginname']}', 'The Hype AM');" class="searchplugin">
{$plugintitle}
</a><br />
<span class="searchplugindesc">
{$info['searchplugindesc']}
</span>
</td>
</tr>
EOF;
}
function no_plugins() {
return <<<EOF
<tr>
<td>
<span style="font-color: #FF0000;font-weight:bold;display: block;">
Foutje
</span>
<span style="font-color: #FF0000;display: block;">
Sorry, maar het lijkt erop dat er nu geen plugins beschikbaar zijn.
</span>
</td>
</tr>
EOF;
}
function page_footer() {
return <<<EOF
<tr>
<td class="nothing">
<span id="tablefooter">
<span style="font-weight: bold">Deïnstallatie instructies:</span><br />
Ga naar je Firefox profiel map, bij de normale Firefox 1.x meestal te vinden in
C:\Documents and Settings\????\Application Data\Mozilla\Firefox\Profiles\default.????,
ga naar de 'searchplugins' map en verwijder de bestanden 'TheHypeForum.src', 'TheHypeWebsite.src', 'TheHypeForum.png' en 'TheHypeWebsite.png'.
Start Firefox opnieuw op and it's done! :-)
</span>
</td>
</tr>
</table>
</div>
</body>
</html>
EOF;
}
}
?>
Werkt als een trein :-)
Ook al neem ik de JS code over. Nog steeds doet hij het niet. (Php code hoef ik toch niet... )
Je hebt ook geen .src bestanden zie ik.