我是drupal的新手。我正在使用 drupal 7 中的代码创建自定义 url,我想设置自定义 url。我正在使用以下代码。目前它正在显示网址 http://abc.com/greeting-12 我想设置它http://abc.com/ab/cd/md5(string) 请让我知道我该怎么做?
<?php
drupal_add_css(drupal_get_path('theme', 'custom') . '/css/my_flip1.css', array('group' => CSS_THEME, 'type' => 'file'));
$path = base_path() . path_to_theme();
?>
<?php
global $url;
$link_id=$_REQUEST['link_id'];
global $myimg;
global $de;
if(isset($_REQUEST['id']))
{
global $myimg;
global $de;
global $url;
$myimg=$_REQUEST['img'];
$path = base_path() . path_to_theme();
$account = $GLOBALS['user']->uid;
$de=$_REQUEST['txt'];
$node=new stdClass();
$node->type = "page"; // Or any other content type you want
$title=$node->title="Greeting";
$node->language = LANGUAGE_NONE;
node_object_prepare($node); // Set some default values.
$node = node_submit($node); // Prepare node for a submit
node_save($node); // After this call we'll get a nid
$node->status = 1;
$options = array('absolute' => TRUE);
$nid =$node->nid;
$url = url('node/' . $nid, $options);
$node->path=$url;
db_insert('user_shared_image')
->fields(array(
'uid' => $account,
'link' => $node->path,
'description'=>$_REQUEST['txt'],
'link_id'=>$link_id,
))
->execute();
$format = '
<head>
<style>
.imgright{
background: url("../images/trans.png") repeat scroll 0 0 transparent;
}
</style>
<script type="text/javascript">
jQuery(document).ready(function(){
jQuery(".flip-container").click(function() {
jQuery(".flip-container").addClass("hover");
jQuery(".transparent1").hide();
jQuery("#back").css("visibility","visible");
});
jQuery("#back").click(function() {
jQuery(".flip-container").removeClass("hover");
jQuery(".transparent1").show();
jQuery("#back").css("visibility","hidden");
});
});
</script></head>
<div align="center">
<button id="back" type="button" style="visibility:hidden;">
Show Image</button> </div>
<div class="right-element1" align="center">
<div class="flip-container flip" style="float:none !important;">
<div class="flipper">
<div class="front">
'.$myimg.'
</div>
<div class="back face center">
<div id="back-content">
<p> '.$_REQUEST["txt"].' </p>
</div>
</div>
</div>
</div>
<div class="transparent1">
<p> '.$_REQUEST["txt"].' </p>
</div>
</div>';
db_insert('field_data_body')
->fields(array(
'entity_type'=>'node',
'bundle'=>'page',
'entity_id'=>$nid,
'revision_id'=>$nid,
'language'=>'und',
'delta'=>0,
'body_value' => $format,
'body_format'=>'php_code',
))
->execute();
echo $url;
exit;
}