بسم الله الرحمن الرحيم
اسم الموديلز: صورة لكل قسم
الملفات المطلوب تعديلها:
global.php
admin/categories.php
admin/images.php (optional)
includes/functions.php
templates/<your template>/category_bit.html
اولا: افتح global.php
النسخة 1.7
ابحث عن:
كود PHP:
$sql = "SELECT c.cat_id, c.cat_name, c.cat_description, c.cat_parent_id, c.cat_hits, c.cat_order, c.auth_viewcat, c.auth_viewimage, c.auth_download, c.auth_upload, c.auth_directupload, c.auth_vote, c.auth_sendpostcard, c.auth_readcomment, c.auth_postcomment, COUNT(i.image_id) AS new_images
اضف بنهايته التالي:
فيصبح:
كود PHP:
$sql = "SELECT c.cat_id, c.cat_name, c.cat_description, c.cat_parent_id, c.cat_hits, c.cat_order, c.auth_viewcat, c.auth_viewimage, c.auth_download, c.auth_upload, c.auth_directupload, c.auth_vote, c.auth_sendpostcard, c.auth_readcomment, c.auth_postcomment, COUNT(i.image_id) AS new_images, c.cat_image
النسخة 1.7.1
ابحث عن:
كود PHP:
$sql = "SELECT cat_id, cat_name, cat_description, cat_parent_id, cat_hits, cat_order, auth_viewcat, auth_viewimage, auth_download, auth_upload, auth_directupload, auth_vote, auth_sendpostcard, auth_readcomment, auth_postcomment
اضف بنهايته التالي:
فيصبح: (لاحظ اللون الاحمر(
كود PHP:
$sql = "SELECT cat_id, cat_name, cat_description, cat_parent_id, cat_hits, cat_order, auth_viewcat, auth_viewimage, auth_download, auth_upload, auth_directupload, auth_vote, auth_sendpostcard, auth_readcomment, auth_postcomment, cat_image
ثانيا: افتح ملف
admin/categories.php
ابحث عن: (ستجدها مرتين(
كود PHP:
$auth_postcomment = $HTTP_POST_VARS['auth_postcomment'];
اضف اسفلها التالي:
كود PHP:
//Category Image - trans by pepsi@swalif softs
$cat_image = (intval($HTTP_POST_VARS['cat_image'])) ? intval($HTTP_POST_VARS['cat_image']) : 0;
//End Category Image
________
ابحث عن:
كود PHP:
$sql = "INSERT INTO ".CATEGORIES_TABLE."
(cat_name, cat_description, cat_parent_id, cat_order, auth_viewcat, auth_viewimage, auth_download, auth_upload, auth_directupload, auth_vote, auth_sendpostcard, auth_readcomment, auth_postcomment)
VALUES
('$cat_name', '$cat_description', $cat_parent_id, $cat_order, $auth_viewcat, $auth_viewimage, $auth_download, $auth_upload, $auth_directupload, $auth_vote, $auth_sendpostcard, $auth_readcomment, $auth_postcomment)";
استبدلها بــــ:
كود PHP:
$sql = "INSERT INTO ".CATEGORIES_TABLE."
(cat_name, cat_description, cat_parent_id, cat_order, auth_viewcat, auth_viewimage, auth_download, auth_upload, auth_directupload, auth_vote, auth_sendpostcard, auth_readcomment, auth_postcomment, cat_image)
VALUES
('$cat_name', '$cat_description', $cat_parent_id, $cat_order, $auth_viewcat, $auth_viewimage, $auth_download, $auth_upload, $auth_directupload, $auth_vote, $auth_sendpostcard, $auth_readcomment, $auth_postcomment, $cat_image)";
__________
ابحث عن:
كود PHP:
$sql = "SELECT cat_name, cat_description, cat_parent_id, cat_hits, auth_viewcat, auth_viewimage, auth_download, auth_upload, auth_directupload, auth_vote, auth_sendpostcard, auth_readcomment, auth_postcomment
استبدلها بـــ:
كود PHP:
$sql = "SELECT cat_name, cat_description, cat_parent_id, cat_hits, auth_viewcat, auth_viewimage, auth_download, auth_upload, auth_directupload, auth_vote, auth_sendpostcard, auth_readcomment, auth_postcomment, cat_image
_________
ابحث عن:
كود PHP:
show_form_footer($lang['save_changes'], $lang['reset'], 2, $lang['back']);
اضف قبله:
كود PHP:
// Category image - trans by pepsi
$cat_image = "";
if ($result['cat_image'])
{
$sql = "SELECT image_id, image_media_file, image_thumb_file, image_name, cat_id
FROM ".IMAGES_TABLE."
WHERE image_id = ".$result['cat_image'];
if ($image_row = $site_db->query_firstrow($sql))
{
if (!get_file_path($image_row['image_thumb_file'], "thumb", $image_row['cat_id'], 0, 0))
{
$cat_image = ICON_PATH."/".get_file_extension($image_row['image_media_file']).".gif";
}
else
{
$cat_image = get_file_path($image_row['image_thumb_file'], "thumb", $image_row['cat_id'], 0, 1);
}
$file_info = @getimagesize($cat_image);
$dim = 50;
$width = $file_info[0];
$height = $file_info[1];
if ($width && $height) {
if ($width > $dim || $height > $dim) {
@$ratio = $width / $height;
if ($ratio > 1) {
$new_width = $dim;
$new_height = round(($dim/$width) * $height);
}else {
$new_width = round(($dim/$height) * $width);
$new_height = $dim;
}
}else{
$new_width = $width;
$new_height = $height;
}
}else{
$new_width = $dim;
$new_height = $dim;
}
$cat_image = "<a href=\"".$site_sess->url(ROOT_PATH."details.php?image_id=".$result['cat_image'])."\" target=\"_blank\"><img src=\"".$cat_image."\" width=\"".$new_width."\" height=\"".$new_height."\"></a> <a href=\"".$site_sess->url(ROOT_PATH."details.php?image_id=".$result['cat_image'])."\" target=\"_blank\">".$image_row['image_name']."</a>";
}
}
$value = $result['cat_image'];
if (isset($HTTP_POST_VARS['cat_image'])/* && $value == ""*/) {
$value = stripslashes($HTTP_POST_VARS['cat_image']);
}
echo "<tr class=\"".get_row_bg()."\">\n<td><p class=\"rowtitle\">رقم صورة القسم</p></td>\n<td><p><input type=\"text\" size=\"5\" name=\"cat_image\" value=\"".$value."\"> $cat_image</p></td>\n</tr>\n";
//End Category image
_______
ابحث عن:
كود PHP:
$sql = "SELECT cat_id, cat_name, cat_description, cat_parent_id, cat_hits, cat_order, auth_viewcat, auth_viewimage, auth_download, auth_upload, auth_directupload, auth_vote, auth_sendpostcard, auth_readcomment, auth_postcomment
استبدلها بـــ:
كود PHP:
$sql = "SELECT cat_id, cat_name, cat_description, cat_parent_id, cat_hits, cat_order, auth_viewcat, auth_viewimage, auth_download, auth_upload, auth_directupload, auth_vote, auth_sendpostcard, auth_readcomment, auth_postcomment, cat_image
ثالثا: افتح ملف
includes/functions.php
ابحث عن:
كود PHP:
if (defined("SHOW_RANDOM_IMAGE") && SHOW_RANDOM_IMAGE == 0 || defined("SHOW_RANDOM_CAT_IMAGE") && SHOW_RANDOM_CAT_IMAGE == 0) {
اضف قبلها:
كود PHP:
$cat_image = "";
if ($cat_cache[$category_id]['cat_image'])
{
$sql = "SELECT image_id, image_media_file, image_thumb_file, cat_id
FROM ".IMAGES_TABLE."
WHERE image_id = ".$cat_cache[$category_id]['cat_image'];
if ($image_row = $site_db->query_firstrow($sql))
{
if (!get_file_path($image_row['image_thumb_file'], "thumb", $image_row['cat_id'], 0, 0))
{
$cat_image = ICON_PATH."/".get_file_extension($image_row['image_media_file']).".gif";
}
else
{
$cat_image = get_file_path($image_row['image_thumb_file'], "thumb", $image_row['cat_id'], 0, 1);
}
}
}
$site_template->register_vars("cat_image", $cat_image);
رابعا: الاضافة الى التمبلت
templates/<your template>/category_bit.html
<your template> = التمبلت المستخدم في السكربت
ضع الكود التالي في المكان الذي تريد به ظهور الصورة:
كود PHP:
{if cat_image}<img src="{cat_image}">{endif cat_image}
رابعا:
ارفع الملف المرفق الى موقعك واطلبه وسوف يتم تنصيب الموديلز بالقاعدة الخاصة بالسكربت، بعد ذلك يرجى حذفه من الموقع.
مثال:
http://www.thekryat.net/gallery/index.php
لاتوجد اي علاقة بيني وبين صاحب الموقع من اي ناحية، وضعت الموقع فقط كمثال !
ملاحظة: قمت بتعريب الدرس من الموقع الاصلي + تركيب الموديلز على احد مواقع الاصدقاء 
سلاااااااااااااااااااااااااااااااااام