SitePoint Sponsor

User Tag List

Results 1 to 23 of 23
  1. #1
    SitePoint Zealot
    Join Date
    Jan 2013
    Posts
    110
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    convert .html to .php -> fail

    i have a .html file as below which works fine when i run it in apache2 but when i change the file extension to .php file it cant work properly. Please suggest your idea. Thank you.

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Untitled Document</title>
    <link href="jquery.mobile-1.0/jquery.mobile-1.0.css" rel="stylesheet" type="text/css" />
    <link href="css/jqm-docs.css" rel="stylesheet" type="text/css" />
    <script src="jquery.mobile-1.0/jquery-1.6.4.min.js" type="text/javascript"></script>
    <script src="jquery.mobile-1.0/jquery.mobile-1.0.min.js" type="text/javascript"></script>

    </head>

    <body>
    <div data-role="page">
    <div id="jqm-homeheader">
    <h1 id="jqm-logo"><img src="file:///C|/Users/Asus/Desktop/title.png" width="1344" height="111" /></h1>
    <h1 style="font-family:Tahoma, Geneva, sans-serif; color:#00F;"> Welcome to Student Online Progress Analysis System</h1>
    </div>
    <div data-role="content" data-theme="d">
    <ul data-role="listview" data-filter="true" data-inset="true">
    <li data-theme="d">
    <h3>Data Management</h3>
    <p>All confidential data will kept in the server database and can be editted or updated only by administrator</p>
    <ul data-theme="d">
    <li>Key in new data
    <ul data-theme="d">

    </ul>
    </li>
    <li>Update database
    <ul data-theme="d">
    <li><a href="index.html">Chicken</a></li>
    <li><a href="index.html">Cow</a></li>
    <li><a href="index.html">Duck</a></li>
    <li><a href="index.html">Horse</a></li>
    <li><a href="index.html">Pig</a></li>
    <li><a href="index.html">Sheep</a></li>
    </ul>
    </li>
    <li>View Record
    <ul data-theme="d">
    <li><a href="index.html">Aardvark</a></li>
    <li><a href="index.html">Alligator</a></li>
    <li><a href="index.html">Ant</a></li>
    <li><a href="index.html">Bear</a></li>
    <li><a href="index.html">Beaver</a></li>
    <li><a href="index.html">Cougar</a></li>
    <li><a href="index.html">Dingo</a></li>
    <li><a href="index.html">Eagle</a></li>
    <li><a href="index.html">Elephant</a></li>
    <li><a href="index.html">Ferret</a></li>
    <li><a href="index.html">Frog</a></li>
    <li><a href="index.html">Giraffe</a></li>
    <li><a href="index.html">Lion</a></li>
    <li><a href="index.html">Monkey</a></li>
    <li><a href="index.html">Panda bear</a></li>
    <li><a href="index.html">Polar bear</a></li>
    <li><a href="index.html">Tiger</a></li>
    <li><a href="index.html">Zebra</a></li>
    </ul>
    </li>
    </ul>
    </li>
    <li>
    <h3>Colors</h3>
    <p>Fresh colors from the magic rainbow.</p>
    <ul data-theme="d">
    <li><a href="index.html">Blue</a></li>
    <li><a href="index.html">Green</a></li>
    <li><a href="index.html">Orange</a></li>
    <li><a href="index.html">Purple</a></li>
    <li><a href="index.html">Red</a></li>
    <li><a href="index.html">Yellow</a></li>
    <li><a href="index.html">Violet</a></li>
    </ul>
    </li>
    <li>
    <h3>Vehicles</h3>
    <p>Everything from cars to planes.</p>
    <ul data-theme="d">
    <li>Cars
    <ul data-theme="d">
    <li><a href="index.html">Acura</a></li>
    <li><a href="index.html">Audi</a></li>
    <li><a href="index.html">BMW</a></li>
    <li><a href="index.html">Cadillac</a></li>
    <li><a href="index.html">Chrysler</a></li>
    <li><a href="index.html">Dodge</a></li>
    <li><a href="index.html">Ferrari</a></li>
    <li><a href="index.html">Ford</a></li>
    <li><a href="index.html">GMC</a></li>
    <li><a href="index.html">Honda</a></li>
    <li><a href="index.html">Hyundai</a></li>
    <li><a href="index.html">Infiniti</a></li>
    <li><a href="index.html">Jeep</a></li>
    <li><a href="index.html">Kia</a></li>
    <li><a href="index.html">Lexus</a></li>
    <li><a href="index.html">Mini</a></li>
    <li><a href="index.html">Nissan</a></li>
    <li><a href="index.html">Porsche</a></li>
    <li><a href="index.html">Subaru</a></li>
    <li><a href="index.html">Toyota</a></li>
    <li><a href="index.html">Volkswagon</a></li>
    <li><a href="index.html">Volvo</a></li>
    </ul>
    </li>
    <li>Planes
    <ul data-theme="d">
    <li><a href="index.html">Boeing</a></li>
    <li><a href="index.html">Cessna</a></li>
    <li><a href="index.html">Derringer</a></li>
    <li><a href="index.html">Embraer</a></li>
    <li><a href="index.html">Gulfstream</a></li>
    <li><a href="index.html">Piper Aircraft</a></li>
    <li><a href="index.html">Raytheon</a></li>
    </ul>
    </li>
    <li>Construction
    <ul data-theme="d">
    <li><a href="index.html">Caterpillar</a></li>
    <li><a href="index.html">Ford</a></li>
    <li><a href="index.html">John Deere</a></li>
    </ul>
    </li>
    </ul>
    </li>
    </ul>
    </div>
    </div>
    </body>
    </html>
    The widget works fine in .html extension and once i changed it to .php extenstion it can't run.

  2. #2
    It's all Geek to me silver trophybronze trophy
    ralph.m's Avatar
    Join Date
    Mar 2009
    Location
    Melbourne, AU
    Posts
    24,203
    Mentioned
    456 Post(s)
    Tagged
    8 Thread(s)
    By the look of your file paths (e.g. src="file:///C|/Users/Asus/Desktop/title.png") is seems you are running this page on your local machine. PHP won't run on your local machine unless you have a server environment set up. That's just a suggestion. There's no actual PHP in that page, so maybe you should explain a bit more about what you are trying to do here.

  3. #3
    SitePoint Zealot
    Join Date
    Jan 2013
    Posts
    110
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by ralph.m View Post
    By the look of your file paths (e.g. src="file:///C|/Users/Asus/Desktop/title.png") is seems you are running this page on your local machine. PHP won't run on your local machine unless you have a server environment set up. That's just a suggestion. There's no actual PHP in that page, so maybe you should explain a bit more about what you are trying to do here.
    Hye there,thanks for replying. Actually u can just ignore the picture path as it does not effect anything (forgot to delete it). Actually when i run this page in .html, if you can look through abit to this code there's a button "data management" am i right? when i click on it, it will go to another page with "data management" as it title and 3 other choices below but when i tried to run it in .php and i click the "data management" button, nothing happened.I can't really upload the output picture here and i don't know why@.@ so i hope you understand my point.

  4. #4
    It's all Geek to me silver trophybronze trophy
    ralph.m's Avatar
    Join Date
    Mar 2009
    Location
    Melbourne, AU
    Posts
    24,203
    Mentioned
    456 Post(s)
    Tagged
    8 Thread(s)
    when i click on it, it will go to another page with "data management" as it title and 3 other choices below
    It doesn't go to anther page, but the content on that same page is revealed by JavaScript (JS). None of that data stuff has anything to do with PHP—at least as far as your code goes. The paths to your JS sound like they are broken. Have you moved the .php version of the page to a different location from the .html version?

  5. #5
    SitePoint Zealot
    Join Date
    Jan 2013
    Posts
    110
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by ralph.m View Post
    It doesn't go to anther page, but the content on that same page is revealed by JavaScript (JS). None of that data stuff has anything to do with PHP—at least as far as your code goes. The paths to your JS sound like they are broken. Have you moved the .php version of the page to a different location from the .html version?
    yes you are right. it does not go to the other page but the content on that same page is revealed by js. do i need to separate the .html version and .php version ?

  6. #6
    SitePoint Zealot
    Join Date
    Jan 2013
    Posts
    110
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by ralph.m View Post
    It doesn't go to anther page, but the content on that same page is revealed by JavaScript (JS). None of that data stuff has anything to do with PHP—at least as far as your code goes. The paths to your JS sound like they are broken. Have you moved the .php version of the page to a different location from the .html version?
    i tried to move the .html version to other location but still the result is the same. about the broken link, how can i fix it?

  7. #7
    SitePoint Mentor bronze trophy
    John_Betong's Avatar
    Join Date
    Aug 2005
    Location
    City of Angels
    Posts
    1,838
    Mentioned
    73 Post(s)
    Tagged
    6 Thread(s)
    Quote Originally Posted by Marvin_G View Post
    i tried to move the .html version to other location but still the result is the same. about the broken link, how can i fix it?
    After renaming your file with the .php extension, add this first line:


    PHP Code:

    <?php /* dummy comment. */ ?>
    Learn how to be ready for The New Move to Discourse

    How to make Make Money Now with a *NEW* look

    Be sure to congratulate Patche on earning Member of the Month for July 2014

  8. #8
    SitePoint Zealot
    Join Date
    Jan 2013
    Posts
    110
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by John_Betong View Post
    After renaming your file with the .php extension, add this first line:


    PHP Code:

    <?php /* dummy comment. */ ?>
    u mean add it on the first line or anywhere in the code?

  9. #9
    SitePoint Mentor bronze trophy
    John_Betong's Avatar
    Join Date
    Aug 2005
    Location
    City of Angels
    Posts
    1,838
    Mentioned
    73 Post(s)
    Tagged
    6 Thread(s)
    Quote Originally Posted by Marvin_G View Post
    u mean add it on the first line or anywhere in the code?
    Make that your first line then the doctype, etc
    Learn how to be ready for The New Move to Discourse

    How to make Make Money Now with a *NEW* look

    Be sure to congratulate Patche on earning Member of the Month for July 2014

  10. #10
    SitePoint Zealot
    Join Date
    Jan 2013
    Posts
    110
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by John_Betong View Post
    After renaming your file with the .php extension, add this first line:


    PHP Code:

    <?php /* dummy comment. */ ?>
    i add simple php code (echo "hello") at the very first line and run it but it didnt echo the words. the same page coming out

  11. #11
    SitePoint Zealot
    Join Date
    Jan 2013
    Posts
    110
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by John_Betong View Post
    Make that your first line then the doctor, etc
    sorry but what is this "&/Lt;! Doctor html"?

  12. #12
    SitePoint Mentor bronze trophy
    John_Betong's Avatar
    Join Date
    Aug 2005
    Location
    City of Angels
    Posts
    1,838
    Mentioned
    73 Post(s)
    Tagged
    6 Thread(s)
    Quote Originally Posted by Marvin_G View Post
    sorry but what is this "&/Lt;! Doctor html"?
    Whoops sorry about that. This keyboard has a mind of its own.

    I was trying to type the less than symbol and doctype.

    You were too quick and read the first version
    Learn how to be ready for The New Move to Discourse

    How to make Make Money Now with a *NEW* look

    Be sure to congratulate Patche on earning Member of the Month for July 2014

  13. #13
    SitePoint Mentor bronze trophy
    John_Betong's Avatar
    Join Date
    Aug 2005
    Location
    City of Angels
    Posts
    1,838
    Mentioned
    73 Post(s)
    Tagged
    6 Thread(s)
    Quote Originally Posted by Marvin_G View Post
    i add simple php code (echo "hello") at the very first line and run it but it didnt echo the words. the same page coming out
    I think that either there's is an error in your script or apache, php/mysql is not installed.

    Try this:
    PHP Code:
    <?php echo 'hello sitepoint';

    // no closing statement necessary
    Learn how to be ready for The New Move to Discourse

    How to make Make Money Now with a *NEW* look

    Be sure to congratulate Patche on earning Member of the Month for July 2014

  14. #14
    SitePoint Zealot
    Join Date
    Jan 2013
    Posts
    110
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by John_Betong View Post
    I think that either there's is an error in your script or apache, php/mysql is not installed.

    Try this:
    PHP Code:
    <?php echo 'hello sitepoint';

    // no closing statement necessary
    error would occured if didn't put closing statement.

  15. #15
    SitePoint Mentor bronze trophy
    John_Betong's Avatar
    Join Date
    Aug 2005
    Location
    City of Angels
    Posts
    1,838
    Mentioned
    73 Post(s)
    Tagged
    6 Thread(s)
    Quote Originally Posted by Marvin_G View Post
    error would occured if didn't put closing statement.
    Back on my keyboard

    I make s special point not to have the closing PHP statement to ensure no white space errors occur.

    Read the comments on this thread:
    http://stackoverflow.com/questions/4...-the-close-tag
    Learn how to be ready for The New Move to Discourse

    How to make Make Money Now with a *NEW* look

    Be sure to congratulate Patche on earning Member of the Month for July 2014

  16. #16
    SitePoint Zealot
    Join Date
    Jan 2013
    Posts
    110
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by John_Betong View Post
    Back on my keyboard

    I make s special point not to have the closing PHP statement to ensure no white space errors occur.

    Read the comments on this thread:
    http://stackoverflow.com/questions/4...-the-close-tag
    i understand what are you trying to say but the script which i posted works well in .hmtl extension and the thing is once i changed the extension without changing any of the code there's some problem occured example like when i clicked certain button, it does not respond. Just like ralph.m said, the path to my js seems broken. i think thats the main problem now.

  17. #17
    SitePoint Mentor bronze trophy
    John_Betong's Avatar
    Join Date
    Aug 2005
    Location
    City of Angels
    Posts
    1,838
    Mentioned
    73 Post(s)
    Tagged
    6 Thread(s)
    There could be numerous reasons why your PHP script is failing and as you mentioned that the javascript may be the problem. It could also be the it is a BOM file.

    The code I supplied would prove that your Apache and PHP are set correctly. Try this and if there are any errors they will be displayed:

    PHP Code:

    <?php
      error_reporting
    (-1); 
      
    ini_set('display_errors',1);

      echo 
    'Hello Sitepoint';
    I prefer starting with some script that works then gradually adding more script then fixing the errors if and when they appear.
    Learn how to be ready for The New Move to Discourse

    How to make Make Money Now with a *NEW* look

    Be sure to congratulate Patche on earning Member of the Month for July 2014

  18. #18
    SitePoint Zealot
    Join Date
    Jan 2013
    Posts
    110
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by John_Betong View Post
    There could be numerous reasons why your PHP script is failing and as you mentioned that the javascript may be the problem. It could also be the it is a BOM file.

    The code I supplied would prove that your Apache and PHP are set correctly. Try this and if there are any errors they will be displayed:

    PHP Code:

    <?php
      error_reporting
    (-1); 
      
    ini_set('display_errors',1);

      echo 
    'Hello Sitepoint';
    I prefer starting with some script that works then gradually adding more script then fixing the errors if and when they appear.
    tried it already and no error comes out and the "Hello sitepoint" also not coming out. maybe because it direct went to the code below and covered up the words. is it?

  19. #19
    SitePoint Mentor bronze trophy
    John_Betong's Avatar
    Join Date
    Aug 2005
    Location
    City of Angels
    Posts
    1,838
    Mentioned
    73 Post(s)
    Tagged
    6 Thread(s)
    Quote Originally Posted by Marvin_G View Post
    tried it already and no error comes out and the "Hello sitepoint" also not coming out. maybe because it direct went to the code below and covered up the words. is it?
    There should be no code after the echo "Hello Sitepoint";

    The idea is to start with a page that works correctly with no errors or warnings then to gradually add code. If any errors or warnings appear then find the cause and fix the errors.

    Your script can be seen working here:

    http://www.johns-jokes.com/downloads.../index-001.php
    Learn how to be ready for The New Move to Discourse

    How to make Make Money Now with a *NEW* look

    Be sure to congratulate Patche on earning Member of the Month for July 2014

  20. #20
    SitePoint Zealot
    Join Date
    Jan 2013
    Posts
    110
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by John_Betong View Post
    There should be no code after the echo "Hello Sitepoint";

    The idea is to start with a page that works correctly with no errors or warnings then to gradually add code. If any errors or warnings appear then find the cause and fix the errors.

    Your script can be seen working here:

    http://www.johns-jokes.com/downloads.../index-001.php
    u mean by just executing php code? ofcourse i can execute it. i've so many .php files works and there's nothing wrong about it. the link u gave me is actually not complete because i you don't have the .css and .js script which called in the code i gave previously so u can't really see the "data management" button that suppose to link to the .js file. i tried to upload picture here but cannot and i dont know why@.@

  21. #21
    It's all Geek to me silver trophybronze trophy
    ralph.m's Avatar
    Join Date
    Mar 2009
    Location
    Melbourne, AU
    Posts
    24,203
    Mentioned
    456 Post(s)
    Tagged
    8 Thread(s)
    Can you post a link to the page?

  22. #22
    SitePoint Zealot
    Join Date
    Jan 2013
    Posts
    110
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by ralph.m View Post
    Can you post a link to the page?
    after spending all night figuring this out i finally solved the problem. i created new copy of the .php version of file and then moved it into a new folder along with the .js and .css file. When i tried to execute it again,it works!

  23. #23
    It's all Geek to me silver trophybronze trophy
    ralph.m's Avatar
    Join Date
    Mar 2009
    Location
    Melbourne, AU
    Posts
    24,203
    Mentioned
    456 Post(s)
    Tagged
    8 Thread(s)
    Hehe, that was the most likely problem. You can update the links so that they will find those files from any folder.


Bookmarks

Posting Permissions

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