Fragment kodu panelu administracyjnego:
<script language="Javascript1.2"><!-- // load htmlarea _editor_url = "htmlarea/"; // URL to htmlarea files var win_ie_ver = parseFloat(navigator.appVersion.split("MSIE")[1]); if (navigator.userAgent.indexOf('Mac') >= 0) { win_ie_ver = 0; } if (navigator.userAgent.indexOf('Windows CE') >= 0) { win_ie_ver = 0; } if (navigator.userAgent.indexOf('Opera') >= 0) { win_ie_ver = 0; } if (win_ie_ver >= 5.5) { document.write('<scr' + 'ipt src="' +_editor_url+ 'editor.js"'); document.write(' language="Javascript1.2"></scr' + 'ipt>'); } else { document.write('<scr'+'ipt>function editor_generate() { return false; }</scr'+'ipt>'); } // --></script> </head> <body> <table border="1" cellspacing="0" cellpadding="0" align="center" bgcolor="#F2F7F2" style="border-color: #7F8A7F" width="750"> <tr> <td> <table border="0" cellspacing="0" cellpadding="0" align="center" bgcolor="#DAE2DA" style="border-color: #7F8A7F" width="750"> <tr style="text-align: center; height: 20px;"> <td><a href="admin.php?dzial=news">newsy</a></td> <td><a href="admin.php?logout"><b>wyloguj</b></a></td> </tr> </table> </td> </tr> <tr> <td align="center"><?php $baza = "baza/"; switch($_GET['dzial']){ case "news"; $id = $_GET['id']; if ( $_GET['publikuj'] == "tak" ){ $query = "UPDATE news SET z='tak' WHERE news_id='$id'"; }else if ( $_GET['publikuj'] == "nie" ){ $query = "UPDATE news SET z='nie' WHERE news_id='$id'"; } } $id = $_POST['id']; $temat = escape_data( $_POST['tytul'] ); $tresc_k = escape_data( $_POST['area2'] ); $tresc = escape_data( $_POST['area'] ); }else{ $data = $_POST['data']; } if ( $_POST['co'] == "update" ) { $query = "UPDATE news SET tytul='$tytul', tresc_krotka='$tresc_k', tresc='$tresc' ,data='$data'WHERE news_id='$id'"; }else{ } }else if ( $_POST['co'] == "nowy" ){ $query = "INSERT INTO news ( tytul, tresc_krotka, tresc, data ) VALUES ( '$tytul', '$tresc_k', '$tresc', '$data' )"; }else{ } } } $query = "SELECT * FROM news WHERE news_id={$_GET['edytuj']}"; echo '<form action="admin.php?dzial=news" method="post"> <input type="hidden" name="co" value="update"> <input type="hidden" name="id" value="'.$row['news_id'].'"> Data: 0000-00-00 00:00:00 <input type="text" value="'.stripslashes($row['data']).'" name="data" size="30"> <br> Tresc krótka <textarea rows="20" cols="100%" name="area2">'.stripslashes($row['tresc_krotka']).'</textarea><br> <input type="submit" value="zapisz" name="zapisz"> </form>'; ?> <script language="JavaScript1.2" defer> var config = new Object(); // create new config object var config2 = new Object(); // create new config object config.width = "100%"; config.height = "400px"; config.bodyStyle = 'background-color: white; font-family: "Verdana"; font-size: x-small;'; config.debug = 0; config2.width = "100%"; config2.height = "100px"; config2.bodyStyle = 'background-color: white; font-family: "Verdana"; font-size: x-small;'; config2.debug = 0; editor_generate('area',config); editor_generate('area2',config2); </script> ....
A to jest ca³y kod jaki jest podany w pliku example edytora który chcê zaincludowaæ zamiast istniejacego:
<!doctype html public "-//w3c//dtd html 4.0 transitional//en"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <style> body{font:10px verdana,arial,sans-serif;} a{color:#cc0000;font-size:xx-small;} </style> <? //Check user's Browser else ?> <script> function submitForm() { document.forms.Form1.elements.inpContent.value = oEdit1.getHTMLBody(); document.forms.Form1.submit() } </script> </head> <body> <h5>Complete Toolbar Buttons (php example) - <a href="../default.htm">Back</a></h5> <pre id="idTemporary" name="idTemporary" style="display:none"> <? { } ?> </pre> <form method="post" action="default1.php" id="Form1"> <script> var oEdit1 = new InnovaEditor("oEdit1"); oEdit1.arrStyle = [["BODY",false,"","font:10px verdana,arial,sans-serif;"]]; oEdit1.width=505; oEdit1.features=["Save","FullScreen","Preview","Print","Search","SpellCheck", "Cut","Copy","Paste","PasteWord","PasteText","|","Undo","Redo","|", "ForeColor","BackColor","|","Bookmark","Hyperlink", "CustomTag","HTMLFullSource","HTMLSource","XHTMLFullSource", "XHTMLSource","BRK","Numbering","Bullets","|","Indent","Outdent","LTR","RTL","|","Image","Flash","Media","|","InternalLink","CustomObject","|", "Table","Guidelines","Absolute","|","Characters","Line", "Form","Clean","ClearAll","BRK", "StyleAndFormatting","TextFormatting","ListFormatting","BoxFormatting", "ParagraphFormatting","CssText","Styles","|", "Paragraph","FontName","FontSize","|", "Bold","Italic", "Underline","Strikethrough","|","Superscript","Subscript","|", "JustifyLeft","JustifyCenter","JustifyRight","JustifyFull"]; oEdit1.cmdAssetManager="modalDialogShow('/Editor/assetmanager/assetmanager.php',640,465)"; oEdit1.onSave = new Function("submitForm()"); oEdit1.cmdInternalLink = "modelessDialogShow('links.htm',365,270)" oEdit1.cmdCustomObject = "modelessDialogShow('objects.htm',365,270)" oEdit1.arrCustomTag=[["First Name","{%first_name%}"], ["Last Name","{%last_name%}"], ["Email","{%email%}"]]; oEdit1.RENDER(document.getElementById("idTemporary").innerHTML); </script> <input type="hidden" name="inpContent" id="inpContent"> </form> <br><br> <? { } ?> </body> </html>
Dobra, zaincludowa³em ten edytor, tylko teraz mam inny problem. Edytor zczytuje z bazy danych zawartosæ komórki tresc, jednak gdy chcem ju¿ co¶ zapisaæ, zapisuje mi puste pole. A teraz zaprezentuje fragment jak rozwi±za³em swój problem z includowaniem...
<? //Check user's Browser // £aduj gdy IE else // £aduj gdy inna przegladarka ?> </head> <body> <table border="1" cellspacing="0" cellpadding="0" align="center" bgcolor="#F2F7F2" style="border-color: #7F8A7F" width="750"> tutaj jest menu </table> </td> <td align="center" valign="top"> <?php $baza = "baza/"; switch($_GET['dzial']){ case "news"; $id = $_GET['id']; if ( $_GET['publikuj'] == "tak" ){ $query = "UPDATE news SET z='tak' WHERE news_id='$id'"; }else if ( $_GET['publikuj'] == "nie" ){ $query = "UPDATE news SET z='nie' WHERE news_id='$id'"; } } $id = $_POST['id']; $temat = escape_data( $_POST['tytul'] ); $tresc = escape_data( $_POST['tresc'] ); }else{ $data = $_POST['data']; } if ( $_POST['co'] == "update" ) { $query = "UPDATE news SET tytul='$tytul', tresc='$tresc' ,data='$data'WHERE news_id='$id'"; }else{ } }else if ( $_POST['co'] == "nowy" ){ $query = "INSERT INTO news ( tytul, tresc, data ) VALUES ( '$tytul', '$tresc', '$data' )"; }else{ } } } $query = "SELECT * FROM news WHERE news_id={$_GET['edytuj']}"; echo '<table width="100%" style= "padding: 1px; border: 0px; background-color: #d3d3d3;" cellspacing="1" cellpadding="1"> <tr style="background-color: #dddddd; text-align: center; height: 20px;"> <td colspan="2"> <b>Edytuj newsa</b> </td> </tr> <form action="admin.php?dzial=news" method="post"> <input type="hidden" name="co" value="update"> <input type="hidden" name="id" value="'.$row['news_id'].'" > <tr style="background-color: #f3f3f3;"> <td width="75" style="padding: 5px; text-align: left;"> Data:<br>(0000-00-00) </td> <td style="padding: 5px;"> </td> </tr> <tr style="background-color: #f3f3f3;"> <td width="50" style="padding: 5px; text-align: left;"> Tytu³: </td> <td style="padding: 5px;"> </td> </tr> <tr style="background-color: #f3f3f3;"> <td style="padding: 5px;" colspan="2"> <script> var oEdit1 = new InnovaEditor("oEdit1"); oEdit1.RENDER("'.$tresc.'"); oEdit1.arrStyle = [["BODY",false,"","font:10px verdana,arial,sans-serif;"]]; oEdit1.width=490; oEdit1.features=["Save","FullScreen","Preview","Print","Search","SpellCheck", "Cut","Copy","Paste","PasteWord","PasteText","|","Undo","Redo","|", "ForeColor","BackColor","|","Bookmark","Hyperlink", "CustomTag","HTMLFullSource","HTMLSource","XHTMLFullSource", "XHTMLSource","BRK","Numbering","Bullets","|","Indent","Outdent","LTR","RTL","|","Image","Flash","Media","|","InternalLink","CustomObject","|", "Table","Guidelines","Absolute","|","Characters","Line", "Form","Clean","ClearAll","BRK", "StyleAndFormatting","TextFormatting","ListFormatting","BoxFormatting", "ParagraphFormatting","CssText","Styles","|", "Paragraph","FontName","FontSize","|", "Bold","Italic", "Underline","Strikethrough","|","Superscript","Subscript","|", "JustifyLeft","JustifyCenter","JustifyRight","JustifyFull"]; oEdit1.cmdAssetManager="modalDialogShow(`Editor/assetmanager/assetmanager.php`,640,465)"; </script> </td> </tr> <tr style="background-color: #dddddd;"> <td colspan="2" style="padding: 5px; text-align: center;"> <input type="submit" value="Zapisz zmiany" name="zapisz"> </td> </tr> </form></table>'; ?>
Moze czego¶ zapomnia³em, ze mi nie zapisuje?? Tylko czego... A mo¿e co¶ trzeba dodac lub dopisaæ?
