Simply FAQ Script - AlbDEVs

×
Albanian Forums, Zerion Zeri yt Zeri Info, Forumi Shqiptar Al Virtual, Diskutime, Biseda, Chat Njofje, Informatika, Teknologjia, Gazeta Tema, Gazetat Shqiptare, Bota Sot, www Channel Albania, Telegrafi Kosovo, Ballkani Web, Gazeta Lajme shqip, Lajmet e Fundit Shqiperia Kosova, Dita, Panorama, Kryeartikull, Faqja Kryesore, Video Shqip, Muzike Shqipe, Njoftime, Lajmerime, Temat Online, Gazetat, Kosovare, Shtypi Ditor, Sporti Shqiptar, Dashuria, Pyetje Pergjigje, Keshilla, Ndihme, Webmaster Shqiptar, Familja, Shqiptaria, Muzika, Receta Gatimi, Imazhe, Vipat-shqiptar, Aktualiteti
Media Sociale
Mesazhe Private
Shqiptaret duke lexuar tema interesante dhe te ndryshme
Tema re

Simply FAQ Script

Simply FAQ Script

· 1 · 757

  • Postime: 28589
  • Karma: +48/-5
  • Gjinia: Mashkull

ne: 09-09-2009, 11:31:50
Nje skript i vogel dhe i thjeshte qe mundeson krijimin e nje FAQ (shpjegime te rendesishme per funksionim e faqes) per faqen tuaj.

Kodi: [Zgjidh]
<center>
<!-- Start Bravenet.com Affiliate Code -->
<script language="JavaScript" src="http://www.bravenet.com/cserv.php?pid=4&tid=2&afilid=853055196"></script>
<!-- End Bravenet.com Affiliate Code -->
</center><br>
<?php
$err
="";
$totfound=0;
if(!isset(
$idx)) $idx=0;
function 
QuestionHere($cnt,$Q)
{
print "<b>$cnt$Q</b><br>";
}

function 
AnswerHere($cnt,$A)
{
print "$A <font size=1><br><br></font>";
}

//read all with .faq ext.
$currdir=getcwd();
$dir=@opendir($currdir);
if(!
$dir) print "Error dir $currdir";
$aCategory=array();
$n=0;
while(
$file=@readdir($dir))
{
if(substr($file,-4)==".faq")
{
$aCategory[]=$file;
//print substr($file,-4)." = $n. $aCategory[$n]<br>"; $n++;
}
}

sort($aCategory);
$nMaxCate=count($aCategory);

