Les archives de FluxBB.fr
Vous n'êtes pas identifié(e).
Pages : 1
Hello and hi to all.. i just wanna share simple tip to slow down your cpu server.
many members already know that search something in forum using search.php will make your forum become slow. For me, i disable search.php for guest search and use google search in my forum for guest. Here is the simple step to who want to use search engine from google for guest.
Step 1
create a file in your root directory and rename it as 'search_g.php'. In that file, insert this code
<?php
define('PUN_ALT3',1);
define('PUN_ROOT', './');
require PUN_ROOT.'include/common.php';
$page_title = pun_htmlspecialchars($pun_config['o_board_title']);
define('PUN_ALLOW_INDEX', 1);
require PUN_ROOT.'header.php';
?>
<div class="block">
<h2><span>Forum Search</span></h2>
<div class="box">
<p style="text-align: center;">To get the best result with more specification, We recommend you to logged in and use our forum search.</p>
//YOUR GOOGLE SEARCH CODE HERE
</div>
</div>
<?php
require PUN_ROOT.'footer.php';Step 2
visit http://www.google.com/cse/ and create a custom search engine. In that site look on 'What do you want to search?' and choose 'Only sites I select' and in sites to search box, put your forum link for example http://www.punbb.fr and click next and click finish. After finish creating your custom search, visit your search engine control panel and click get code..
Step 3
Open search_g.php and find
//YOUR GOOGLE SEARCH CODE HERE
Replace it with your google search code.
Step 4
to show link to guest only on your forum navigation.
Open include/functions.php and find
if ($pun_user['is_guest'])
{
if ($pun_user['g_search'] == '1')
$links[] = '<li><a href="search.php">'.$lang_common['Search'].'</a>';After that code, put this code and save it.
$links[] = '<li><a href="search_g.php">Search</a>';You're done.
Something you may want to know.
You need to disable search feature for guest in admin control panel -> User groups. If not, you will see two search link on your forum navigation.
You also can show your adsense in your search by setting it in google custom search control panel.
Thanks for reading and sorry for use english in posting coz i'm from malaysia...Hope i will have friend here...Have a nice day... 
Dernière modification par Zack (11-01-2010 08:40:28)
Hors ligne
Je viens de l'installer et c'est impeccable !
Résumé en français 
1. Créer un fichier search_g.php (ou autre) et copier/coller ce code :
<?php
define('PUN_ALT3',1);
define('PUN_ROOT', './');
require PUN_ROOT.'include/common.php';
$page_title = pun_htmlspecialchars($pun_config['o_board_title']);
define('PUN_ALLOW_INDEX', 1);
require PUN_ROOT.'header.php';
?>
<div class="block">
<h2><span>Forum Search</span></h2>
<div class="box">
<p style="text-align: center;">
Pour obtenir un meilleur résultat avec plus de
précision, nous vous recommandons de vous <a href="./login.php" title="identifiez vous">connecter<a> ou
de vous <a href="./register.php" title="inscrivez vous">inscrire</a> afin d'utiliser
notre moteur de <a href="./search.php" title="recherche">recherche</a> interne.</p>
<!--
CODE DONNE PAR GOOGLE, remplacez le par le votre
-->
<div id="cse" style="width: 100%; padding: 7px;">Loading</div>
<script src="http://www.google.com/jsapi" type="text/javascript"></script>
<script type="text/javascript">
google.load('search', '1');
google.setOnLoadCallback(function(){
var customSearchControl = new google.search.CustomSearchControl('clef générée par google');
customSearchControl.draw('cse');
}, true);
</script>
<!--
FIN du CODE DONNE PAR GOOGLE
-->
<div style="clear:both"></div>
</div>
</div>
<div style="clear:both"></div>
<?php
require PUN_ROOT.'footer.php';J'ai rajouté <div style="clear:both"></div> car les recherches générées par google passées par dessus mon footer (pied de page).
2. Visiter http://www.google.com/cse/ et enregistrer vous !
3. Une fois tout paramétré, cliquez sur le lien "générer le code", j'ai pris la 3ème solution de recherche
Héberger les résultats sur mon site Web en utilisant un Custom Search Element Nouveau !
Puis copier ce code dans le fichier search_g.php.
4. Ouvrez le fichier ./include/functions.php, et modifier la partie suivante :
if ($pun_user['is_guest'])
{
if ($pun_user['g_search'] == '1')
$links[] = '<li id="navsearch"><a href="search.php">'.$lang_common['Search'].'</a>';
$links[] = '<li id="navsearch"><a href="search_g.php">'.$lang_common['Search'].'</a>';
$links[] = '<li id="navregister"><a href="register.php">'.$lang_common['Register'].'</a>';
$links[] = '<li id="navlogin"><a href="login.php">'.$lang_common['Login'].'</a>';
$info = $lang_common['Not logged in'];
}Donc au final, j'ai activé la fonction recherche GOOGLE pour les visiteurs (guest), quand aux membres, ils ont toujours accès à la recherche interne (qui est propre) à fluxbb.
Dernière modification par NoX09 (20-01-2010 00:18:01)
Hors ligne
^ nice to hear that work for you..and many thanks for the translate..
By the way, i have no preview or screen shoot because i have switch my forum to mybb.. 
thanks
-zam-
Hors ligne
Pages : 1