<!DOCTYPE html>
<html>
<head>
<title>Nor-Avetisyan Admin</title>
<link rel="stylesheet" href="<?php echo URL ?>views/admin/css/navi.css">
<link rel="stylesheet" href="<?php echo URL ?>views/admin/css/style.css">
<script src="<?php echo URL ?>views/js/jquery-2.0.1.min.js"></script>
<script type="text/javascript" src="<?php echo URL ?>views/admin/tinymce/tinymce.min.js"></script>
<script type="text/javascript">
tinymce.init({
selector: "textarea"
});
</script>
<script>
$(document).ready(function() {
$('.n_warning,.n_ok,.n_error').hide();
$(document).on('click', '.delete', function(e) {
e.preventDefault();
var id = $(this).attr('id'),
url = document.URL;
$('.n_warning').fadeOut(500);
$('.n_warning').fadeIn(500);
$('.n_warning').html('<p>Are you sure? <button class=\"yes\">YES</button><button class=\"no\">NO</button></p>');
$('.yes').click(function(){
$.ajax({
type: 'POST',
url: '/admin/delete',
data: {
id:id
},
success: function(data){
$('#'+id).fadeOut(500);
$('#adm-notification').html(data);
}
});
setInterval(window.location = url,1000);
});
$('.no').click(function(){
$('.n_warning').fadeOut(500);
});
});
$('.button-save').click(function(b){
b.preventDefault();
var title = $('#title').val(),
category = $('#category').val(),
file = $('#file').val(),
short_content = tinyMCE.get('short_content').getContent(),
content = tinyMCE.get('content').getContent(),
date = $('#date').val(),
language = $('#language').val();
alert(short_content);
$.ajax({
type: 'POST',
url: '/admin/save',
data: {
title:title,
category:category,
file:file,
short_content:short_content,
content:content,
date:date,
language:language
},
success: function(data){
$('.adm-notification').html(data);
}
});
});
});
</script>
</head>
<body>
<?php
$id = mysql_real_escape_string($_GET['id']);
$lang = mysql_real_escape_string($_GET['lang']);
$query_edit = mysql_query("SELECT id, category, title, img, short_content, content, date, lang FROM `news` WHERE id='$id' AND lang='$lang'");
//echo $id;
?>
<div class="wrap">
<div id="header">
<div id="top">
<div class="left">
<p>Welcome, <strong><?php echo $_SESSION['user'];?></strong> [ <a href="/admin/logout">logout</a> ]</p>
</div>
<div class="right">
<div class="align-right">
<p>Avetisyan | Admin Panel</p>
</div>
</div>
</div>
<div id="nav">
<?php include '/views/admin/upper-menu.php'; ?>
</div>
</div>
<div id="content">
<div id="sidebar">
<div class="box">
<div class="h_title">› Pages</div>
<?php include '/views/admin/left-menu.php'; ?>
</div>
</div>
<div id="main">
<div class="full_w">
<div class="adm-notification"></div>
<div class="n_error"><p></p></div>
<?php
while($edit = mysql_fetch_array($query_edit)){
print "
<h2>".$edit['lang']." - ".$edit['title']."</h2>
<div class=\"entry\">
<div class=\"sep\"></div>
</div>
<form action=\"\" method=\"post\">
<div class=\"element\">
<label for=\"name\">Page title <span class=\"red\">(required)</span></label>
<input id=\"title\" name=\"name\" value=".$edit['title']." class=\"text\" />
</div>
<div class=\"element\">
<label for=\"category\">Category <span class=\"red\">(required)</span></label>
<input id=\"category\" name=\"category\" value=".$edit['category']." class=\"text\" />
</div>
<div class=\"element\">
<label for=\"attach\">Attachments</label>
<input type=\"file\" id=\"file\" name=\"attach\" />
</div>
<div class=\"element\">
<label for=\"short-content\">Short content <span class=\"red\">(required)</span></label>
<textarea name=\"short_content\" id=\"short_content\" class=\"textarea\" rows=\"10\">".$edit['short_content']."</textarea>
</div>
<div class=\"element\">
<label for=\"content\">Long content <span class=\"red\">(required)</span></label>
<textarea name=\"content\" id=\"long_content\" class=\"textarea\" rows=\"10\">".$edit['content']."</textarea>
</div>
<div class=\"element\">
<label for=\"date\">Date <span class=\"red\">(required)</span></label>
<input id=\"date\" name=\"date\" class=\"text\" value=".$edit['date']." />
</div>
<div class=\"element\">
<label for=\"language\">Language <span class=\"red\">(required)</span></label>
<input id=\"language\" name=\"language\" value=".$edit['lang']." class=\"text\" />
</div>
<div class=\"entry\">
<button type=\"submit\" id=\"button-save\" class=\"add button-save\">Save page</button>
</div>
</form>
";
}
?>
</div>
<div class="clear"></div>
</div>
<div id="footer">
<div class="left">
<p><a href="http://webex.am">Webex Technologies LLC</a> | Admin Panel: <a href="/">Avetisyan</a></p>
</div>
<div class="right">
</div>
</div>
</div>
</body>
</html>
これは私のコードです..テキストエリアの値を取得しようとしています(2つあります)。しかし、その表示エラー:
キャッチされていない TypeError: 未定義のメソッド 'getContent' を呼び出せません
TinyMCE のバージョンは TinyMCE 4.0 です。
解決策を教えてください。今日もこれを解決する必要があります。ありがとう!!