Web Analytics Made Easy -
StatCounter Help Calling Pages - CodingForum

Announcement

Collapse
No announcement yet.

Help Calling Pages

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new 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
    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.
    "Tango says double quotes with a single ( ' ) quote in the middle"
    '$Name says single quotes with a double ( " ) quote in the middle'
    "Tango says double quotes ( \" ) must escape a double quote"
    '$Name single quotes ( \' ) must escape a single quote'

    Comment


    • #3
      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.

      Comment

      Working...
      X
      😀
      🥰
      🤢
      😎
      😡
      👍
      👎