2011-05-23 dfbc views

//layout/default.php

<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <link rel="stylesheet" type="text/css" media="screen" href="<?php echo base_url()?>css/common.css">
        <script type="text/javascript" src="<?php echo base_url()?>js/jquery-1.4.4.min.js"></script>
        <script type="text/javascript">var base_url = '<?php echo base_url();?>';</script>
    </head>
    <body>
        <div id="header">
            <div id="header_top">
                <div style="float:left;"></div>
                <div style="float:right;"></div>
            </div>
            <div id="header_page">
                <div class="page_item">首页</div>
                <div class="page_item">走进东方</div>
                <div class="page_item">护肤产品</div>
                <div class="page_item">东方资讯</div>
                <div class="page_item">东方护肤</div>
                <div class="page_item">东方互动</div>
            </div>
        </div>
        <div id="content">
            <div style="float:left;width:220px;">
                <div><?php echo $left_content_for_layout ?></div>
            </div>
            <div style="float:left;width:760px;">
                <div style="padding-left:20px;"><?php echo $content_for_layout ?></div>
            </div>
        </div>
        <div id="footer">
        </div>
    </body>
</html>

 

 

 

 

 

 

 

 

 

 

//information/list.php

<div id="list_1"></div>

<script type="text/javascript" src="<?php echo base_url();?>js/jquery.jsontable.js"></script>

<script type="text/javascript">

function list ( type, tab_index ) {
    $( '#list_' + tab_index ).jsontable({
        mtype : 'POST',
        url   : base_url + 'index.php/Information/jsondata/' + type,
        datatype : 'json',
        page  : 1,
        nums  : 20,
        colNames : ['标题', '点击率', '发布日期'],
        rowList : [20,30,40]
    });
}

function format_json_data_for_table ( jsondata ) {
    var rows = '';
    $.each( jsondata, function ( i, n ) {
        var tr = '<tr>';

        //标题
        tr += '<td><a href="' + base_url + 'index.php/Information/id/' + n.id + '"><span>' + n.title + '</span></a></td>';

        //点击率
        tr += '<td><span>' + n.hit_counter + '</span></td>';

        //发布日期
        tr += '<td><span>' + n.publish_date + '</span></td>';

        tr += '</tr>';

        rows += tr;
    });

    return rows;
}

</script>

<script type="text/javascript">
$( function(){
    list( 'company', 1 );
});
</script>

 

 

 

 

 

 

 

 

 

 

 

 

//information/menu.php

<div class="menu">
    <div class="menu_title">东方资讯</div>
    <div>
        <table>
            <tr>
                <td>
                    <div class="menu_item">公司资讯</div>
                </td>
            </tr>
            <tr>
                <td>
                    <div class="menu_item">市场活动</div>
                </td>
            </tr>
            <tr>
                <td>
                    <div class="menu_item">新品上市</div>
                </td>
            </tr>
        </table>
    </div>
</div>

 

 

 

 

 

 

 

 

 

 

 

 

 

 

//category/view.php

<div class="media">
    <?php if ( 'image' == $media['type'] ) :?>
    <img src="<?php echo base_url().$media['path']?>">
    <?php elseif ( 'flash' == $media['type'] ) :?>
    <?php endif;?>
</div>

<div class="product_list">
    <div style="float:left;">
        <?php foreach( $products as $product ): ?>
        <div class="product">
            <?php if ( 'true' == $product['is_new'] ): ?>
            <div class="new_product"><img src="<?php base_url()?>images/product/new_icon.gif"></div>
            <?php endif;?>
            <table>
                <tr>
                    <td rowspan="3">
                        <?php if ( !empty( $product['thumb'] ) ): ?>
                        <img src="<?php echo base_url().$product['thumb']?>">
                        <?php endif;?>
                    </td>
                    <td height="20">
                        <?php echo $product['name'];?>
                    </td>
                </tr>
                <tr>
                    <td height="80">
                        <span class="en_name"><?php echo $product['en_name'];?></span>
                    </td>
                </tr>
                <tr>
                    <td height="30">
                        <a href="<?php echo base_url().'index.php/Product/id/'.$product['id'];?>">
                            <img src="<?php echo base_url()?>images/product/viewmore.jpg">
                        </a>
                    </td>
                </tr>
            </table>
        </div>
        <?php endforeach;?>
    </div>
