Did you recently take my advice on manging banners ? هل تأخذ نصيحتي مؤخرا على لافتات manging؟ Or maybe you’re just putting advertisements on your site for the first time this month? أو ربما كنت مجرد وضع الإعلانات على موقعك لأول مرة في هذا الشهر؟ Either way you’ll find as your sites grow, its a lot of work to manage banner advertisements. وفي كلتا الحالتين ستجد لكم مواقع يزداد ، والكثير من العمل لإدارة الإعلانات. You could go with something like OpenAds but applications like this are taxing on server efficiency - particularly if you’re on a shared hosting plan (The newest versin of OpenAds utilizes 16mb of ram). يمكنك الذهاب مع OpenAds شيء من هذا القبيل ولكن مثل هذه التطبيقات هي فرض ضريبة على الخادم كفاءة -- وخاصة إذا كنت على خطة استضافة مشتركة) وأحدث versin من OpenAds يستخدم 16mb من ذاكرة الوصول العشوائي). Sometimes simple is better and effective! في بعض الأحيان هو أفضل بسيطة وفعالة! Here’s some PHP coding tips to set yourself up for banner automation. وإليك بعض النصائح PHP الترميز لمجموعة نفسك حتى لراية التشغيل الآلي.

The first step involves grabbing the current pages domain. الخطوة الأولى تنطوي على انتزاع الحالي صفحات المجال. Break the url on the slashes like so. كسر عنوان الموقع على شرائح مثل ذلك. This should go in your template page. ينبغي أن يسير في هذا القالب صفحة.
$parts = explode(”/”, $HTTP_HOST); أجزاء دولار = تنفجر ("/"،دولار HTTP_HOST) ؛

This creates an array which we can now pick and choose an element to access. وهذا يخلق طائفة التي يمكننا الآن أن تنتقي وتختار الوصول إلى عنصر. The first array “0″ is the first part of the array. أول مجموعة من "0" هو الجزء الأول من مجموعة. This contains everything between the http:// and the start of the next slash if there is one. وهذا يتضمن كل شيء بين http:// وبدء خفض المقبلة إذا كان هناك واحد. We’re going to store that in variable “$whichsite”. NOTE : You can apply these same rules to directories or pages within a site by incrementing the part variable. ونحن في طريقنا للتخزين في أن متغير "whichsite دولار". ملاحظة : يمكنك تطبيق هذه القواعد نفسها إلى أدلة أو صفحات داخل الموقع من قبل incrementing من جانب متغير. This should go your template page. ينبغي أن يسير هذا القالب صفحة.
$whichsite = $parts[0]; whichsite دولار = دولار أجزاء [0] ؛

Now use an includes in the spot on your page (probably in a template somewhere on your site) where you want the ad to appear. الآن في استخدام ويشمل الموقع على الصفحة الخاصة بك (على الارجح في مكان ما على نموذج في موقعك) التي تريد الإعلان على ما يبدو. This again, goes in your sites template. هذا مرة أخرى ، وغني عن المواقع الخاصة بك في قالب.
include http://www.domain.com/ads.php?whichsite=$whichsite; وتشمل http://www.domain.com/ads.php؟whichsite = whichsite دولار ؛

Create an IF statement to check and see what domain is being selected. NOTE: if its not a sub-domain you’ will want to enter its WWW counterpart since a site can usually be accessed by domain.com or www.domain.com. إنشاء الإطار المتكامل بيان لفحص ومعرفة ما يجري حاليا اختيار المجال. ملاحظة : اذا لم فرعي المجال لكم 'سوف تريد دخول على شبكة الاتصالات العالمية منذ النظير موقع يمكن الوصول إليها عادة يكون domain.com أو www.domain.com.
if($whichsite == “www.extreme-gamerz.org” || $whichsite == “extreme-gamerz.org”) إذا دولار (whichsite == "www.extreme - gamerz.org" | | دولار whichsite == "المتطرفة بين gamerz.org")
If there are any additional links you want to have the same condition for continue to add them by separating them with a “||”. وإذا كانت هناك أي صلة إضافية تريد لنفسها شرطا لمواصلة أضيف إليها تفصل بينها مع "||". This specifies an OR statement in PHP. ويحدد هذا البيان في أحد أو PHP. This code should go in a new document named “ads.php” which we called in the past step. هذا القانون ينبغي أن يسير في وثيقة جديدة تحمل اسم "ads.php" التي كنا نسميها في الماضي خطوة. Your ads should go in-between each if statement accordingly. إعلاناتك ينبغي أن يسير في الفترات الفاصلة بين كل بيان إذا كان وفقا لذلك.

The code in your template should look like this: مدونة في القالب يجب أن يكون مثل هذا :

  1. <?php if ( $whichsite == "www.domain1.com" || $whichsite == "domain1.com" ) { ?>
  2. //Replace this with banners for this site
  3. <?php } elseif ( $whichsite == "sub.domain1.com" ) { ?>
  4. //Banners code for sub.domain1.com
  5. <?php } else { ?>
  6. //Catch all banner (if you use this add in a non-applicable spot) it will display this code) You could use this alone as a substitue for sub.domain1.com if you are only doing this on 2 sites.
  7. <?php } ?>

And your ads.php script for your advertisements should look something like this: وads.php السيناريو الخاص بك للإعلانات الخاصة بك ينبغي أن ننظر بشيء من هذا القبيل :

  1. <?php
  2. $parts = explode ( "/" , $HTTP_HOST ) ;
  3. $whichsite = $parts [ 0 ] ;
  4. include "http://www.domain.com/ads.php?whichsite=$whichsite" ;
  5. ?>

If you’re starting to learn PHP/mySQL I would strongly suggest an activity that would involve setting up a database which tracks banner loads. إذا كنت بدأت تعلم PHP / ماي. س. ك أود أن تشير بقوة إلى أن أي نشاط ينطوي على إنشاء قاعدة بيانات التي المسارات راية الأحمال. You could also set up a simple system that manages the domains and ads while you’re at it. أنت يمكن أيضا اقامة نظام بسيط أن تدير مجالات الاعلانات وبينما كنت في ذلك. Break the steps down and use this as a learning tool. كسر يتنحى واستخدام هذا ليكون أداة تعليمية. The only way I ever learned is when I had an excuse to create something or had a problem that needed fixing. والطريقة الوحيدة المستفادة هو الأول من أي وقت مضى عندما كان ذريعة لخلق شيء أو مشكلة تحتاج تثبيت. The possibilities are endless as you can apply this concept to things other then banner advertising! الاحتمالات لا حصر لها كما يمكنك تطبيق هذا المفهوم إلى أمور أخرى ثم راية الإعلان! Be creative with it! مع أنها تكون خلاقة!



Leave A Comment: ترك التعليق :

Comments RSS Feed التعليقات آر إس إس

6 - 1 = 6 -- 1 =

Custom Theme by Rob Malon | Content & Design © 2008 - Rob Malon [dot] Com. عرف الموضوع من جانب روب Malon | المحتوى و التصميم © 2008 -- روب Malon [نقطة] كوم. "));
"));