Autor Zpráva
dawe27
Profil
čau, stahl jsem si na web tinymce editor, ale nevím jak ho sprovoznít, dál jsem tento kod do hlavičky webu (přes include)
<script type="text/javascript" src="/js/tinymce/jscripts/tiny_mce/tiny_mce.js"></script>
<script type="text/javascript">
tinyMCE.init({
        // General options
        mode : "textareas",
        theme : "advanced",
        plugins : "autolink,lists,spellchecker,pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template",

        // Theme options
        theme_advanced_buttons1 : "save,newdocument,|,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,styleselect,formatselect,fontselect,fontsizeselect",
        theme_advanced_buttons2 : "cut,copy,paste,pastetext,pasteword,|,search,replace,|,bullist,numlist,|,outdent,indent,blockquote,|,undo,redo,|,link,unlink,anchor,image,cleanup,help,code,|,insertdate,inserttime,preview,|,forecolor,backcolor",
        theme_advanced_buttons3 : "tablecontrols,|,hr,removeformat,visualaid,|,sub,sup,|,charmap,emotions,iespell,media,advhr,|,print,|,ltr,rtl,|,fullscreen",
        theme_advanced_buttons4 : "insertlayer,moveforward,movebackward,absolute,|,styleprops,spellchecker,|,cite,abbr,acronym,del,ins,attribs,|,visualchars,nonbreaking,template,blockquote,pagebreak,|,insertfile,insertimage",
        theme_advanced_toolbar_location : "top",
        theme_advanced_toolbar_align : "left",
        theme_advanced_statusbar_location : "bottom",
        theme_advanced_resizing : true,

        // Skin options
        skin : "o2k7",
        skin_variant : "silver",

        // Example content CSS (should be your site CSS)
        content_css : "css/example.css",

        // Drop lists for link/image/media/template dialogs
        template_external_list_url : "js/template_list.js",
        external_link_list_url : "js/link_list.js",
        external_image_list_url : "js/image_list.js",
        media_external_list_url : "js/media_list.js",

        // Replace values for the template plugin
        template_replace_values : {
                username : "Some User",
                staffid : "991234"
        }
});
</script>

<form method="post" action="somepage">
        <textarea name="content" style="width:100%"></textarea>
</form>
akorát nevím jak ho zobrazit na textarea
<form action="admin.php?addnews=2" method="post"> 
Titulek<input type="text" name="titulek" /> <br/>
Novinka <textarea name="text" style="width:100%"></textarea><br/>
Celý text novinky<textarea name="celytext" style="width:100%"></textarea><br/>
<input type="submit" value='Přidat novinku' /> <br/>

</form>  
neporadil by mi někdo prosimvas jak na to?
honzisko
Profil
dawe27:
U textarea ti chybí doplnit id="advanced" - nejsem si tou hodnotou ale úplně jistý, takže se podívej do přiložených příkladů ( example.html ) - projeď si kód a určitě to najdeš.
dawe27
Profil
skoušel jsem to a nic, skoušel jsem to i přesně podle příkladu, a neni to tim že bych musel ještě nějak něco nastavit v nakem souboru?
honzisko
Profil
dawe27:
Ne, pokud nemáš špatně nastavené cesty k souboru tak ne. Zkus si otevřít ten soubor example.html - Odtud zkopírovat cesty k JS souborům a i celý ten ukázkový formulář. A možná je chyba i v <script type="text/javascript" src="/js/tinymce/jscripts/tiny_mce/tiny_mce.js"></script> Zkus to upravit.
dawe27
Profil
pořad nic, cesty k souborum by měly být správné
honzisko
Profil
<script type="text/javascript" src="../jscripts/tiny_mce/tiny_mce.js"></script>

