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 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Sep 2011
    Location
    Canada, On.
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Help Calling Pages

    PHP Code:
    if(!$_POST['page']) die("0");

    $page = (int)$_POST['page'];

    if(
    file_exists('pages/page_'.$page.'.php'))
    echo 
    file_get_contents('pages/page_'.$page.'.php');

    else echo 
    'Page does not exist! Go back!'
    Ok, so the code i displayed will fetch the file "page_1,2,3,4" from the folder. When i go to use "#pagefaq" it will not fetch it. I have to use a number for it to fetch the page. ex: "#page1". I want/and am trying to code another type of php line like the one for "page" but instead i want it to use "faq" so i can have a seperate linking system to keep the pages in order. I am still working on the problem right now, but i am not sure how to go about it correctly, so im kind of trial and erroring as i go along, seeing if random things i think of work. So far, no luck. Can anyone help me?

  • #2
    Senior Coder
    Join Date
    Feb 2011
    Location
    Your Monitor
    Posts
    4,306
    Thanks
    57
    Thanked 525 Times in 512 Posts
    Blog Entries
    5
    If I understand you're description properly, you're tying to read out the portion of a page which has an anchor. file_get_contents won't do that I'm afraid. It will read out the entire file only.

    It isn't a browser like IE, FF etc so it doesn't understand html anchors - it just see's file text and an end of file marker.
    See my new CodingForums Blog: http://www.codingforums.com/blogs/tangoforce/

    Many useful explanations and tips including: Cannot modify headers - already sent, The IE if (isset($_POST['submit'])) bug explained, unexpected T_CONSTANT_ENCAPSED_STRING, debugging tips and much more!

  • #3
    New to the CF scene
    Join Date
    Sep 2011
    Location
    Canada, On.
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Yes, it's anchored to the main area of which i want all content to be displayed. That works fine. When i use the "#page1" making links, it links perfectly fine! But when i try to use something like "#pagefaq" so i can get a specific name for a page to keep the order of the pages so i know specifically what they are. But it wont let me do anything but "#page[some random number]". So i wanted to know how to add in another php code in the one i displayed so that i could properly call upon "#faq1" as well as "#page1" and have them display in the same area.

    I have a seperate page of jquery coding helping it display in my main area also.


  •  

    Posting Permissions

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