Visualizzazione dei risultati da 1 a 9 su 9
  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 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 di qui inserisco anche la foto del fckeditor funzionante con un save load, come vorrei crearlo io ma non ci riesco in php. 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 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

    salvare lo script html nella carttella principale del ckeditor

    nome file : edit.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[
    
    // The instanceReady event is fired, when an instance of CKEditor has finished
    // its initialization.
    CKEDITOR.on( 'instanceReady', function( ev )
    {
    	// Show the editor name and description in the browser status bar.
    	document.getElementById( 'eMessage' ).innerHTML = '
    
    Instance <code>' + ev.editor.name + '<\/code> loaded.<\/p>';
    
    	// Show this sample buttons.
    	 document.getElementById( 'eButtons' ).style.display = 'block';
    });
    
    function InsertHTML()
    {
    	// Get the editor instance that we want to interact with.
    	var oEditor = CKEDITOR.instances.editor1;
    	var value = document.getElementById( 'htmlArea' ).value;
    
    	// Check the active editing mode.
    	if ( oEditor.mode == 'wysiwyg' )
    	{
    		// Insert HTML code.
    		// http://docs.cksource.com/ckeditor_ap...tml#insertHtml
    		oEditor.insertHtml( value );
    	}
    	else
    		alert( 'You must be in WYSIWYG mode!' );
    }
    
    function InsertText()
    {
    	// Get the editor instance that we want to interact with.
    	var oEditor = CKEDITOR.instances.editor1;
    	var value = document.getElementById( 'txtArea' ).value;
    
    	// Check the active editing mode.
    	if ( oEditor.mode == 'wysiwyg' )
    	{
    		// Insert as plain text.
    		// http://docs.cksource.com/ckeditor_ap...tml#insertText
    		oEditor.insertText( value );
    	}
    	else
    		alert( 'You must be in WYSIWYG mode!' );
    }
    
    function SetContents()
    {
    	// Get the editor instance that we want to interact with.
    	var oEditor = CKEDITOR.instances.editor1;
    	var value = document.getElementById( 'htmlArea' ).value;
    
    	// Set editor contents (replace current contents).
    	// http://docs.cksource.com/ckeditor_ap...r.html#setData
    	oEditor.setData( value );
    }
    
    function GetContents()
    {
    	// Get the editor instance that you want to interact with.
    	var oEditor = CKEDITOR.instances.editor1;
    
    	// Get editor contents
    	// http://docs.cksource.com/ckeditor_ap...r.html#getData
    	alert( oEditor.getData() );
    }
    
    function ExecuteCommand( commandName )
    {
    	// Get the editor instance that we want to interact with.
    	var oEditor = CKEDITOR.instances.editor1;
    
    	// Check the active editing mode.
    	if ( oEditor.mode == 'wysiwyg' )
    	{
    		// Execute the command.
    		// http://docs.cksource.com/ckeditor_ap...ml#execCommand
    		oEditor.execCommand( commandName );
    	}
    	else
    		alert( 'You must be in WYSIWYG mode!' );
    }
    
    function CheckDirty()
    {
    	// Get the editor instance that we want to interact with.
    	var oEditor = CKEDITOR.instances.editor1;
    	// Checks whether the current editor contents present changes when compared
    	// to the contents loaded into the editor at startup
    	// http://docs.cksource.com/ckeditor_ap...tml#checkDirty
    	alert( oEditor.checkDirty() );
    }
    
    function ResetDirty()
    {
    	// Get the editor instance that we want to interact with.
    	var oEditor = CKEDITOR.instances.editor1;
    	// Resets the "dirty state" of the editor (see CheckDirty())
    	// http://docs.cksource.com/ckeditor_ap...tml#resetDirty
    	oEditor.resetDirty();
    	alert( 'The "IsDirty" status has been reset' );
    }
    
    	//]]>
    	</script>
    
    </head>
    <body>
    
    		</noscript>
    	</div>
    	<form action="sample_posteddata.php" method="post">
    		<textarea cols="100" id="editor1" name="editor1" rows="10">&lt;p&gt;This is some &lt;strong&gt;sample text&lt;/strong&gt;. You are using &lt;a href="http://ckeditor.com/"&gt;CKEditor&lt;/a&gt;.&lt;/p&gt;</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>
    	</form>
    
    </body>
    </html>
    Immagini allegate Immagini allegate

  2. #2
    mmm volevo darti la soluzione, salvare un file è estremamente semplice, ma l'html che hai postato non corrisponde all'immagine che hai allegato ... e quindi non so il nome del campo che contiene il nome del file di destinazione

    comunque, in linea generale
    codice:
    <?php
    
    if (isset($_POST['editor1']) == false)
    {
       $_POST['editor1'] = '';
    }
    else
    {
        $_POST['editor1'] = stripslashes($_POST['editor1']);
    }
    
    if (isset($_POST['submit-save']))
    {
        $fp = fopen(stripslashes($_POST['path']), 'wb');
        fwrite($fp, $_POST['editor1']);
        fclose($fp);
    }
    else if (isset($_POST['submit-load']))
    {
        $_POST['editor1'] = file_get_content(stripslashes($_POST['path']));
    }
    
    ?>
    $_POST['submit-save'] è il tasto submit "Salva" mentre $_POST['submit-load'] è il tasto "Carica"

    se hai usato nomi diversi da submit-save e submit-load devi ovviamente cambiare i nomi o nel codice o nell'html

    idem con patate per l'editor che l'ho nominato, visto che nell'html si chiama così, editor1 ($_POST['editor1'])

    Per finire il campo input text con il percorso ... l'ho chiamato path ($_POST['path']) devi sistemare anche questo nome qui

    Per quanto riguarda il caricamento, immagino che tu voglia far comparire il contenuto nell'editor html quindi direi che devi inserire il mio codice in un file PHP e poi metterci subito dopo, nello stesso file, dopo il tag di chiusura di php, il codice html tuo andando però a sostituire alla textarea usata per l'editor
    codice:
    <textarea cols="100" id="editor1" name="editor1" rows="10">&lt;p&gt;This is some &lt;strong&gt;sample text&lt;/strong&gt;. You are using &lt;a href="http://ckeditor.com/"&gt;CKEditor&lt;/a&gt;.&lt;/p&gt;</textarea>
    questo codice qui
    codice:
    <textarea cols="100" id="editor1" name="editor1" rows="10"><?php echo htmlentities($_POST['editor1'], ENT_QUOTES, 'UTF-8'); ?></textarea>
    Ovviamente il codice, scritto così, senza nessun controllo, è pericolosissimo: una path errata ed è possibile visualizzare e modificare qualsiasi file!
    The fastest Redis alternative ... cachegrand! https://github.com/danielealbano/cachegrand

  3. #3

    ciao e grazie 1000 lo provo e ti faccio sapere :-)

    Si certo che non corrisponde all immagine che ho postato immagine, e quello che vorrei realizare io sul mio spazio hosting linux che non legge il asp.net, quindi devo realizarlo un php e html, ma non sono molto esperto. Avevo postato immagine solo per dare in cambio html.it una soluzione per gli altri utenti che magari puo servire lo fatta io in pratica serve per inserire in modo facile uno script html nell editor e viene mascherato automaticamente, una altra cosa che ckeditor no ha pensato oltre al fatto di poter salvare i file che si creano e poterli modificare dopo averli salvati, cmq posso darti il mio facebook, e (webskey sito web) e da tempo che cerco sul web un esperto piu di me di html ti prego aggiungimi sono disperato, :-(
    (ps). Posso chiederti un ultima cosa come posso inserire questi file php nell mio file html

  4. #4
    basta che posti qui le domande, e ci saranno tantissime persone pronte e disposte ad aiutarti!
    The fastest Redis alternative ... cachegrand! https://github.com/danielealbano/cachegrand

  5. #5

    scusa se ti disturbo ancora

    scusa se disturbo ancora, ma non e che per caso melo modifichi e lo mandi su un server dove si puo scaricare per tutti visto che sei cosi bravo con il php, nel caso in qui hai tempo di farlo e se ti va naturlamnete ti posto il file winrar dell editor completo http://lnx.webskey.it/ckeditor.rar grazie da tutti quelli che cercano di far funzionare il ckeditor.
    cmq a me basterebbe un pulsante salva carrica anche sul pc remoto se lo script che mi hai gentilemte regalato non e sicuro
    ps il php devo usare il parametro (include file.php) nel html vero?

  6. #6

    lo fatto credo nel modo giusto ma non funziona

    posto gli script

    file : edit.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>
    	</form>
    
    </body>
    </html>

    script php
    file agina.php
    Codice PHP:
     <?php

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

    if (isset(
    $_POST['submit-save']))
    {
        
    $fp fopen(stripslashes($_POST['path']), 'wb');
        
    fwrite($fp$_POST['editor1']);
        
    fclose($fp);
    }
    else if (isset(
    $_POST['submit-load']))
    {
        
    $_POST['editor1'] = file_get_content(stripslashes($_POST['path']));
    }

    ?>

  7. #7

    lo riscritto per far capire cosa cerco di creare

    Posto lo script che ho modificato anche se non fuoziona solo per far capire cosa voglio creare con ckeditor ma tengo a precisare che sto script non funziona se qualche programmatore esperto ha intenzione di migliorare il editor ckeditor farebbe un favore a tutti se poi postasse il contenuto in un archivio compresso e su un server per download

    file: edit.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">
         
    DIGITARE IL NOME DEL FILE DA SALVARE
     
        <input name="Titolo" style="width: 100px" type="text" / size="1" maxlength="15">
    
    		<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>
        <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']));
    }

    ?>

  8. #8

  9. #9

    daniele_dll

    avevi già aperto un thread a riguardo qui
    http://forum.html.it/forum/showthre...hreadid=1489989

    Gentilmente evita di aprire doppi thread o di fare crossposting in quanto è vietato dal regolamento del forum.

    Inoltre evita di fare continui post nel tuo thread, se nessuno risponde è perché non ha tempo o non vuole semplicemente farlo ... è un luogo libero e portare disordine non ti aiuta di certo

    Maggiore attenzione in futuro pls

    si certo ma avevo deciso di scriverlo meglio per che non si capiva quello che volevo realizare
    non pretendo che nessuno mi aiuti, mi sembra che fino ad ora ho sempre chiesto con gentilezza sto piccolo aiuto con ckeditor , cmq per scrivere di nuovo il posto in modo piu conprensibile, visto che html.it non mi consente ne di cancellare il vecchio, ne di modificarlo mi sapreste indicare come posso fare, senza violare il regolamento inteligente di html.it, almeno questo ce qualche utente che a tempo ho semplicemente ha voglia di rispondermi, su questa complicata soluzione, su html.it

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 © 2026 vBulletin Solutions, Inc. All rights reserved.