<script type="text/javascript">

    tinyMCE.init({

        // General options

        mode : "textareas",

        theme : "advanced",

        plugins : "autolink,lists,pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template,wordcount,advlist,autosave",
        // Theme options

        theme_advanced_buttons1 : "save,newdocument,|,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,styleselect,formatselect,fontselect,fontsizeselect",

        theme_advanced_buttons2 : "cut,copy,paste,pastetext,pasteword,|,search,replace,|,bullist,numlist,|,outdent,indent,blockquote,|,undo,redo,|,link,unlink,anchor,image,cleanup,help,code,|,insertdate,inserttime,preview,|,forecolor,backcolor",

        theme_advanced_buttons3 : "tablecontrols,|,hr,removeformat,visualaid,|,sub,sup,|,charmap,emotions,iespell,media,advhr,|,print,|,ltr,rtl,|,fullscreen",

        theme_advanced_buttons4 : "insertlayer,moveforward,movebackward,absolute,|,styleprops,|,cite,abbr,acronym,del,ins,attribs,|,visualchars,nonbreaking,template,pagebreak,restoredraft",

        theme_advanced_toolbar_location : "top",

        theme_advanced_toolbar_align : "left",

        theme_advanced_statusbar_location : "bottom",

        theme_advanced_resizing : true,
        // Example content CSS (should be your site CSS)

        content_css : "css/content.css",
        // Drop lists for link/image/media/template dialogs

        template_external_list_url : "lists/template_list.js",

        external_link_list_url : "lists/link_list.js",

        external_image_list_url : "lists/image_list.js",

        media_external_list_url : "lists/media_list.js",
        // Style formats

        style_formats : [

            {title : 'Bold text', inline : 'b'},

            {title : 'Red text', inline : 'span', styles : {color : '#ff0000'}},

            {title : 'Red header', block : 'h1', styles : {color : '#ff0000'}},

            {title : 'Example 1', inline : 'span', classes : 'example1'},

            {title : 'Example 2', inline : 'span', classes : 'example2'},

            {title : 'Table styles'},

            {title : 'Table row 1', selector : 'tr', classes : 'tablerow1'}

        ],
        // Replace values for the template plugin

        template_replace_values : {

            username : "Some User",

            staffid : "991234"

        }

    });

</script>

<textarea id="elm1" name="elm1" rows="15" cols="80" style="width: 80%">

<!-- /TinyMCE -->
dawe27
Profil
Při zpracování BB značek došlo k samovolnému sežrání celého příspěvku. Pardon.
nic nevím v čem je chyba
<!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">
<head>
<meta http-equiv='Content-Type' content='text/html; charset=utf-8' />
<title></title>
<meta name='description' content='' />
<meta name='keywords' content='' />
<meta name='robots' content='index, follow' />
<meta name="author" content="david bulawa" />
<link rel='shortcut icon' href='images/favicon.ico' />
<link rel='icon' href='images/favicon.ico' />
<link rel='stylesheet' href='styles.css' type='text/css' />

<script type="text/javascript" src="../jscripts/tiny_mce/tiny_mce.js"></script>
 

<script type="text/javascript">
 
    tinyMCE.init({
 
        // General options
 
        mode : "textareas",
 
        theme : "advanced",
 
        plugins : "autolink,lists,pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template,wordcount,advlist,autosave",
        // Theme options
 
        theme_advanced_buttons1 : "save,newdocument,|,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,styleselect,formatselect,fontselect,fontsizeselect",
 
        theme_advanced_buttons2 : "cut,copy,paste,pastetext,pasteword,|,search,replace,|,bullist,numlist,|,outdent,indent,blockquote,|,undo,redo,|,link,unlink,anchor,image,cleanup,help,code,|,insertdate,inserttime,preview,|,forecolor,backcolor",
 
        theme_advanced_buttons3 : "tablecontrols,|,hr,removeformat,visualaid,|,sub,sup,|,charmap,emotions,iespell,media,advhr,|,print,|,ltr,rtl,|,fullscreen",
 
        theme_advanced_buttons4 : "insertlayer,moveforward,movebackward,absolute,|,styleprops,|,cite,abbr,acronym,del,ins,attribs,|,visualchars,nonbreaking,template,pagebreak,restoredraft",
 
        theme_advanced_toolbar_location : "top",
 
        theme_advanced_toolbar_align : "left",
 
        theme_advanced_statusbar_location : "bottom",
 
        theme_advanced_resizing : true,
        // Example content CSS (should be your site CSS)
 
        content_css : "css/content.css",
        // Drop lists for link/image/media/template dialogs
 
        template_external_list_url : "js/template_list.js",
 
        external_link_list_url : "js/link_list.js",
 
        external_image_list_url : "js/image_list.js",
 
        media_external_list_url : "js/media_list.js",
        // Style formats
 
        style_formats : [
 
            {title : 'Bold text', inline : 'b'},
 
            {title : 'Red text', inline : 'span', styles : {color : '#ff0000'}},
 
            {title : 'Red header', block : 'h1', styles : {color : '#ff0000'}},
 
            {title : 'Example 1', inline : 'span', classes : 'example1'},
 
            {title : 'Example 2', inline : 'span', classes : 'example2'},
 
            {title : 'Table styles'},
 
            {title : 'Table row 1', selector : 'tr', classes : 'tablerow1'}
 
        ],
        // Replace values for the template plugin
 
        template_replace_values : {
 
            username : "Some User",
 
            staffid : "991234"
 
        }
 
    });
 
