php - Styling html page? -


i trying create custom cms using php. trying allow "admin" create different html pages different contents!

the page creation going goes if html page basic , has no styling or jquery stuff in it! html pages have css styling , javascript , jquery codes in reason having them in page stop html page creation in php!

the first code (working one) uses:

`$html = "<html>\n<body>\n<p>hello world</p>\n</body>\n</html>";` 

and second code (the non working one) uses this:

$html = "the whole html page css , javascript/jquery copy/pasted here"; 

this code works fine:

<? if ($_post["filename"]) { error_reporting(0); $i=1; while($file = fopen("untitled$i.html", "r")) { fclose($file); $i++; } if($file = fopen("untitled$i.html", "w")) { $html = "<html>\n<body>\n<p>hello world</p>\n</body>\n</html>"; if(fwrite($file, $html) === false) { echo "could not write"; exit; } fclose($file); $newfile=$_post["filename"].".html"; system("mv untitled$i.html $newfile"); header("location: $newfile"); } } else { echo "<form method=post action='".$_server["script_name"]."'>\n"; echo "new file name: <input name='filename'>\n</form>\n"; } ?>  <table width="100%" border="0" cellpadding="8">   <tr>     <td>&nbsp;</td>   </tr>   <tr>     <td bgcolor="#ffdddd"><form id="form2" name="form2" method="post" action="createpagestest.php" onsubmit="return validate_form2 ( );">       <br />       <input type="submit" name="button" id="button" value="add page" />       <input name="filename" type="text" id="filename" size="8" maxlength="11" />        <br />     </form></td>   </tr> </table> 

but if this, won't create html page @ all....

