Jump to content

MY FIRST TOPIC .. NEED HELP PLZ


albasel

Recommended Posts

Hello every body here

 

I have a folder contain more than 6oo htm pages and I want to call them in one php file

I have this code working fine but this time failed to show the htm files.

 

This is the php code

<?php
        if (!isset($_GET['p'])) { // If no page is chosen load this page
             include("pages/main.htm");
        }
        else{
             $filename="pages/" . $_GET['p'] . ".htm";
             if (file_exists($filename)){
                 include("pages/" . $_GET['p'] . ".htm");
             }
             else{
                 include("pages/error.htm");
             }

        }

        ?>

 

I usually link to display htm pages as follow

 

example

index.php?p=100

 

and the htm page 100 from the the directory will be called and displayed

 

I do not why this time it is not working with me

 

please i need help ASA

 

or some one do for me new php code

 

Link to comment
Share on other sites

What error are you getting?

Are the pages you are trying to show html files, or just file with no extension?

Because that could be the problem if it is trying to show "/pages/100.htm.htm", and it doesn't exist.

 

 

Also please refrain from all caps thread titles ::)

Link to comment
Share on other sites

Not sure what is wrong but:

             $filename="pages/" . $_GET['p'] . ".htm";
            if (file_exists($filename)){
                include("pages/" . $_GET['p'] . ".htm");

Is pointless excess code. Should be:

             $filename="pages/" . $_GET['p'] . ".htm";
            if (file_exists($filename)){
                include($filename);

Link to comment
Share on other sites

That isn't going to help you. All it will do is reduce the code size making it shorter, its the same code, just with better use of a variable.

 

How about you let me know what this does:

 

$filename="./pages/" . $_GET['p'] . ".html";
             if (file_exists($filename)){
                 include($filename);

Link to comment
Share on other sites

I have try this also those not work

$filename="./pages/" . $_GET['p'] . ".html";
             if (file_exists($filename)){
                 include($filename);

 

DIR name is pages

Incloude 650 htm pages

i have index php file not in the same DIR beside the pages DIR

i want to call the htm pages in the from the pages DIR

 

plz

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.