</div>

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

//product/view.php

<div>
    <table>
        <tr>
            <td>
                <?php if ( !empty( $product['thumb'] ) ): ?>
                <img src="<?php echo base_url().$product['small_image']?>">
                <?php endif;?>
            </td>
            <td>
                <table>
                    <tr>
                        <th>核心卖点:</th>
                        <td><?php $product['selling_point']?></td>
                    </tr>
                    <tr>
                        <th>本草成份:</th>
                        <td><?php $product['components']?></td>
                    </tr>
                    <tr>
                        <th>规格:</th>
                        <td><?php $product['specifications']?></td>
                    </tr>
                    <tr>
                        <th>主要功效:</th>
                        <td><?php $product['effect']?></td>
                    </tr>
                </table>
            </td>
        </tr>
    </table>
</div>

<div>
推荐产品
</div>

<div>
    <?php foreach( $recommend as $p ):?>
    <div class="product">
        <div class="recommendproduct"><img src="<?php base_url()?>images/product/recommend_icon.gif"></div>
        <table>
            <tr>
                <td rowspan="3">
                    <?php if ( !empty( $product['thumb'] ) ): ?>
                    <img src="<?php echo base_url().$product['thumb']?>">
                    <?php endif;?>
                </td>
                <td height="20">
                    <?php echo $product['name'];?>
                </td>
            </tr>
            <tr>
                <td height="80">
                    <span class="en_name">
                    <?php
                    if ( strlen( $product['effect'] ) > 100 )
                    {
                        echo substr( $product['effect'], 0, 100 );
                    }
                    else
                    {
                        echo $product['effect'];
                    }
                    ?>
                    </span>
                </td>
            </tr>
            <tr>
                <td height="30">
                    <a href="<?php echo base_url().'index.php/Product/id/'.$product['id'];?>">
                        <img src="<?php echo base_url()?>images/product/viewmore.jpg">
                    </a>
                </td>
            </tr>
        </table>
    </div>
    <?php endforeach;?>
</div>

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

//admin/category/list.php

<div style="margin-top:30px;">
    <a href="javascript:void(0);" οnclick="add_top_category()">添加分类</a>
</div>
<div id="category_list">
    <?php echo $tree;?>
</div>

<div id="category_dialog">
    <div id="category_container"></div>
</div>

<script type="text/javascript">
$( function(){
    $( '#category_list' ).find( '.tree_item' ).hover(
        function(){
            tree_item_mover( $(this) );
        },
        function(){
            tree_item_mout( $(this) );
        }
    ).click( function(){
        tree_item_click( $(this) );
    });

    $( '#category_list' ).find( '.shrink' ).click( function(){
        shrink( $(this) );
    });

    $( '#category_dialog' ).dialog({
        title: '分类',
        autoOpen: false,
        modal: true,
        width: 810,
        buttons: {
            '确定': function(){
                save_category();
                $(this).dialog( 'close' );
                return false;
            },
            '取消': function(){
                $(this).dialog( 'close' );
                return false;
            }
        }
    });
});
</script>
<script type="text/javascript">
function tree_item_mover ( ths )
{
    var category_id = ths.find( 'input[type=hidden]' ).eq(0).val();
    ths.addClass( 'tree_item_mover' );
    var html  = '<span class="append">';
        html += '[<a href="' + base_url + 'index.php/product/cid/' + category_id + '" target="_blank">查看</a>]&nbsp;';
        html += '[<a href="javascript:void(0);" οnclick="edit_category(this,' + category_id + ')">编辑</a>]&nbsp;';
        html += '[<a href="javascript:void(0);" οnclick="del_category(this,'  + category_id + ')">删除</a>]&nbsp;';
        html += '[<a href="javascript:void(0);" οnclick="add_category('  + category_id + ')">添加子分类</a>]';
        html += '</span>';
    ths.append( html );
}