//Search
if(isset($searchtxt) && strlen($searchtxt)<3)
{
$err="Search at least 3 characters.";
$idx=-1;
$aFound=array();
}
elseif(isset(
$searchtxt) && $searchtxt!="")
{
$idx=-1;
$aFound=array();
for(
$a=0;$a<$nMaxCate;$a++)
{
$nFirst=0;
$ccfile=$currdir."/".$aCategory[$a];
$fp=@fopen($ccfile,"r");
if(!@fp) {print "Error reading ".$currdir."/".$aCategory[$a]; exit;}
$QorA=0;
$cnt=1;
$TempQ="";
$okenter=0;
while(!feof($fp))
{
$ln=fgets($fp,5000);
if(trim($ln)!="")
{

if(stristr($ln,$searchtxt) || $okenter==1)
{
if($nFirst==0
{
$cCate=str_replace("_"," ",$aCategory[$a]);
$cCate=substr(substr($cCate,1),0,-4);

$aFound[]="@CATEGORY@$cCate";
$nFirst=1;
}


if($QorA==0//Question
{
$QorA=1;
$okenter=1;
$totfound++;
}
else
{
$QorA=0;
if($okenter==0
{
$totfound++;
$TempQ=str_replace($searchtxt,"<font color=&#39;000080&#39;>$searchtxt</font>",$TempQ);
$aFound[]=$TempQ;
}
$okenter=0;
}
$ln=str_replace($searchtxt,"<font color=&#39;000080&#39;>$searchtxt</font>",$ln);
$aFound[]=$ln;

}
else
{
if($QorA==0) {$TempQ=$ln$QorA=1;}
elseif($QorA==1) {$QorA=0$TempQ="";}
}
}

}
}
}

?>



<html>
<head>
<meta http-equiv="Content-Language" content="en-us">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>FAQ</title>
<STYLE type="text/css">
<!--
A { text-decoration:none; color: #0000cc }
-->
</STYLE>

<style fprolloverstyle>A:hover {color: #cc0000;}</style>

</head>

<body>
<center>
<table border="0" width="750" style="font-family: Arial; font-size: 10pt" cellspacing="0" cellpadding="5">
  <tr>
    <td width="100%" bgcolor="#000080">
      <p align="center"><font color="#FFFFFF" size="4"><b>FAQ</b></font></td>
  </tr>
  <tr>
    <td width="100%">
      <p align="center"><b>Categories :</b><br>&nbsp;

<?php
for($a=0;$a<$nMaxCate;$a++)
{
$cCate=str_replace("_","<font color=#ffffff>_</font>",$aCategory[$a]);
$cCate=substr(substr($cCate,1),0,-4);
$
$cCate=strtoupper($file);

if(
$a==$idx) {print "[<b><font color=&#39;#008080&#39;>$cCate</font></b>] &nbsp;"$cSelectedCate=$cCate;}
else print 
"[<a href=&#39;faq.php?idx=$a&#39;>$cCate</a>] &nbsp;";
}
?>


</p>
    </td>
  </tr>
  <tr>
    <td width="100%">
<form method="POST" action="faq.php">

      <p align="center"><b>Search :</b>
        <input type="text" name="searchtxt" size="20" style="font-family: Arial; font-size: 8pt">
      <input type="submit" value="Go" name="Search" style="font-family: Arial; font-size: 8pt">
      </form>
      </p>
    </td>
  </tr>
  <tr>
    <td width="100%">
      <hr width="95%" size="1" color="#777777">


<?php 
if($idx>=0)
{
print 
"<font size=&#39;3&#39; color=&#39;#008080&#39;><b>$cSelectedCate<br><br></b></font>";

$fp=@fopen($aCategory[$idx],"r");
if(!
$fp) {print "Error reading ".$currdir."/".$aCategory[$a]; exit;}
$QorA=0;
$cnt=1;
while(!
feof($fp))
{
$ln=fgets($fp,500);
if(trim($ln)!="")
{
if($QorA==0) {QuestionHere($cnt,$ln); $QorA=1;}
else {AnswerHere($cnt,$ln); $QorA=0$cnt++;}
}
}
}
else 
// SEARCH MODULE
$nMaxFound=count($aFound);

if(
$nMaxFound==0
{
if(
$err!="") print "<br><font color=&#39;cc0000&#39;>$err</font>";
else print 
"No search found for <b>$searchtxt</b>";
}

else
{
print "<font color=#000080 size=3>Search \"<b>$searchtxt</b>\", found <b>$totfound</b> topics.<br></font>";
$cnt=1;
$QorA=0;
for($a=0;$a<$nMaxFound;$a++)
{
if(substr($aFound[$a],0,10)=="@CATEGORY@")
{
$cSelectedCate=substr($aFound[$a],10);
print "<br><font size=&#39;3&#39; color=&#39;#008080&#39;><b>$cSelectedCate<br></b></font>";
$QorA=0;
}
else
{
if($QorA==0) {QuestionHere($cnt,$aFound[$a]); $QorA=1;}
else {AnswerHere($cnt,$aFound[$a]); $QorA=0$cnt++;}
}
}

}
}
?>


<br><br><font size=1>Powered by <a href='http://smallcapitalbusiness.com'>SmallCapitalBusiness.com</a></font>
</td>
  </tr>
</table>

</body>

</html>

http://px.sklar.com/code.html/id=1079

Temat e fundit