</script>
</head>
<body class="body">  
<form action="admin.php?addnews=2" method="post"> 
Titulek<input type="text" name="titulek" /> <br/>
Novinka <textarea id="elm1" name="text" rows="15" cols="80" style="width: 80%"></textarea><br/> 
Celý text novinky<textarea id="elm1" name="celytext" rows="15" cols="80" style="width: 80%"></textarea><br/> 
<input type="submit" value='Přidat novinku' /> <br/>
</form>  

<div  ><div class="oznamy">Silný permanentní <a href="http://unimagnet.cz/" title="Silné neodymové magnety na prodej! Magnet z neodymu, boru a železa.">magnet</a>/Navštivte náš nový <a href="http://nejlevnejsihiphop.cz" title="HipHop shop">hip hop</a> shop, kde máme garantované nejnižší ceny všeho <a href="http://www.krutyhadry.cz" title="HipHop oblečení">hip hop oblečení</a> po celé ČR/Nábytek co vydrží, <a href="http://lino.cz" title="Nábytek na zahradu">zahradní nábytek</a> od lino.cz/Moderní zdravotní <a href="http://www.matrace-unar.cz" title="Matrace UNAR">matrace</a>, které napomáhají od bolesti zad - matrace UNAR</div></div></body>
</html>
honzisko
Profil
tenhle kód mi funguje: ( vloženo do TINYMCE zakaldni složky )

<!-- TinyMCE -->
<script type="text/javascript" src="jscripts/tiny_mce/tiny_mce.js"></script>
<script type="text/javascript">
    tinyMCE.init({
        mode : "textareas",
        theme : "simple"
    });
</script>
<!-- /TinyMCE -->

<body>
<textarea id="elm1" name="elm1" rows="15" cols="80" style="width: 80%">

        testo

    </textarea>
dawe27
Profil
jo funguje ,super, diky moc :)


ještě jeden problém, mam tam textarea 2x v tom prvním se ten editor zobrazuje, v tom druhém ne, kod je stejný a ještě když něco napíšu tak se to nezapíše do db (přes editor) bez editoru se zapíše

if ($_GET["addnews"] == 1) {
?>
<form action="admin.php?addnews=2" method="post"> 
Titulek<input type="text" name="titulek" /> <br/>
Novinka <textarea id="elm1" name="text" rows="15" cols="80" style="width: 80%"></textarea><br/> 
Celý text novinky <textarea id="elm1" name="celytext" rows="15" cols="80" style="width: 80%"></textarea><br/>  
<input type="submit" value='Přidat novinku' /> <br/>
</form>  
<?
}

if ($_GET["addnews"] == 2) {
if (isset($_POST['titulek']) && isset($_POST['text'])) {
$titulek = $_POST['titulek'];
$text = $_POST['text'];
$celytext = $_POST['celytext'];
$sql= "INSERT INTO novinky (titulek, text, celytext) VALUES ('".mysql_real_escape_string($titulek)."','".mysql_real_escape_string($text)."','".mysql_real_escape_string($celytext)."')"; 
 
if (!mysql_query($sql,$con)) 
  { 
  die('Error: ' . mysql_error()); 
  } 
echo "<p>Novinka byla p5id8na<a href='admin.php'>ZPĚT</a></p> ";  

}
 }
