I have facing problem is how to hide part of string in the treeview? I want hide the certain part of tree in the coding. For example, I want hide part of string in all email in the treeview, it will show me like this"developer2(d*******2@hotmail.com)" Below is my coding:
<div class="row-fluid">
<!-- block -->
<div class="block">
<div class="block-content collapse in">
<div class="span6">
<?php
$sql="select * from level_tree lt JOIN users u ON lt.user_id = u.id where lt.referal_id =". $user_id;
$query=mysql_query($sql);
if(mysql_num_rows($query)>0){
$select_name = 'SELECT * FROM users WHERE id = ' . $user_id;
$query_select = db_conn_select($select_name);
foreach($query_select as $rs_select) {
$name = $rs_select['name'];
$email = $rs_select['email'];
echo preg_replace("/(?!^).(?!$)/", "*", $name,$email);
}
?>
<div id="jstree">
<ul>
<li><?php echo $name. '('.$email.')' ?></li>
<ul>
<?php
while($rs=mysql_fetch_array($query)){
echo "<li>".$rs['name']." (".$rs['email'].")";
downline_list($rs['id']);
echo "</li>";
}
?>
</div>
<?php
}else{
echo "No downline";
}
function downline_list($id){
$sql="select * from level_tree lt JOIN users u ON lt.user_id = u.id where lt.referal_id =".$id;
$query=mysql_query($sql);
if(mysql_num_rows($query)){
echo "<ul>";
while($rs=mysql_fetch_array($query)){
echo "<li>".$rs['name']." (".$rs['email'].")";
downline_list($rs['id']);
echo "</li>";
}
echo "</ul>";
}
}
?>
</ul></div>
</div>
</div>
<!-- /block -->
</div>
<script src="plugins/jstree/dist/jquery-1.10.2.min.js"></script>
<link rel="stylesheet" href="plugins/jstree/dist/themes/default/style.min.css" />
<script src="plugins/jstree/dist/jstree.min.js"></script>
<script>
$(function () {
// 6 create an instance when the DOM is ready
$('#jstree').bind("ready.jstree", function () {
$('#jstree').jstree('open_all');
}).jstree();
});
</script>
<style type="text/css">
.jstree li > a > .jstree-icon { display:none !important; }
</style>
Now current output is show me like the below (Actually, I want all the email will hide like this example (d*******2@hotmail.com)):
Hope someone can guide me how to hide part of email in the treeview like (d*******2@hotmail.com). Thanks.