function tree_item_mout ( ths )
{
    ths.removeClass( 'tree_item_mover' );
    ths.find( '.append' ).remove();
}

function tree_item_click ( ths )
{
    $( '#category_list' ).find( '.tree_item_clicked' ).removeClass( 'tree_item_clicked' );
    ths.addClass( 'tree_item_clicked' );
}

function save_category ()
{
    $( '#f_category' ).ajaxSubmit( function( data ){
        var json = format_jsondata( data );
        if ( '1' == json.status )
        {
            var li = '<li><div class="tree_item"><input type="hidden" value="' + json.msg.id + '">&nbsp;&nbsp;<span class="shrink">-</span>&nbsp;&nbsp;<span class="edit_container">' + json.msg.name + '</span></div></li>';
            var li_obj = $( '<li></li>' );
            li_obj.html( li );
            li_obj.find( '.tree_item' ).hover(
                function(){
                    tree_item_mover( $(this) );
                },
                function(){
                    tree_item_mout( $(this) );
                }
            ).click( function(){
                tree_item_click( $(this) );
            });

            if ( json.msg.parent_id > 0 )
            {
                var p = $( '#category_list' ).find( '.tree_item_clicked' );
                if ( 0 == p.parent().find( 'ul' ).length )
                {
                    p.parent().append( '<ul></ul>' );
                }
                p.parent().find( 'ul' ).eq(0).append( li_obj );
            }
            else
            {
                if ( 0 == $( '#category_list' ).find( 'ul' ).length )
                {
                    $( '#category_list' ).append( '<ul></ul>' );
                }
                $( '#category_list' ).find( 'ul' ).eq(0).append( li_obj );
            }
            $( '#category_dialog' ).dialog( 'close' );
        }
        else
        {
            alert( json.msg );
        }
    });
}

function edit_category ( e, category_id )
{
    var url = base_url + 'index.php/Admin_category/edit/' + category_id;
    $.get( url, {}, function( html ){
        $( '#category_container' ).html( html );
        $( '#category_dialog' ).dialog( 'open' );
    });
}

function del_category  ( e, category_id )
{
    var url = base_url + 'index.php/Admin_category/del/' + category_id;
    $.get( url, {}, function( data ){
        var json = format_jsondata( data );
        if ( '1' == json.status )
        {
            $(e).parent().parent().parent().remove();
        }
        else
        {
            alert( json.msg );
        }
    });
}

function add_category  ( parent_id )
{
    var url = base_url + 'index.php/Admin_category/add';
    $.get( url, {}, function( html ){
        $( '#category_container' ).html( html );
        $( '#h_parent_id' ).val( parent_id );
        $( '#category_dialog' ).dialog( 'open' );
    });
}

function add_top_category ()
{
    add_category(0);
}
</script>

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

//admin/product/add.php

<div>
    <form id="f_product" method="post" action="<?php echo base_url().'index.php/Admin_product/add'?>">
        <input type="hidden"  value=""    name="data[image]">
        <div>产品图片:<input type="file" name="image"></div>
        <div>
            <select name="data[category_id]">
                <option value="0">无</option>
                <?php
                foreach ( $categories as $category )
                {
                    $padding = '';
                    $_level  = $category['_level'];
                    while( $_level > 1 )
                    {
                        $padding .= '&nbsp;&nbsp;';
                        $_level--;
                    }
                    echo '<option value="'.$category['id'].'">'.$padding.$category['name'].'</option>';
                }
                ?>
            </select>
        </div>
        <div>产品名称:<input type="text" name="data[name]"></div>
        <div>英文名称:<input type="text" name="data[en_name]"></div>
        <div>核心卖点:<input type="text" name="data[selling_point]"></div>
        <div>本草成份:<input type="text" name="data[components]"></div>
        <div>产品规格:<input type="text" name="data[specifications]"></div>
        <div>主要功效:<textarea name="data[effect]"></textarea></div>
        <div>是否推荐:<input type="checkbox" name="data[is_recommend]"></div>
    </form>