honzisko
Profil
no potom už stačí měnit pouze theme: "simple" na další vzhledy, které tam jsou ( full atp. )
zkus pohledat na TinyMCE wiki - musí se do mode přidat název arey - bohužel už si nepamatuju jak se to dělalo...


tak jo už jsem ti to zjistil. řešení je následující.
<!-- TinyMCE -->
<script type="text/javascript" src="jscripts/tiny_mce/tiny_mce.js"></script>
<script type="text/javascript">
tinyMCE.init({
        mode : "exact",
        elements : "elm1,elm2", // DEFINUJEŠ ID FORMULÁŘE
        theme : "simple",
    });
</script>
<!-- /TinyMCE -->

<textarea id="elm1" name="elm1" rows="15" cols="80" style="width: 80%">Testo</textarea>
    <textarea id="elm2" name="aasd" rows="15" cols="80" style="width: 80%" >testo2</textarea>
dawe27
Profil
už to jde i odesíla, akorat ještě vše nefunguje správně, když dám třeba text tučně tak se zobrazí, ale když chci jinou barvou tak ho napíše klasicky, a obrazek když vložím tak se taky nechce zobrazit


a ještě jestli jde nějak nastavit když stisknu enter tak aby to zalomilo řádek a nedělalo odstavec


nejspiš to je tím že když se podívam na kod tak před uvozovky to hází lomitko
honzisko
Profil
Na to odesílání pravděpodobně budou existovat nějaké pluginy všechno najdeš na domovské stránce tinymce.com. Zkus si projít dokumentaci co jsem posílal na ní odkaz už výše [#10], tam najdeš spoustu triků a typů.
dawe27
Profil
o už jsem na par věci přišel ale nemůžu zjistit jak to nastavit avy to nedělalo odstavce ale divy jako výchozí
 theme_advanced_blockformats : "p,div,h1,h2,h3,h4,h5,h6,blockquote,dt,dd,code,samp",
skoušel jsem už dat i jako první div, ale jako výchozí byl pořad odstavec,
a ještě problém s některými kody ve kterých se po zápisu do DB před uvozovky zapíšou lomítka takže pak ten kod nefunguje, když jsem skoušel přímo v DB zapsat ten kod tak to jelo, není to ale editorem, dělalo to i bez něj


na první problem jsem přišel ještě ten druhý
honzisko
Profil
Lomítka - máš nastavenou ochranu kdy se před " ' atp. dá / - viz SQL injection J, Vrána
dawe27
Profil
pořad ale s toho nechapu jak udělat aby to ten kod vypsalo správně
místo aby to zobrazilo obrazek vypíše to jenom \"img\" když zobrazim zdrojový kod (ctrl+u)
tak ten kod vypada takto <img src=\"http://dw27.eu/images/logo.png\" alt=\"img\" border=\"0\" />
na výpis mam takový to kod
if ($_GET["id"] == 0) {
$data=mysql_query ("select  * from novinky ");
while ($data1= MySQL_Fetch_Array($data)):  {
echo "<a href='".$_SERVER["PHP_SELF"]."?id=".$data1["id"]."'><strong>". $data1["titulek"]."</strong></a>";?><br/><?
echo "".$data1["text"]."";?><br/><?
echo $data1["datum"] ;?><br/><?
} endwhile;
}
dawe27
Profil
už jsem to vyřešil dik :)
romulus
Profil *
Zdravím, Mám problém s MCE editorem. Potřebuju využívat písmo, které mám nadefinované přes @font-face, ale nějak se mi to nedaří zprovoznit. Mám to nadefinované v tiny_mce\themes\advanced\editor_template.js normálně se mi to zobrazí správně v rozbalovacím menu, ale písmo se nezmění v textaree. Nevíte čím by to mohlo být? V IE9 mi to funguje bez diakritiky, ale diakritika u toho písma je.

Díky za všechny rady

Vaše odpověď

Mohlo by se hodit


Prosím používejte diakritiku a interpunkci.

Ochrana proti spamu. Napište prosím číslo dvě-sta čtyřicet-sedm:

0