<? if ($_post["filename"]) { error_reporting(0); $i=1; while($file = fopen("untitled$i.html", "r")) { fclose($file); $i++; } if($file = fopen("untitled$i.html", "w")) { $html = "<!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" dir="ltr" lang="en-us">      <head profile="http://gmpg.org/xfn/11">      <title>my title</title>         <link rel="stylesheet" type="text/css" href="css/main.css">     <meta http-equiv="content-type" content="text/html; charset=utf-8" />      <script type="text/javascript" src="http://jqueryjs.googlecode.com/files/jquery-1.3.2.js"></script>     <script src="http://dev.jquery.com/view/tags/ui/latest/ui/effects.core.js"></script>     <script src="http://dev.jquery.com/view/tags/ui/latest/ui/effects.slide.js"></script>     <script type="text/javascript" src="supersized.2.0.js"></script>     <script type="text/javascript">           $(function(){             $.fn.supersized.options = {                   startwidth: 640,                   startheight: 480,                 vertical_center: 1,                 slideshow: 1,                 navigation: 1,                 transition: 1, //0-none, 1-fade, 2-slide top, 3-slide right, 4-slide bottom, 5-slide left                 pause_hover: 0,                 slide_counter: 1,                 slide_captions: 1,                 slide_interval: 6000               };             $('#supersize').supersized();          });     </script>   </head>  <body > <div id="details1">  <div class="txtd"> <h1>home</h1>  <p>lorem ipsum dummy text of printing , typesetting industry. lorem ipsum has been industry's standard dummy text ever since 1500s, when unknown printer took galley of type , scrambled make type specimen book. has survived not 5 centuries, leap electronic typesetting, remaining unchanged. popularised in 1960s release of letraset sheets containing lorem ipsum passages, , more desktop publishing software aldus pagemaker including versions of lorem ipsum.</p><br /><br  /> </div> </div>  <div id="closebutton"><a id="closepanel" href="#"><img src="images/close.png" width="15" height="11" /></a></div>  <div id="openbutton"><a id="openpanel" href="#"><img src="images/open.png" width="15" height="11" /></a></div>   <div id="navbarholder">         <a href="index_2.html" class="stamp"><img width="200" src="images/logof.png"/></a>          <nav>         <ul>         <li><a href="#" id="home">home</a></li>         <li><a href="#">corporate</a></li>         <li><a href="#">eco statement</a></li>         <li><a href="#">private</a></li>         </ul>         </nav>           <nav id="nav2">         <ul>         <li><a href="#"><img src="images/facebook.png" width="20" height="20" alt="facebook" /></a></li>         <li><a href="#"><img src="images/twitter.png" width="20" height="20" alt="twitter" /></a></li>         <li><a href="#"><img src="images/pinterest.png" width="20" height="20" alt="instgram" /></a></li>         <li><a href="#"><img src="images/rhenvelope.png" width="20" height="20" alt="email" /></a></li>         </ul>         </nav>  <nav id="nav3">         <ul>         <li>tell | 01700000</li>         <li>fax | 01700000</li>         <li>info@site.com</li>         </ul>         </nav>  <nav id="nav4">         <ul>         <li>© site copyright. rights reserved.</li>          </ul>         </nav>  </div>   <!--loading display while images load--> <div id="loading">&nbsp;</div>  <!--slides--> <div id="supersize">     <a href="#"><img src="images/bird.jpg" title="bird on branch"/></a>     <a href="#"><img src="images/paradise.jpg" title="paradise lost"/></a>     <a href="#"><img src="images/snake.jpg" title="morelia viridis"/></a> </div>  <!--content area hovers on top--> <div id="content">     <div id="contentframe">          <!--logo-->          <!--navigation-->         <div id="navigation">             <a href="#" id="prevslide"><img src="images/back_dull.gif"/></a><a href="#" id="pauseplay"><img src="images/pause_dull.gif"/></a><a href="#" id="nextslide"><img src="images/forward_dull.gif"/></a>            </div>      </div> </div>      <script type="text/javascript">  $(function(){     $('#details1').animate({'left': 200},1000); });   $(function(){     $("#closepanel").click(function () {          $("#details1").animate({'left': -500},500,function(){            $("#details1").css('display','none')            $("#closebutton").css('display','none')            $("#openbutton").css('display','block')         });     }); });  $(function(){     $("#openpanel").click(function () {         $("#details1").animate({'left': 200},1000,function(){            $("#details1").css('display','block')            $("#closebutton").css('display','block')            $("#openbutton").css('display','none')         });     }); });   </script>  </body> </html>  "; if(fwrite($file, $html) === false) { echo "could not write"; exit; } fclose($file); $newfile=$_post["filename"].".html"; system("mv untitled$i.html $newfile"); header("location: $newfile"); } } else { echo "<form method=post action='".$_server["script_name"]."'>\n"; echo "new file name: <input name='filename'>\n</form>\n"; } ?>   <table width="100%" border="0" cellpadding="8">   <tr>     <td>&nbsp;</td>   </tr>   <tr>     <td bgcolor="#ffdddd"><form id="form2" name="form2" method="post" action="createpagestest.php" onsubmit="return validate_form2 ( );">       <br />       <input type="submit" name="button" id="button" value="add page" />       <input name="filename" type="text" id="filename" size="8" maxlength="11" />        <br />     </form></td>   </tr> </table> 

could please me this?

maybe works:

$html = '<!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" dir="ltr" lang="en-us">      <head profile="http://gmpg.org/xfn/11">      <title>my title</title>         <link rel="stylesheet" type="text/css" href="css/main.css">     <meta http-equiv="content-type" content="text/html; charset=utf-8" />      <script type="text/javascript" src="http://jqueryjs.googlecode.com/files/jquery-1.3.2.js"></script>     <script src="http://dev.jquery.com/view/tags/ui/latest/ui/effects.core.js"></script>     <script src="http://dev.jquery.com/view/tags/ui/latest/ui/effects.slide.js"></script>     <script type="text/javascript" src="supersized.2.0.js"></script>     <script type="text/javascript">           $(function(){             $.fn.supersized.options = {                   startwidth: 640,                   startheight: 480,                 vertical_center: 1,                 slideshow: 1,                 navigation: 1,                 transition: 1, //0-none, 1-fade, 2-slide top, 3-slide right, 4-slide bottom, 5-slide left                 pause_hover: 0,                 slide_counter: 1,                 slide_captions: 1,                 slide_interval: 6000               };             $("#supersize").supersized();          });     </script>   </head>  <body > <div id="details1">  <div class="txtd"> <h1>home</h1>  <p>lorem ipsum dummy text of printing , typesetting industry. lorem ipsum has been industry"s standard dummy text ever since 1500s, when unknown printer took galley of type , scrambled make type specimen book. has survived not 5 centuries, leap electronic typesetting, remaining unchanged. popularised in 1960s release of letraset sheets containing lorem ipsum passages, , more desktop publishing software aldus pagemaker including versions of lorem ipsum.</p><br /><br  /> </div> </div>  <div id="closebutton"><a id="closepanel" href="#"><img src="images/close.png" width="15" height="11" /></a></div>  <div id="openbutton"><a id="openpanel" href="#"><img src="images/open.png" width="15" height="11" /></a></div>   <div id="navbarholder">         <a href="index_2.html" class="stamp"><img width="200" src="images/logof.png"/></a>          <nav>         <ul>         <li><a href="#" id="home">home</a></li>         <li><a href="#">corporate</a></li>         <li><a href="#">eco statement</a></li>         <li><a href="#">private</a></li>         </ul>         </nav>           <nav id="nav2">         <ul>         <li><a href="#"><img src="images/facebook.png" width="20" height="20" alt="facebook" /></a></li>         <li><a href="#"><img src="images/twitter.png" width="20" height="20" alt="twitter" /></a></li>         <li><a href="#"><img src="images/pinterest.png" width="20" height="20" alt="instgram" /></a></li>         <li><a href="#"><img src="images/rhenvelope.png" width="20" height="20" alt="email" /></a></li>         </ul>         </nav>  <nav id="nav3">         <ul>         <li>tell | 01700000</li>         <li>fax | 01700000</li>         <li>info@site.com</li>         </ul>         </nav>  <nav id="nav4">         <ul>         <li>© site copyright. rights reserved.</li>          </ul>         </nav>  </div>   <!--loading display while images load--> <div id="loading">&nbsp;</div>  <!--slides--> <div id="supersize">     <a href="#"><img src="images/bird.jpg" title="bird on branch"/></a>     <a href="#"><img src="images/paradise.jpg" title="paradise lost"/></a>     <a href="#"><img src="images/snake.jpg" title="morelia viridis"/></a> </div>  <!--content area hovers on top--> <div id="content">     <div id="contentframe">          <!--logo-->          <!--navigation-->         <div id="navigation">             <a href="#" id="prevslide"><img src="images/back_dull.gif"/></a><a href="#" id="pauseplay"><img src="images/pause_dull.gif"/></a><a href="#" id="nextslide"><img src="images/forward_dull.gif"/></a>            </div>      </div> </div>      <script type="text/javascript">  $(function(){     $("#details1").animate({"left": 200},1000); });   $(function(){     $("#closepanel").click(function () {          $("#details1").animate({"left": -500},500,function(){            $("#details1").css("display","none")            $("#closebutton").css("display","none")            $("#openbutton").css("display","block")         });     }); });  $(function(){     $("#openpanel").click(function () {         $("#details1").animate({"left": 200},1000,function(){            $("#details1").css("display","block")            $("#closebutton").css("display","block")            $("#openbutton").css("display","none")         });     }); });   </script>  </body> </html>  '; 

Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -