Did you recently take my advice on manging banners ? Onko sinulla äskettäin ottaa minun neuvoja manging bannerit? Or maybe you’re just putting advertisements on your site for the first time this month? Tai ehkä olet vain laskemisesta mainoksia sivustossasi ensimmäistä kertaa tässä kuussa? Either way you’ll find as your sites grow, its a lot of work to manage banner advertisements. Joka tapauksessa löydät kuten sivustojen kasvaa, sen paljon työtä hoitaa banneri mainoksia. 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). Voisit mennä jotain OpenAds mutta sovelluksiin, kuten tässä on verottaa palvelimelle tehokkuus - varsinkin, jos olet jaetun hosting-suunnitelma (Uusin versin on OpenAds käyttää 16 megatavua muistia). Sometimes simple is better and effective! Joskus yksinkertainen on parempi ja tehokas! Here’s some PHP coding tips to set yourself up for banner automation. Seuraavassa joitakin PHP koodaus vinkkejä asettaa itseäsi varten banner automaatiota.

The first step involves grabbing the current pages domain. Ensimmäinen askel kuuluu napata nykyinen sivut verkkotunnuksen. Break the url on the slashes like so. Break the URL-osoitteen vinoviivoilla kuten niin. This should go in your template page. Tämän pitäisi mennä oman mallin sivulla.
$parts = explode(”/”, $HTTP_HOST); $ osat = räjähtää ("/", $ HTTP_HOST);

This creates an array which we can now pick and choose an element to access. Tämä luo jono, jonka voimme nyt valita osa käyttää. The first array “0″ is the first part of the array. Ensimmäinen jono "0" on ensimmäinen osa joukko. This contains everything between the http:// and the start of the next slash if there is one. Tämä sisältää kaiken välillä http:// ja seuraavan alku kauttaviiva, jos sellainen on. 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. Nyt voit tallentaa, että muuttuja "$ whichsite". HUOMAUTUS: Voit käyttää näitä samoja sääntöjä hakemistoja tai sivuilla sivuston nousee osa muuttuja. This should go your template page. Tämän pitäisi mennä oman mallin sivulla.
$whichsite = $parts[0]; $ whichsite = $ osat [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. Nyt käyttää sisältää paikalla sivulla (todennäköisesti mallina jossakin sivustollasi), joissa haluat mainoksen näkyvän. This again, goes in your sites template. Tämä uudelleen, menee sivustojen malliin.
include http://www.domain.com/ads.php?whichsite=$whichsite; sisällyttää 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. Luo IF julkilausuma tarkastaa ja katsoa, mitä verkkotunnus on valittu. HUOM: jos sen ei osa-verkkotunnus, jota "haluavat tulla sen WWW vastine, koska sivusto voi yleensä saada domain.com tai www.domain.com.
if($whichsite == “www.extreme-gamerz.org” || $whichsite == “extreme-gamerz.org”) if ($ whichsite == "www.extreme-gamerz.org" | | $ whichsite == "Extreme-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 “||”. Jos on muita linkkejä haluat olla sama edellytys edelleen lisätä ne erottamalla ne toisistaan "||". This specifies an OR statement in PHP. Tämä määrittää OR julkilausuma PHP. This code should go in a new document named “ads.php” which we called in the past step. Tämä koodi pitäisi mennä uuden asiakirjan nimeltä "ads.php", jossa vaadimme viime vaiheeseen. Your ads should go in-between each if statement accordingly. Mainoksesi pitäisi mennä välillä kunkin jos ilmoitus vastaavasti.

The code in your template should look like this: Koodi oman mallin pitäisi näyttää tältä:

  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: Ja ads.php komentojono teidän mainoksia tulisi näyttää suunnilleen tältä:

  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. Jos olet alkanut oppia PHP / MySQL haluan viittaavat vahvasti siihen, mikä olisi perustaa tietokanta, jonka kappaleet banner kuormia. You could also set up a simple system that manages the domains and ads while you’re at it. Voit myös luoda yksinkertainen järjestelmä, joka hallinnoi domains ja mainoksia, kun olet sitä. Break the steps down and use this as a learning tool. Break vaiheet alas ja käyttää tämä on oppimisen välineenä. The only way I ever learned is when I had an excuse to create something or had a problem that needed fixing. Ainoa tapa olen koskaan oppinut, kun minulla oli tekosyy luoda jotain tai ollut ongelma, että tarvitaan vahvistettavaksi. The possibilities are endless as you can apply this concept to things other then banner advertising! Mahdollisuudet ovat rajattomat kuin voit käyttää tätä käsitettä asioihin muut bannerimainokset! Be creative with it! Ole luova sen kanssa!



Leave A Comment: Jätä kommentti:

Comments RSS Feed Kommentit RSS-syöte

7 3 = 7 3 =

Custom Theme by Rob Malon | Content & Design © 2008 - Rob Malon [dot] Com. Custom Theme: Rob Malon | Sisältö & Design © 2008 - Rob Malon [piste] com. "));
"));