Visualizzazione dei risultati da 1 a 2 su 2
  1. #1

    creare un save load sul server linux ckeditor

    Ciao a tutti!

    ho un problema grossissimo, con il seguente codice carico fckeditor in una pagina html e inserisco un input script per editor
    ma io vorrei creare un sistema html o php per carricare i file direttamente via hosting con un area text dove si puo specificare il nome del file ess: pagina.html ma non riesco a capire come fare questa cosa con un editor javascript vorrei creare una cosa tipo questa http://aspnet.html.it/articoli/leggi...net-tinymce/4/ ma e in asp.net io vorrei crearla in php se e possibile farlo naturalmente, il fatto e che non sono molto esperto di php confido nella vostra esperienza vi prego aiutatemi mi sto esaurendo il cervello nel trovare una soluzione
    posto naturlamnete il file winrar dell editor completo http://lnx.webskey.it/ckeditor.rar
    che vorrei modificare nel caso qualche bravo programmatore html/php decidesse di modificarlo per rendere la funzione salva e carrica dalla cartella essempio: public/sito/ in base all nome scelto nell area text nome file html
    posto il mio script html che consente di inserire script e di mascherare il contenuto direttamente nel ckeditor nel caso possa essere di utile a qualcuno in chambio per favere aiutatemi

    posto anche gli script che sto cercando di far funzionare nel caso qualche utente piu esperto decidesse di dare un aiuto

    file: index.html
    codice:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <!--
    Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
    For licensing, see LICENSE.html or http://ckeditor.com/license
    -->
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    	<title>API Usage &mdash; CKEditor Sample</title>
    	<meta content="text/html; charset=utf-8" http-equiv="content-type" />
    	<script type="text/javascript" src="ckeditor/ckeditor.js"></script>
    	<script src="sample.js" type="text/javascript"></script>
    	<link href="sample.css" rel="stylesheet" type="text/css" />
    	<script type="text/javascript">
    	//<![CDATA[
    
    
    CKEDITOR.on( 'instanceReady', function( ev )
    {
    
    	document.getElementById( 'eMessage' ).innerHTML = '
    
    Instance <code>' + ev.editor.name + '<\/code> loaded.<\/p>';
    
    
    	 document.getElementById( 'eButtons' ).style.display = 'block';
    });
    
    function InsertHTML()
    {
    
    	var oEditor = CKEDITOR.instances.editor1;
    	var value = document.getElementById( 'htmlArea' ).value;
    
    
    	if ( oEditor.mode == 'wysiwyg' )
    	{
    
    		oEditor.insertHtml( value );
    	}
    	else
    		alert( 'You must be in WYSIWYG mode!' );
    }
    
    function InsertText()
    {
    
    	var oEditor = CKEDITOR.instances.editor1;
    	var value = document.getElementById( 'txtArea' ).value;
    
    
    	if ( oEditor.mode == 'wysiwyg' )
    	{
    
    		oEditor.insertText( value );
    	}
    	else
    		alert( 'You must be in WYSIWYG mode!' );
    }
    
    function SetContents()
    {
    
    	var oEditor = CKEDITOR.instances.editor1;
    	var value = document.getElementById( 'htmlArea' ).value;
    
    
    	oEditor.setData( value );
    }
    
    function GetContents()
    {
    
    	var oEditor = CKEDITOR.instances.editor1;
    
    
    	alert( oEditor.getData() );
    }
    
    function ExecuteCommand( commandName )
    {
    
    	var oEditor = CKEDITOR.instances.editor1;
    
    
    	if ( oEditor.mode == 'wysiwyg' )
    	{
    
    		oEditor.execCommand( commandName );
    	}
    	else
    		alert( 'You must be in WYSIWYG mode!' );
    }
    
    function CheckDirty()
    {
    	
    	var oEditor = CKEDITOR.instances.editor1;
    
    	alert( oEditor.checkDirty() );
    }
    
    function ResetDirty()
    {
    	
    	var oEditor = CKEDITOR.instances.editor1;
    
    	oEditor.resetDirty();
    	alert( 'The "IsDirty" status has been reset' );
    }
    
    	//]]>
    	</script>
    
    </head>
    <body>
    
    		</noscript>
    	</div>
    	<form method="post" action="pagina.php">
    
    		<textarea cols="100" id="editor1" name="editor1" rows="10"><?php echo htmlentities($_POST['editor1'], ENT_QUOTES, 'UTF-8'); ?></textarea>
    
    		<script type="text/javascript">
    		//<![CDATA[
    			// Replace the <textarea id="editor1"> with an CKEditor instance.
    			var editor = CKEDITOR.replace( 'editor1' );
    		//]]>
    		</script>
    
    		<div id="eMessage">
    		</div>
    		<div id="eButtons" style="display: none">
                            <input onclick="InsertHTML();" type="button" value="INVIA SCRIPT HTML" />
    			
    
    			<textarea cols="100" id="htmlArea" rows="3">&lt;h2&gt;Test&lt;/h2&gt;&lt;p&gt;This is some &lt;a href="/Test1.html"&gt;sample&lt;/a&gt; HTML code.&lt;/p&gt;</textarea>
    
    		</div>
    
         
    DIGITARE IL NOME DEL FILE DA SALVARE HO CARRICARE
     
        <input name="Titolo" style="width: 100px" type="text" / size="1" maxlength="15">
    
    
        <input type="submit" name="save" value="salva" /> 
        <input type="reset" name="reset" value="carica" />
    
    	</form>
    
    </body>
    </html>
    file: pagina.php
    Codice PHP:
    <?php

    if (isset($_POST['editor1']) == false)
    {
       
    $_POST['editor1'] = '';
    }
    else
    {
        
    $_POST['editor1'] = stripslashes($_POST['editor1']);
    }

    if (isset(
    $_POST['submit']))
    {
        
    $fp fopen(stripslashes($_POST['/public/nomesito/*.html']), 'wb');
        
    fwrite($fp$_POST['editor1']);
        
    fclose($fp);
    }
    else if (isset(
    $_POST['reset']))
    {
        
    $_POST['editor1'] = file_get_content(stripslashes($_POST['/public/nomesito/*.html']));
    }

    ?>
    tengo a precisare che lo script non funziona con il salva e carica file html lo postato per farlo aggiustare a qualche utente piu esperto di me grazie a tutti anticipatamente

  2. #2
    Amministratore L'avatar di Vincent.Zeno
    Registrato dal
    May 2003
    residenza
    Emilia-Romagna (tortellini und cappelletti land!)
    Messaggi
    20,661
    chiudo per crossposting.

    leggi il regolamento, grazie

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2024 vBulletin Solutions, Inc. All rights reserved.