SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Member
    Join Date
    Aug 2007
    0 Post(s)
    0 Thread(s)

    Ads controlling form required

    I have a website built in php and I have embedded some google ads in it.
    I manually go and edit the pages and add the google ads everytime.

    I like to have fill in form where I can paste the google ads of respective size in it space and save it. So the saved ads reflect in the pages. This is just to avoid play with the code every time.

    How can I do it? any idea guys. I am not so familiar with PHP. I would appreciate your help.


  2. #2
    SitePoint Enthusiast Linkoroo's Avatar
    Join Date
    Jul 2009
    0 Post(s)
    0 Thread(s)
    If I understand correctly you want to manage the ads in you pages.

    You could store the ads code in a DB or even in an array. The array is simpler. Here's an example.

    You could have a page called AdManager.php and in there could have something like this:

    $_SESSION['ads'] = array();
    $_SESSION['ads']['index'] = "ad code";
    $_SESSION['ads']['page'] = "ad code";

    That's a dictionary. You can access the array by name instead of index. So you add one for every page you want an ad in.

    In the pages you want an ad you simply include this file, AdManager.php, and you echo the ad. Example: So you want a google ad in index.php


    With this you can elaborate even more but this should be a good start. Hope that helps!


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts