|
|
<SCRIPT LANGUAGE="JavaScript">
|
|
|
|
|
|
select_url_list();
|
|
|
|
|
|
//搜索seo列表
|
|
|
function select_url_list()
|
|
|
{
|
|
|
$("#url_list_ui").html('waiting...');
|
|
|
$.ajax({
|
|
|
type:"post",
|
|
|
dataType:"json",
|
|
|
url:"<?php echo site_url('seo/search/'); ?>",
|
|
|
data:{'url_keyword':$('#url_keyword').val()},
|
|
|
success:function(data,textStatus){
|
|
|
for(var key in data){
|
|
|
if(data[key].name=='ok'){
|
|
|
$("#url_list_ui").html(data[key].value);
|
|
|
return true;
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
error:function(){
|
|
|
$.modaldialog.error('发生错误,请联系YCC');
|
|
|
return false;
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
|
|
|
//初始化添加seo记录
|
|
|
function add_seo_init()
|
|
|
{
|
|
|
$('#seo_id').val('');
|
|
|
$('#seo_url').val('');
|
|
|
$('#seo_h1').val('');
|
|
|
$('#seo_summary').val('');
|
|
|
$('#seo_title').val('');
|
|
|
$('#seo_keywords').val('');
|
|
|
$('#seo_description').val('');
|
|
|
}
|
|
|
|
|
|
|
|
|
function select_seo_url(url)
|
|
|
{
|
|
|
$.ajax({
|
|
|
type:"post",
|
|
|
dataType:"json",
|
|
|
url:"<?php echo site_url('seo/detail/'); ?>",
|
|
|
data:{'url_keyword':url},
|
|
|
success:function(data,textStatus){
|
|
|
for(var key in data){
|
|
|
if(data[key].name=='ok'){
|
|
|
var data_object=data[key].value;
|
|
|
$('#seo_url').val(data_object['seo_url']);
|
|
|
$('#seo_h1').val(data_object['seo_h1']);
|
|
|
$('#seo_summary').val(data_object['seo_summary']);
|
|
|
$('#seo_title').val(data_object['seo_title']);
|
|
|
$('#seo_keywords').val(data_object['seo_keywords']);
|
|
|
$('#seo_description').val(data_object['seo_description']);
|
|
|
$('#seo_id').val(data_object['seo_id']);
|
|
|
return true;
|
|
|
}else{
|
|
|
$.modaldialog.error(data[key].value);
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
error:function(){
|
|
|
$.modaldialog.error('发生错误,请联系YCC');
|
|
|
return false;
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
|
|
|
|
|
|
function delete_seo(seo_id)
|
|
|
{
|
|
|
$.ajax({
|
|
|
type:"post",
|
|
|
dataType:"json",
|
|
|
url:"<?php echo site_url('seo/delete'); ?>",
|
|
|
data:{'seo_id':$('#seo_id').val()},
|
|
|
success:function(data,textStatus){
|
|
|
for(var key in data){
|
|
|
if(data[key].name=='ok'){
|
|
|
$.modaldialog.success(data[key].value);
|
|
|
setTimeout(function() {
|
|
|
window.location.href='';
|
|
|
}, 500);
|
|
|
return true;
|
|
|
}else{
|
|
|
$.modaldialog.error(data[key].value);
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
error:function(){
|
|
|
$.modaldialog.error('发生错误,请联系YCC');
|
|
|
return false;
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
|
|
|
function seo_check()
|
|
|
{
|
|
|
$(".seo-tips").remove();
|
|
|
$("input,textarea").css({
|
|
|
"border-color":"initial"
|
|
|
});
|
|
|
//title长度
|
|
|
var title = '';
|
|
|
title=$("#seo_title").val();
|
|
|
var title_length=get_string_length(title);
|
|
|
if (title_length<20 || title_length>60) {
|
|
|
set_tip('#seo_title','SEO标题长度必须在20~60个字符之间(当前长度为:'+title_length+')');
|
|
|
}
|
|
|
|
|
|
//H1与Title的第一个关键词一致
|
|
|
var h1_content=$("#seo_h1").val();
|
|
|
h1_content=h1_content.split(',')[0];
|
|
|
h1_content=$.trim(h1_content);
|
|
|
title=title.split(',')[0];
|
|
|
title=$.trim(title);
|
|
|
if(h1_content.toLowerCase() != title.toLowerCase()){
|
|
|
set_tip('#seo_h1','H1与Title的第一个关键词不相同');
|
|
|
}
|
|
|
|
|
|
//description长度
|
|
|
var description=$("#seo_description").val();
|
|
|
var description_length=get_string_length(description);
|
|
|
if (description_length<80 || description_length>160) {
|
|
|
set_tip('#seo_description','SEO描述长度必须在80~160个字符之间(当前长度为:'+description_length+')');
|
|
|
}
|
|
|
|
|
|
//url中是否有特殊字符
|
|
|
var a_href = $("#seo_url").val();
|
|
|
var reg=RegExp(/[(\!)(\^)(\()(\))(\[)(\])(\{)(\})(\|)(\;)(\')(\")(\,)(\<)(\>)( )]+/);
|
|
|
if(reg.test(a_href)){
|
|
|
set_tip('#seo_url','链接中有特殊字符');
|
|
|
}
|
|
|
|
|
|
return true;
|
|
|
}
|
|
|
function set_tip(element,msg){
|
|
|
$(element).css({
|
|
|
"border-style":"solid",
|
|
|
"border-width":"1px",
|
|
|
"border-color":"red"
|
|
|
});
|
|
|
$(element).after('<p class="seo-tips" style="padding-left:110px;color:red;">'+msg+"</p>");
|
|
|
}
|
|
|
|
|
|
</SCRIPT>
|
|
|
|
|
|
|
|
|
<div class="title">
|
|
|
<h2 class="edit">SEO管理</h2>
|
|
|
<p style="color: blue; position: relative; left: 10px; line-height: 15px; top: 4px;"><b style="color:red;font-size:13px">注意:</b>例如 http://www.viaje-a-china.com/hotel/guilin-hoteles/ ,配置时只需要“/hotel/guilin-hoteles/”</p>
|
|
|
</div>
|
|
|
|
|
|
<div id="seo_edit">
|
|
|
|
|
|
<div id="seo_seatch_box">
|
|
|
<input type="text" name="url_keyword" id="url_keyword" class="L380" value="" />
|
|
|
<input type="button" onclick="select_url_list();" name="url_search" id="url_search" value="搜索" />
|
|
|
<input type="button" onclick="add_seo_init();" value="新增记录" />
|
|
|
|
|
|
<ul id="url_list_ui">
|
|
|
</ul>
|
|
|
</div>
|
|
|
|
|
|
<hr/>
|
|
|
|
|
|
<div id="seo_edit_box">
|
|
|
<form id="form_seo_edit" name="form_seo_edit" method="post" action="<?php echo site_url('seo/edit_save') ?>">
|
|
|
<div><label>URL:</label><input type="text" name="seo_url" id="seo_url" class="L380" value="<?php echo isset($seo_url)?$seo_url:false; ?>" /></div>
|
|
|
<div><label>H1标题:</label><input type="text" name="seo_h1" id="seo_h1" class="L380" value="<?php echo isset($seo_detail->seo_h1)?$seo_detail->seo_h1:false; ?>" /></div>
|
|
|
<div><label>页面介绍:</label><textarea name="seo_summary" id="seo_summary" cols="" rows="5" class="L560"><?php echo isset($seo_detail->seo_summary)?$seo_detail->seo_summary:false; ?></textarea>
|
|
|
<div><label> </label>链接代码: <a href="/beijing.htm" >beijing</a> </div>
|
|
|
</div>
|
|
|
<div><label>SEO标题:</label><input type="text" name="seo_title" id="seo_title" class="L380" value="<?php echo isset($seo_detail->seo_title)?$seo_detail->seo_title:false; ?>" /></div>
|
|
|
<div><label>SEO关键词:</label><input type="text" name="seo_keywords" id="seo_keywords" class="L380" value="<?php echo isset($seo_detail->seo_keywords)?$seo_detail->seo_keywords:false; ?>" /></div>
|
|
|
<div><label>SEO描述:</label><textarea name="seo_description" id="seo_description" cols="" rows="5" class="L560"><?php echo isset($seo_detail->seo_description)?$seo_detail->seo_description:false; ?></textarea></div>
|
|
|
<input type="hidden" id="seo_id" name="seo_id" value="<?php echo isset($seo_detail->seo_id)?$seo_detail->seo_id:false; ?>" />
|
|
|
</form>
|
|
|
<div class="common_save_delete">
|
|
|
<a href="javascript:void(0);" class="common_save" onclick="submitForm('form_seo_edit');seo_check();" ></a>
|
|
|
<a href="javascript:void(0);" class="common_delete" onclick="delete_seo();" ></a>
|
|
|
</div>
|
|
|
</div>
|
|
|
|
|
|
</div>
|