</div>

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

//admin/product/edit.php

<div>
    <form id="f_product" method="post" action="<?php echo base_url().'index.php/Admin_product/edit/'.$product['id'];?>">
        <input type="hidden"  value=""    value="<?php echo $product['image']?>" name="data[image]">
        <div>产品图片:<input type="file" value="" name="image"></div>
        <div>
            <select name="data[category_id]">
                <option value="0">无</option>
                <?php
                foreach ( $categories as $category )
                {
                    $padding = '';
                    $selected = '';
                    while( $category['_level']-- )
                    {
                        $padding .= '&nbsp;';
                    }
                    if ( $category['id'] == $product['category_id'] )
                    {
                        $selected = 'selected="selected"';
                    }
                    echo '<option value="'.$category['id'].'" '.$selected.'>'.$padding.$category['name'].'</option>';
                }
                ?>
            </select>
        </div>
        <div>产品名称:<input type="text" value="<?php echo $product['name']?>"           name="data[name]"></div>
        <div>英文名称:<input type="text" value="<?php echo $product['en_name']?>"        name="data[en_name]"></div>
        <div>核心卖点:<input type="text" value="<?php echo $product['selling_point']?>"  name="data[selling_point]"></div>
        <div>本草成份:<input type="text" value="<?php echo $product['components']?>"     name="data[components]"></div>
        <div>产品规格:<input type="text" value="<?php echo $product['specifications']?>" name="data[specifications]"></div>
        <div>主要功效:<textarea name="data[effect]"><?php echo $product['effect']?></textarea></div>
        <div>是否推荐:<input type="checkbox" name="data[is_recommend]" <?php echo ( 'true' == $product['is_recommend'] )?'checked="checked"':'';?>></div>
        <div>是否为新:<input type="checkbox" name="data[is_new]" <?php echo ( 'true' == $product['is_new'] )?'checked="checked"':'';?>></div>
    </form>
</div>

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

//consts.php

<?php

define( 'CATEGORY_NAME_REPEAT',    '分类名字已被使用' );
define( 'CATEGORY_ADD_SUCCESS',    '分类添加成功' );
define( 'CATEGORY_ADD_ERROR',      '分类添加失败' );
define( 'CATEGORY_UPDATE_SUCCESS', '分类修改成功' );
define( 'CATEGORY_UPDATE_ERROR',   '分类修改失败' );
define( 'CATEGORY_DEL_SUCCESS',    '分类删除成功' );
define( 'CATEGORY_DEL_ERROR',      '分类删除失败' );
define( 'CATEGORY_NOT_EXISTS',     '分类不存在' );

define( 'PRODUCT_NAME_REPEAT',    '产品名字已被使用' );
define( 'PRODUCT_ADD_SUCCESS',    '产品添加成功' );
define( 'PRODUCT_ADD_ERROR',      '产品添加失败' );
define( 'PRODUCT_UPDATE_SUCCESS', '产品修改成功' );
define( 'PRODUCT_UPDATE_ERROR',   '产品修改失败' );
define( 'PRODUCT_DEL_SUCCESS',    '产品删除成功' );
define( 'PRODUCT_DEL_ERROR',      '产品删除失败' );
define( 'PRODUCT_NOT_EXISTS',     '产品不存在' );

define( 'INFORMATION_ADD_SUCCESS',    '资讯添加成功' );
define( 'INFORMATION_ADD_ERROR',      '资讯添加失败' );
define( 'INFORMATION_UPDATE_SUCCESS', '资讯修改成功' );
define( 'INFORMATION_UPDATE_ERROR',   '资讯修改失败' );
define( 'INFORMATION_DEL_SUCCESS',    '资讯删除成功' );
define( 'INFORMATION_DEL_ERROR',      '资讯删除失败' );
define( 'INFORMATION_NOT_EXISTS',     '资讯不存在' );

define( 'IMAGE_SIZE_EXCEED', '图片大小超出限制' );
define( 'IMAGE_TYPE_ERROR',  '图片类型不符合' );

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值