منصة عربية لإنشاء مواقع الانترنت

إضافة خاصة

يعتبر هذا الصندوق من أهم الصناديق لأنه يعطي ديناميكي عالية للموقع وذلك عبر ربط الصناديق بالـ Extensions

بمعنى آخر, يمكن للمدير التحكم بخصائص وترتيب الـ Extensions في الموقع (على الصفحة الرئيسية كمثال)

 

مثلاً فلنفترض أنه في الصفحة الرئيسية للموقع:

  • يوجد Extension تقوم بعرض صورة ونص ولها خلفية معينة, وليكن اسمها extensions/themes/private/a.php
  • يوجد Extension تقوم بعرض شركاؤنا (عبر جلبهم من نماذج المقالات) مثلاً وليكن اسمها extensions/themes/private/b.php

 

والآن نريد أن يقوم المدير هو بالتحكم بترتيبهم وكذلك التحكم بخصائصهم, أي أن يقوم هو بتحديد الصورة والنص والخلفية الخاصة بالـ Extension الأولى وكذلك تحديد نموذج المقالات الذي سيتم جلب شركاؤنا منه , وكذلك القالب المراد عرض شركاؤنا به ضمن هذه الـ Extension

 

كل ما علينا فعلها هو:

  1. تعريف مكان صناديق جديد وليكن عنوان .. صناديق الصفحة الرئيسية
  2. تحديد الأنواع المسموحة لهذا المكان, وليكن من ضمنها "إضافة خاصة"
  3. إضافة الكود التالي إلى classes/_Utils.php وذلك لكي نقول لمونتي ما الواجب فعله في حال اختيار إضافة خاصة
        $extensionsAsBoxes = array();
        $extensionsAsBoxes['themes/private/a'] = array(
            'title'=>'Text, photo, and background',
            'positions'=>array(
                'home' // To enable this extension to only this position, and to hide it from other positions
            ),
            // To add the fields that should be enabled for the admin to control the extension
            'fields'=>array(
                'text'=>array(
                    'type'=>'text',
                    'multilingual'=>true,
                    'caption'=>'The extension text here'
                ),
                'photo'=>array(
                    'type'=>'file',
                    'uploadify'=>true,
                    'fileType'=>'image',
                    'optional'=>false,
                    'caption'=>'The extension photo here'
                ),
                'background'=>array(
                    'type'=>'file',
                    'uploadify'=>true,
                    'fileType'=>'image',
                    'optional'=>false,
                    'caption'=>'The extension background here'
                )
            )
        );
        $extensionsAsBoxes['themes/private/b'] = array(
            'title'=>'Text, photo, and background',
            'positions'=>array(
                // To allow this extension to all positions, don't enter the `positions` setting
            ),
            // To add the fields that should be enabled for the admin to control the extension
            'fields'=>array(
                // To let the admin choose the article pattern
                'article_pattern_id'=>array(
                    'type'=>'select',
                    'LUTable'=>'article_pattern',
                    'LUCaption'=>'title',
                    'LUCondition'=>'active=1 and (allow_listing=1 or allow_search=1)',
                    'caption'=>'Choose The pattern you want'
                ),
                'template'=>array(
                    'type'=>'text',
                    'settingsFunc'=>'getTemplatesOptionsForInput',
                    'settingsFunc_PASS_0'=>'rows',
                    'caption'=>'Choos the template you want'
                )
            )
        );
  4. كتابة الـ Extensions الاثنتين a.php و b.php في المسار extensions/themes/private/
  5. يمكن استخدام المتحول boxOptions ضمن كل extension لمعرفة الخصائص التي أدخلها المدير ضمن الحقول التي أظهرناها له كالتالي:
    global $boxOptions;
    print_r($boxOptions); // Let's see what the admin has entered
  6. طباعة مكان الصناديق في الصفحة الرئيسية
    $content .= getBoxPositionBoxes('home');

تعليقات

لا يوجد حالياً أي تعليق



تعليقك هنا

عليك تسجيل الدخول أولاً كي يتاح لك ترك تعليق, في حال لم يكن لديك عضوية اضغط هنا لإنشاء حساب جديد