Adding div/frame to all pages on a domain

Discussion in 'Programming' started by Tomp, Apr 8, 2007.

  1. #1
    Hello everyone,

    Im compleatly stuck on how i can do this.

    I have a domain which i offer free web hosting on (subdomain hosting) and i want to display a small advert on each page that is on the domain.

    Ether by using a fram, displaying a div, so it shows on every single page of the domain.

    Any ideas?

    Tom
     
    Tomp, Apr 8, 2007 IP
  2. Tomp

    Tomp Well-Known Member

    Messages:
    279
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    105
    #2
    everyone as stumped as me then? lol
     
    Tomp, Apr 9, 2007 IP
  3. Weizheng

    Weizheng Peon

    Messages:
    93
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    0
    #3
    If you're using Apache, there's the htaccess mod rewrite module that allows you to prepend html codes into pages.
     
    Weizheng, Apr 11, 2007 IP
  4. Tomp

    Tomp Well-Known Member

    Messages:
    279
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    105
    #4
    Thanks Weizheng i looked into that and i found that onyl modified php files, so after looking into it alot more i managed to get this working:

    you need to add the following to the htaccess file

    for adverts at top:

    AddHandler application/x-httpd-php .htm .html
    php_value auto_prepend_file "advert.php"


    for adverts at bottom:

    AddHandler application/x-httpd-php .htm .html
    php_value auto_append_file "advert.php"

    and has

    AllowOverride All

    set in the httpd.conf

    then you need to create the file your prepending.

    The effect is www.one9.co.uk & http://tehpa1n.one9.co.uk

    or if you want it to show on a subdomain without having all the files in there, use the following in the subdomains htaccess file:

    AddHandler application/x-httpd-php .htm .html
    php_value auto_append_file "/home/accountname/public_html/advert.php"

    I then used the cpanel skeleton file to add this to all new accounts :)

    Hope that helps someone else out who is looking to do the same
     
    Tomp, Apr 15, 2007 IP