1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

PHP include help!

Discussion in 'PHP' started by andymayo, Jul 9, 2008.

  1. #1
    Ok i have this working script now thanks to a member here:


    that works perfect.. now i need to use it as an include on my forums.. please give me the right code! :D

    thanks,

    -Andy
    SEMrush
    EDIT: this is called random_image.php
     
    andymayo, Jul 9, 2008 IP
    SEMrush
  2. James.Blant

    James.Blant Active Member

    Messages:
    250
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    60
    #2
    it's so easy !
    <?php include('random_image.php'); ?>
     
    James.Blant, Jul 9, 2008 IP
  3. ForTheWin

    ForTheWin Peon

    Messages:
    13
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    you could also use require("random_image.php");

    Require and Include do almost the same thing.

    If an error is detected on random_image.php while using require then the script will stop. However if it is detected while using include it will continue to execute the script.

    This makes require a tad bit safer depending on what you want to accomplish.
     
    ForTheWin, Jul 9, 2008 IP
  4. andymayo

    andymayo Guest

    Messages:
    652
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Ok dude ur right.. that code does work in a html page.. on my VB forums (in the right place.. i did check:D) not so much.
     
    andymayo, Jul 9, 2008 IP
  5. ForTheWin

    ForTheWin Peon

    Messages:
    13
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    So theres another problem?
     
    ForTheWin, Jul 9, 2008 IP
  6. luden

    luden Active Member

    Messages:
    155
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    53
    #6
    Save your code in a php file! then include it into your script!
     
    luden, Jul 9, 2008 IP
  7. Danltn

    Danltn Well-Known Member

    Messages:
    679
    Likes Received:
    36
    Best Answers:
    0
    Trophy Points:
    120
    #7
    Post some code please so we can see where you're trying to post it, it may be that you need to write a plugin (if VB has them - haven't used it much myself) to allow you to integrate this in posts for example.

    Dan
     
    Danltn, Jul 9, 2008 IP
  8. James.Blant

    James.Blant Active Member

    Messages:
    250
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    60
    #8
    if you need to insert HTML codes to call this page use AJAX to grab file and show it ( with Javascript and XML HTTP request ) or use iframe .
     
    James.Blant, Jul 9, 2008 IP
  9. andymayo

    andymayo Guest

    Messages:
    652
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    0
    #9
    andymayo, Jul 10, 2008 IP