Smf عربى

منتديات الدعم => قسم الدعم الخاص بالنسخة (Smf (1.1.X => الموضوع حرر بواسطة: صلاح الدين في 06 , يوليو, 2009 - 03:48:13 مسائاً

العنوان: سؤال يخص روابط القائمة الرئيسية
أرسل بواسطة: صلاح الدين في 06 , يوليو, 2009 - 03:48:13 مسائاً
السلام عليكم
توجد روابط في القائمة الرئيسية مثلا
بداية تعليمات بحث
forum;help;search
اريد اضافة مثلا كتب books
الملف مثلا books.php
هل تكفي هاته التغييرات
index.php
شفرة: [اختيار]
'books' => array('books.php', 'books'),
index.template.php
شفرة: [اختيار]
if ($context['current_action'] == 'books')
$current_action = 'books';
شفرة: [اختيار]
echo ($current_action == 'books' || $context['browser']['is_ie4']) ? '<td class="maintab_active_' . $first . '">&nbsp;</td>' : '' , '
<td valign="top" class="maintab_' , $current_action == 'books' ? 'active_back' : 'back' , '">
<a href="', $scripturl, '?action=books">', $txt['books'], '</a>
</td>' , $current_action == 'books' ? '<td class="maintab_active_' . $last . '">&nbsp;</td>' : '';
Who.arabic-utf8.php
شفرة: [اختيار]
$txt['who_books'] = ' فى <a href="' . $scripturl . '?action=books">الكتب</a>.';
Modifications.arabic-utf8.php
شفرة: [اختيار]
$txt['books'] = 'الكتب';
وشكرا
العنوان: رد: سؤال يخص روابط القائمة الرئيسية
أرسل بواسطة: islam2hamy في 06 , يوليو, 2009 - 05:59:40 مسائاً
لا لا هذا اذا كان مود
لكن اذا كان رابط فيمكنك استخدام هذا الكود :

شفرة: [اختيار]
<a href="http://www.smfarabic.com/books.php" title="books" target="_blank">books</a>
العنوان: رد: سؤال يخص روابط القائمة الرئيسية
أرسل بواسطة: صلاح الدين في 06 , يوليو, 2009 - 06:39:14 مسائاً
لا لا هذا اذا كان مود
لكن اذا كان رابط فيمكنك استخدام هذا الكود :

شفرة: [اختيار]
<a href="http://www.smfarabic.com/books.php" title="books" target="_blank">books</a>
بارك الله فيك
وان كنت اريد عمل مود استعمل ما فوق  ???
العنوان: رد: سؤال يخص روابط القائمة الرئيسية
أرسل بواسطة: islam2hamy في 06 , يوليو, 2009 - 06:46:48 مسائاً
نعم
العنوان: رد: سؤال يخص روابط القائمة الرئيسية
أرسل بواسطة: صلاح الدين في 06 , يوليو, 2009 - 06:48:46 مسائاً
نعم
السؤال الاخر
مثلا هل سيظهر لي ملف books.php ما بين الفوتر والهدر للمنتدى؟
عندما استعمل الطريقة اعلاه (مود)
العنوان: رد: سؤال يخص روابط القائمة الرئيسية
أرسل بواسطة: islam2hamy في 06 , يوليو, 2009 - 06:53:49 مسائاً
لا هذا مجرد زر لمود
لا يتم كتابت هذه الاوامر هكذا
العنوان: رد: سؤال يخص روابط القائمة الرئيسية
أرسل بواسطة: vivid في 07 , يوليو, 2009 - 10:22:05 صباحاً
لكي تضيف رابط لصفحة books.php يجب عليك تحديد نقطتين :
هل هذا الملف داخل الدايركتوري للمنتدى؟؟؟
يعني هو كما يلي :
http://www.xxxxx.com/smf/books.php

أم هو خارج الدايركتوري بمعنى
http://www.xxxxx.com/books.php

سأقوم بشرح الفكرة على الثيم الافتراضي و يمكنك التعديل بعد ذلك في حالة كنت تستخدم ثيم غير الافتراضي

في حالة أن الملف كان داخل الدايركتوري

أفتح الملف index.template.php

أبحث عن الكود التالي :


if ($context['current_action'] == 'search2')
$current_action = 'search';


أدرج بعده هذا الكود


if ($context['current_action'] == 'books')
$current_action = 'books';


أبحث عن الكود


if (in_array($context['current_action'], array('search', 'admin', 'calendar', 'profile', 'mlist', 'register', 'login', 'help', 'pm')))



لاحظ أن هذا الكود هو الأزرار الموجودة الآن
سنقوم بإضافة الزر books بنهاية الكود ليصبح الشكل كما يلي :


if (in_array($context['current_action'], array('search', 'admin', 'calendar', 'profile', 'mlist', 'register', 'login', 'help', 'pm', 'books')))


الآن أدرجنا كود الأزرار
يتبقى لنا إظهار الكود في واجهة المنتدى

أبحث عن الكود


// Show the [home] button.
echo ($current_action=='home' || $context['browser']['is_ie4']) ? '<td class="maintab_active_' . $first . '">&nbsp;</td>' : '' , '
<td valign="top" class="maintab_' , $current_action == 'home' ? 'active_back' : 'back' , '">
<a href="', $scripturl, '">' , $txt[103] , '</a>
</td>' , $current_action == 'home' ? '<td class="maintab_active_' . $last . '">&nbsp;</td>' : '';




لاحظ أن كلمة home مكررة ثلاث مرات
يجب علينا نسخ و استخدام نفس الكود مع تغيير كلمة home لكي تصبح books

كما يجب علينا ملاحظة المتغير

' , $txt[103] , '

و هو متغير سيطبع لنا كلمة books
و بما أننا أشرنا على أنه متغير لذلك تم وضع العلامتين [, xxxx ,] داخل علامتي اقتباس [, 'xxxxx' ,]
و بما أن كلمة books ليست متغير فيجب علينا مسح العلامتين [, ,] لكي يتم التعامل معها ككلمة عادية

لذلك سيكون الشكل النهائي للكود كما يلي


// Show the [books] button.
echo ($current_action=='books' || $context['browser']['is_ie4']) ? '<td class="maintab_active_' . $first . '">&nbsp;</td>' : '' , '
<td valign="top" class="maintab_' , $current_action == 'books' ? 'active_back' : 'back' , '">
<a href="', $scripturl, '?action=books">books</a>
</td>' , $current_action == 'books' ? '<td class="maintab_active_' . $last . '">&nbsp;</td>' : '';


أحفظ الملف على هذا الأساس ثم أرفعه لموقع

لاحظ : أن كل الكلمات هنا باللغة الانجليزية
لذلك سنذهب إلى ملف اللغة بالمنتدى
/Themes/default/languages/index.{language}.php (http://www.smfarabic.com/Themes/default/languages/index.{language}.php)

من ملف اللغة ادرج books بنفس الأسلوب الموجود للتعريبات الموجودة بالملف
ثم أكتب ما تريد باللغة العربية


الحالة الثانية: في حالة كان الملف خارج الدايركتوري

سنقوم بإدراج
<a href="http://my_website.com">your Page Here</a>

بدلاً عن


<a href="', $scripturl, '?action=BOOKS">BOOKS</a>
العنوان: رد: سؤال يخص روابط القائمة الرئيسية
أرسل بواسطة: صلاح الدين في 08 , يوليو, 2009 - 03:44:44 مسائاً
بارك الله فيك اخي الغالي
حاليا ليس لدي مشكلة في الـ PHP
لكن لست على اطلاع كبير على smf
هذا ما اريد ان اعمله حاليا mod books
اولا ملف package-info.xml
شفرة: [اختيار]
<?xml version="1.0"?>
<!DOCTYPE package-info SYSTEM "http://www.simplemachines.org/xml/package-info">

<package-info xmlns="http://www.simplemachines.org/xml/package-info" xmlns:smf="http://www.simplemachines.org/">

<id>Saladine:books</id>
<name>Books mod</name>
<version>1.0</version>

<type>modification</type>
<install>
<readme type="file">info.txt</readme>
<modification type="file">install.xml</modification>
<require-file name="books.php" destination="$sourcedir" />
</install>
<uninstall>
<modification type="file" reverse="true">install.xml</modification>
<remove-file name="$sourcedir/books.php" />
</uninstall>

</uninstall>
</package-info>

كل ما اريده هو ان نرتقي بهذا المنتدى وذلك يدا بيد
خاصة ان كانت لدينا مودات خاصة بنا
هذا هو الهدف
---------------------
أعود للمود
من كلام الأخ يمكنني ان اجزم ان ملف install.xml
سيكون هكذا
شفرة: [اختيار]
<?xml version="1.0"?>
<!DOCTYPE modification SYSTEM "http://www.simplemachines.org/xml/modification">
<modification xmlns="http://www.simplemachines.org/xml/modification" xmlns:smf="http://www.simplemachines.org/">
<id>Saladine:books</id>
<name>Books mod</name>
<version>1.0</version>

<file name="$themedir/index.template.php">
<operation>
<search position="after"><![CDATA[if ($context['current_action'] == 'search2')
$current_action = 'search';]]></search>
<add><![CDATA[if ($context['current_action'] == 'books')
$current_action = 'books';]]></add>
</operation>

<operation>
<search position="after"><![CDATA[if (in_array($context['current_action'], array('search',]]></search>
<add><![CDATA['books',]]></add>
</operation>

<operation>
<search position="after"><![CDATA[// How about the [search] button?
if ($context['allow_search'])
echo ($current_action == 'search' || $context['browser']['is_ie4']) ? '<td class="maintab_active_' . $first . '">&nbsp;</td>' : '' , '
<td valign="top" class="maintab_' , $current_action == 'search' ? 'active_back' : 'back' , '">
<a href="', $scripturl, '?action=search">' , $txt[182] , '</a>
</td>' , $current_action == 'search' ? '<td class="maintab_active_' . $last . '">&nbsp;</td>' : '';]]></search>
<add><![CDATA[// Show the [books] button.
echo ($current_action == 'books' || $context['browser']['is_ie4']) ? '<td class="maintab_active_' . $first . '">&nbsp;</td>' : '' , '
<td valign="top" class="maintab_' , $current_action == 'books' ? 'active_back' : 'back' , '">
<a href="', $scripturl, '?action=books">' , $txt[books] , '</a>
</td>' , $current_action == 'books' ? '<td class="maintab_active_' . $last . '">&nbsp;</td>' : '';]]></add>
</operation>
</file>

<file name="$languagedir/Modifications.arabic-utf8.php">
<operation>
<search position="end"></search>
<add><![CDATA[
$txt['books'] = 'الكتب';
]]></add>
</operation>
</file>


</modification>

اتمنى اني وفقت في الامر لحد الان