rocky48 Posted April 4, 2013 Share Posted April 4, 2013 Hi I am trying to include a script that I have tested on its own (and works fine), into the index.html page of my website. I am placing it in an Aside (on the left), when I run this on my ISP test folder it does not work. It displays the code from the first row of the table to the heading in the following html code. I can't spot anything obvious, so what is causing this error. This is the code I am running: <!--<?php require_once('mobile_device_detect.php'); mobile_device_detect('http://www.1066cards4u.co.uk/index1.html','http://www.1066cards4u.co.uk/index1.html','http://www.1066cards4u.co.uk/index1.html',false,'http://www.1066cards4u.co.uk/index1.html','http://www.1066cards4u.co.uk/index1.html','http://www.1066cards4u.co.uk/index1.html','http://www.1066cards4u.co.uk/index1.html',false); ?>--> <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <meta name="Description" content="Ecologic Theme"> <meta name="author" content="CoffeeCup Software, Inc."> <meta name="Copyright" content="Copyright (c) 2011 CoffeeCup, all rights reserved."> <link rel="shortcut icon" href="favicon.ico" > <link rel="icon" type="image/gif" href="animated_favicon1.gif" > <title>1066 Cards 4 U - Home</title> <link rel="stylesheet" href="stylesheets/default.css" /> <!--[if IE]> <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script> <![endif]--> </head> <body> <div id="fb-root"></div> <script>(function(d, s, id) { var js, fjs = d.getElementsByTagName(s)[0]; if (d.getElementById(id)) return; js = d.createElement(s); js.id = id; js.src = "//connect.facebook.net/en_GB/all.js#xfbml=1"; fjs.parentNode.insertBefore(js, fjs); }(document, 'script', 'facebook-jssdk'));</script> <header> <h1><a href="index.html"> ..............</a></h1></br></br></br></br> <div><img src="images/1066Green.jpg" width="600" height="80" alt="" title="" border="0" /></div> </header> <section id= "sidebarR" class= clear> <asideR> <?php include("RelHol_connect.php"); doDB(); $get_Event_sql = "SELECT Events.ID, Events.Event_Date, Events.Event_Description, Religion.ID, Religion.Religion FROM Events LEFT JOIN Religion ON Religion.ID = Faith_ID WHERE MONTHNAME(Events.Event_Date)= MONTHNAME(Now()) ORDER BY Events.Event_Date ASC"; $get_Event_res = mysqli_query($mysqli, $get_Event_sql) or die(mysqli_error($mysqli)); //create the display string $display_block = " <table width=\"30%\" cellpadding=\"3\" cellspacing=\"1\" border=\"1\" BGCOLOR=\"#87CEEB\"> <tr> <th>Date</th> <th>Event</th> <th>Faith</th> </tr>"; while ($Event_info = mysqli_fetch_array($get_Event_res)) { $Event_Date = $Event_info['Event_Date']; $Event_text = nl2br(stripslashes($Event_info['Event_Description'])); $Faith = $Event_info['Religion']; //add to display $display_block .= " <tr> <td width=\"5%\" valign=\"top\">".$Event_Date."</td> <td width=\"30%\" valign=\"top\">".$Event_text."</td> <td width=\"15%\" valign=\"top\">".$Faith."</td> </tr>"; } //free results mysqli_free_result($get_Event_res); //close connection to MySQL mysqli_close($mysqli); //close up the table $display_block .= "</table>"; ?> <h2>Religious Holidays & Festivals</h2> <?php echo $display_block; ?> </asideR> </section> <section id= "sidebarL" class= clear> <asideL> <div class="fb-like" data-href="http://www.1066cards4u.co.uk" data-send="true" data-layout="box_count" data-width="300" data-show-faces="true" data-font="arial"></div> </asideL> </section <section id="mainContent" class="clear"> <nav> <h3>Main Menu</h3> <p><ul> <li><a href="index.html">Home</a></li> <li><a href="Links.html">Links</a></li> <li><a href="Techniques.html">Techniques</a></li> <li><a href="Verse_Menu.html">Verse's</a></li> <li><a href="contact.html">Contact Us</a></li> <li><a href="News.html">News</a></li> <li><a href="AboutUs.html">About Us</a></li> <li><a href="Gallery.html">Gallery</a></li> <li><a href="index1.html">iPad users</a></li> </ul></p> </br> <h2 style="text-decoration:blink; color: red">NEWS FLASH!</h2> <h4><font color="red">I have been working on an iPad version of the web site, which is almost ready to roll. However if you have an iPad and want to use this you can access it by clicking on the link above or in the page footer (Sometimes the main link does not work). I am trying to solve some coding problems that auto detects mobile devices, which will automatically redirect to the iPad code.</h4> <!--<h4><font color="red">NEW LOOK website!</br>Smarter looking site, but unfortunately as the Forum has not been used since the launch we have decided to remove it.</br>However if you have any ideas or suggestions please use the Feedback Form on the contact us tab.</h4>--> <h4><font color="blue">We have made many minor changes - so please see NEWS page for details (Bulletin #.</font> </h4> <h4><font color="blue"> </br>For instructions on how to use the Verse Printing Utility! SEE NEW INSTRUCTION PDF file. ( Version 2.9 - 28th November 2012)</font> </h4> <h4><font color="blue"></br>A form for adding verses has been added to the Contact Us page! </font> </h4> </nav> <section id="mainLeft"> <div><img src="images/B1012F.jpg" width="250" height="250" alt="" title="" border="0" /> </div> <br /> <h1>Welcome to our site</h1> </br> <p>We are passionate about card making and we would like to invite you to share your interests in card making with us.</br> </br> On our Website we have many interesting items on our site that we think will be of interest to you. <ul TYPE=SQUARE> <li>Some links to suppliers websites</li> <li>Many articles on card making techniques</li> <li>A unique utility which allows you to print greetings verse for your cards</li> <li>Database of nearly 1000 verses</li> <li>The ability to type in your own verse</li> <li>Videos on card-making techniques in our Gallery</li> <li>Feedback facility to allow visitors to comment on our site</li> </ul> </p> </br> <p>We hope that you will enjoy our site and you will visit us again SOON!</p> </section> <!-- end mainLeft --> </section> <!-- end mainContent --> <footer> <p>© 2011 Ecologic, Inc. All rights reserved. <a href="http://coffeecup.com">HTML Editor Theme</a> by CoffeeCup Software.</br> © 2012 Content:1066 Cards 4U. All rights reserved. </p> <ul> <li><a href="index.html">Home</a></li> <li><a href="Links.html">Links</a></li> <li><a href="Techniques.html">Techniques</a></li> <li><a href="Verse_Menu.html">Verse's</a></li> <li><a href="contact.html">Contact Us</a></li> <li><a href="News.html">News</a></li> <li><a href="AboutUs.html">About Us</a></li> <li><a href="Gallery.html">Gallery</a></li> <br /> <li><a href="index1.html">iPad users</a></li> </ul> </footer> </br> </br> </br> </br> </body> </html> The added code is in red. Quote Link to comment https://forums.phpfreaks.com/topic/276530-php-code-in-html-index-page/ Share on other sites More sharing options...
Technocrat Posted April 4, 2013 Share Posted April 4, 2013 Its probably that your html file isnt being parsed as a php. You either need to use mod_rewrite to rewrite your .html to a .php page, or have your webserver parse html pages as php pages. Quote Link to comment https://forums.phpfreaks.com/topic/276530-php-code-in-html-index-page/#findComment-1422906 Share on other sites More sharing options...
jcbones Posted April 4, 2013 Share Posted April 4, 2013 Or, just change the file extension to .php on your main menu home page links. Quote Link to comment https://forums.phpfreaks.com/topic/276530-php-code-in-html-index-page/#findComment-1422960 Share on other sites More sharing options...
rocky48 Posted April 5, 2013 Author Share Posted April 5, 2013 Hi Tried changing to php extension but did not work, just got a blank page. Have never used mod_rewrite which I understand is an Apache utility. I don't know what server my ISP uses, but am checking with them. How do you make the webserver parse the html page as php? Quote Link to comment https://forums.phpfreaks.com/topic/276530-php-code-in-html-index-page/#findComment-1423032 Share on other sites More sharing options...
DaveyK Posted April 5, 2013 Share Posted April 5, 2013 What would you want that? What is the value to the user that it says .html instaed of .php, or even remove the extension altogether... Quote Link to comment https://forums.phpfreaks.com/topic/276530-php-code-in-html-index-page/#findComment-1423033 Share on other sites More sharing options...
rocky48 Posted April 10, 2013 Author Share Posted April 10, 2013 Hi DaveyK Don't understand what point you are trying to make! What's your solution then! Quote Link to comment https://forums.phpfreaks.com/topic/276530-php-code-in-html-index-page/#findComment-1423938 Share on other sites More sharing options...
Solution Jessica Posted April 10, 2013 Solution Share Posted April 10, 2013 Hi Tried changing to php extension but did not work, just got a blank page. Have never used mod_rewrite which I understand is an Apache utility. I don't know what server my ISP uses, but am checking with them. How do you make the webserver parse the html page as php? Did you check the error log? Does your server have PHP? You need to talk to your host. Quote Link to comment https://forums.phpfreaks.com/topic/276530-php-code-in-html-index-page/#findComment-1423939 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.