لدي سكربت يمكنني من خلاله انشاء أقسام أو تصنيفات رئيسية وفرعية وبداخل التصنيفات أضيف مقالات
ولدي دوال عرض التصنيفات الرئيسية والفرعية:
كود: تحديد الكل
function catgory() {
global $htmlorphp;
$Sql = mysql_query("SELECT * FROM catgory where sub=0 AND active=1 order by id desc");
$numberx = mysql_num_rows($Sql);
if($numberx == 0){
$printcats = "<p align='center'>No Catgory</p>";
}else{
$printcats = "<ul>";
while ($Row = @mysql_fetch_array($Sql))
{
$Row['title'] = stripslashes($Row['title']);
$Row['title'] = htmlspecialchars($Row['title']);
if ($htmlorphp=="1"){
$l = "sections-".$Row['id'].".html";
}else{
$l = "sections.php?id=".$Row['id']."";
}
$queryxc = mysql_query("SELECT * FROM pages where catgoryid='".$Row['id']."' AND active=1");
$numberx = mysql_num_rows($queryxc);
$Sqlx = mysql_query("SELECT * FROM catgory where sub='".$Row['id']."' AND active=1 order by id desc");
$numberxx = mysql_num_rows($Sqlx);
if($numberxx == 0){
$li = "";
}else{
$li = "<ul>";
while ($Rowx = @mysql_fetch_array($Sqlx))
{
$Rowx['title'] = stripslashes($Rowx['title']);
$Rowx['title'] = htmlspecialchars($Rowx['title']);
$queryxcs = mysql_query("SELECT * FROM pages where catgoryid='".$Rowx['id']."' AND active=1");
$numberxs = mysql_num_rows($queryxcs);
if ($htmlorphp=="1"){
$lx = "sections-".$Rowx['id'].".html";
}else{
$lx = "sections.php?id=".$Rowx['id']."";
}
$li .= "<li><a class='tt' title='".$numberxs."' href='$lx'>".$Rowx['title']."</a> <span class='tt'>[".$numberxs."]</span></li>";
}
$li .= "</ul>";
}
$printcats .= "<li><a href='$l'>".$Row['title']."</a> <span class='tt'>[".$numberx."]</span>".$li."</li>";
}
$printcats .= "</ul>";
}
return $printcats;
}
ودوال عرض المواضيع داخل كل تصنيف
كود: تحديد الكل
function sections() {
global $id,$htmlorphp,$article_limit;
$Sqlxxx = mysql_query("SELECT * FROM catgory where sub='$id' AND active=1 order by id desc");
$numberxx = mysql_num_rows($Sqlxxx);
$printcats = cat($id);
$page = (int) (!isset($_GET["page"]) ? 1 : $_GET["page"]);
$page = ($page == 0 ? 1 : $page);
$perpage = $article_limit;
$startpoint = ($page * $perpage) - $perpage;
$Sql2 = mysql_query("SELECT id,title,date,visitor FROM pages where catgoryid='$id' AND active=1 order by id desc LIMIT $startpoint,$perpage");
$numbercat = mysql_num_rows($Sql2);
if($numbercat == "0"){
if($numberxx == 0){
$printcats .= "<p align='center'>No Topics</p>";
}else{
$printcats .= "";
}
}else{
if($numberxx == 0){
$printcats .= "";
}else{
$printcats .= "<br />";
}
$printcats .= "<ul>";
while ($Row = @mysql_fetch_array($Sql2))
{
$Row['title'] = htmlspecialchars($Row['title']);
$Row['title'] = stripslashes($Row['title']);
$d = date("j/n/Y",$Row['date']);
if ($htmlorphp=="1"){
$l = "details-".$Row['id'].".html";
}else{
$l = "page.php?details=".$Row['id']."";
}
$printcats .= "<li><a title='$d' href='$l'>".$Row['title']."</a></li>";
}
$printcats .= "</ul>";
}
return $printcats;
}
ودوال عرض المواضيع الأحدث أولاً وكلها مع بعض من مختلف التصنيفات
كود: تحديد الكل
function articles() {
global $htmlorphp,$article_limitindex,$viewimagethumbs;
$Sql = mysql_query("SELECT * FROM pages where active=1 order by id DESC LIMIT ");
$numbers = mysql_num_rows($Sql);
if($numbers == "0"){
echo "<p align='center'>No Article</p>";
}else{
while ($Row = @mysql_fetch_array($Sql))
{
$Row['title'] = stripslashes($Row['title']);
$Row['title'] = htmlspecialchars($Row['title']);
$Row['shortdesc'] = stripslashes($Row['shortdesc']);
$Row['shortdesc'] = htmlspecialchars($Row['shortdesc']);
$d = date("j/n/Y",$Row['date']);
if($Row['shortdesc']==""){
$Row['text'] = stripslashes($Row['text']);
$Row['text'] = strip_tags($Row['text']);
$ttt = cuttext(500,nl2br($Row['text']),"");
}else{
$ttt = $Row['shortdesc'];
}
$queryxc = mysql_query("SELECT * FROM catgory where id='".$Row['catgoryid']."' AND active=1");
$pc = mysql_fetch_array($queryxc);
$pc['title'] = stripslashes($pc['title']);
$pc['title'] = htmlspecialchars($pc['title']);
if ($htmlorphp=="1"){
$xx = "<a href='details-".$Row['id'].".html'>".$Row['title']."</a>";
$xx2 = "<a href='sections-".$Row['catgoryid'].".html'>".$pc['title']."</a>";
}else{
$xx = "<a href='page.php?details=".$Row['id']."'>".$Row['title']."</a>";
$xx2 = "<a href='sections.php?details=".$Row['catgoryid']."'>".$pc['title']."</a>";
}
tpl_table($xx,$ttt."<br />");
echo "<br />";
}
}
}
الفكرة يلي أسعى للحصول عليها وتعديلها ويلي مازبط معي هي بآخر دوال يعني الدوال عم يعرض آخر المقالات حسب الأحدث
وبغض النظر عن السم أو التصنيف
أنا بدي صير يعرض تصنيفات الموقع الرئيسية وليست الفرعية
وتحت كل تصنيف يعرض مواضيع منه ومن أي تصنيف فرعي بعدد محدد 5 مثلاً
يعني يصير عنا
>> التصنيف الأول:
- مقالة أولى من التصنيف الأول
- مقالة ثانية
- مقالة ثالثة من تصنيف فرعي بالتصنيف الأول
>> التصنيف الثاني:
- مقالة أولى
- مقالة ثانية
- مقالة ثالثة
وهكذا
حاولت كثيراً ولم أفلح كيف رح يكون العمل يعني كيف رح يصنف المقالات تحت أقسامها ...



