Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 10 of 10

Thread: PHP include

  1. #1
    New to the CF scene
    Join Date
    Mar 2008
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    PHP include

    How do I make the code below work with a dynamic url?:

    <?php
    print "Latest Blog: ";
    include ("http://www.abc.com/aforum/blog.php?styleid=3");
    ?>

    The script above is not recognizing the ?styleid=3 when the script above is saved as blogz.php

    Thanks,
    Bryan
    Last edited by bryanfl1001; 03-22-2008 at 02:42 AM.

  • #2
    Regular Coder
    Join Date
    Mar 2008
    Posts
    103
    Thanks
    1
    Thanked 8 Times in 8 Posts
    if the file is in the same directory try this

    <?php
    print "Latest Blog: ";
    include ("/blog.php?styleid=3");
    ?>

  • #3
    Master Coder
    Join Date
    Jun 2003
    Location
    Cottage Grove, Minnesota
    Posts
    9,502
    Thanks
    8
    Thanked 1,089 Times in 1,080 Posts
    <?php
    print "Latest Blog: ";
    include ("http://www.abc.com/aforum/blogz.php?styleid=3");
    ?>

  • #4
    Regular Coder
    Join Date
    Mar 2008
    Posts
    103
    Thanks
    1
    Thanked 8 Times in 8 Posts
    blogz is the name of his file with in include in it at least thats what he made it seem like.

  • #5
    New to the CF scene
    Join Date
    Mar 2008
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    PHP include

    I tried to use the following script below but it does not show the page http://www.MyWebsite.com/aforum/blog.php?styleid=3

    <?php
    print "Latest Blog: ";

    if($_GET['styleid']==3) {
    include("http://www.MyWebsite.com/aforum/blog.php");
    }
    elseif($_GET['styleid']==3) {
    include("http://www.MyWebsite.com/aforum/blog.php");
    }
    ?>

  • #6
    Regular Coder
    Join Date
    Mar 2008
    Posts
    103
    Thanks
    1
    Thanked 8 Times in 8 Posts
    Wait, explain EXACTLY what you want to do with this include it seems like you want to try to include a style in which case do this:
    PHP Code:
    <?php
    $styleid 
    $_GET['style'];
         if(
    $styleid == 1){
              include(
    '/style1.css');
         }
         elseif(
    $styleid == 2){
              include(
    '/style2.css');
         }
         else{
              include(
    '/default.css');
         }
    ?>

  • #7
    New to the CF scene
    Join Date
    Mar 2008
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts
    This is actually for a url to a forum that has its own style. I tried what you said but it gave me the following error:

    Latest Blog:
    Warning: main() [function.include]: Failed opening '' for inclusion (include_path='.:/usr/local/lib/php') in /home/admin/domains/MyWebsite.com/public_html/blogpost.php on line 9

    This is the script I used from your advise:
    <?php
    print "Latest Blog: ";

    $styleid = $_GET['styleid'];
    if($styleid == 3){
    include('http://www.MyWebsite.com/aforum/blog.php');
    }
    else{
    include('');
    }
    ?>

  • #8
    Regular Coder
    Join Date
    Mar 2008
    Posts
    103
    Thanks
    1
    Thanked 8 Times in 8 Posts
    because you dont have a file called ''. use this

    <?php
    print "Latest Blog: ";

    $styleid = $_GET['styleid'];
    if($styleid == 3){
    include('http://www.MyWebsite.com/aforum/blog.php');
    }
    else{
    die("style not found");
    }
    ?>

  • #9
    New to the CF scene
    Join Date
    Mar 2008
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    PHP include

    p4plus2 I sent you a private message

  • #10
    Regular Coder
    Join Date
    Mar 2008
    Posts
    103
    Thanks
    1
    Thanked 8 Times in 8 Posts
    Check pm I found your problem.


  •  

    Posting Permissions

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