brophp实战第一节

来源:互联网 发布:vb循环语句实例for 编辑:程序博客网 时间:2024/05/21 10:46

今天学习了兄弟连教程中brophp的第一节实战,一直处于似懂非懂的状态,整个脑袋晕晕乎乎的,知其然不知所以然,大概还需要好好的努力吧。废话不多学,写一下今天的收获,并且坚持天天写一下自己的收获。

      首先安装brophp框架:在你网站的根目录下建一个 admin.php文件,例如我j建在了 xsphp/admin.php

    

<?php    define('APP','./admin');require('./brophp/brophp.php');
然后在在浏览器中输入localhst/xsphp/admin.php

那么会生成相应的文件夹,因为我的QQ截图不好使用了,就暂不截图了。主要有admin、classes、common等文件夹,这里咱们就说生成的admin文件夹,admin文件夹下有controls models views 三个文件夹,分别是控制层、业务层和视图层。

首先在控制层的admin.class.php中写入

<?phpclass Index {function index(){debug(0);$this->display();}        function top(){debug();$this->display();}function menu(){debug();$this->display();}function main(){debug();$this->display();}}

然后在view/default/index里面建立 index.html

写入代码:

<html>    <head>    <meta charset="utf-8" />    <title>管理平台</title></head><frameset rows="100,*">    <frame src="<{$url}>/top" name="top"/><frameset cols="150,*">     <frame src="<{$url}>/menu" name="left" /><frame src="<{$url}>/main" name="right" /></frameset></frameset></html>

然后在创建hreader.html、menu.html、main.html 分别如下:

<html>    <head>    <meta charset="utf-8" />    <title>--未知标题--</title></head><body>    <center>    <h1>管理平台</h1></center><a href="<{$url}>/menu/pd/one" target="left">频道一</a>||<a href="<{$url}>/menu/pd/two" target="left">频道二</a>||<a href="<{$url}>/menu/pd/three" target="left">频道三</a>||<a href="<{$url}>/menu/pd/four" target="left">频道四</a>||<a href="<{$url}>/menu/pd/five" target="left">频道五</a>||<a href="<{$url}>/menu/pd/six" target="left">频道六</a>||<a href="<{$url}>/menu/pd/seven" target="left">频道六</a></body></html>


<html>    <head><span style="white-space:pre"></span>    <meta charset="utf-8" /><span style="white-space:pre"></span>    <title></title><span style="white-space:pre"></span></head><span style="white-space:pre"></span><body><span style="white-space:pre"></span>    <ul style="list-style:none;margin:0px;padding:0px;"><span style="white-space:pre"></span>    <{if $smarty.get.pd eq "two"}><span style="white-space:pre"></span>    222222222<br><span style="white-space:pre"></span>    222222222<br><span style="white-space:pre"></span>    222222222<br><span style="white-space:pre"></span>    222222222<br><span style="white-space:pre"></span>    222222222<br><span style="white-space:pre"></span><{elseif $smatry.get.pd eq "three"}><span style="white-space:pre"></span>    3333333333<br><span style="white-space:pre"></span>    3333333333<br><span style="white-space:pre"></span>    3333333333<br><span style="white-space:pre"></span>    3333333333<br><span style="white-space:pre"></span>    3333333333<br><span style="white-space:pre"></span><{elseif $smarty.get.pd eq "four"}><span style="white-space:pre"></span>    4444444444<br><span style="white-space:pre"></span>    4444444444<br><span style="white-space:pre"></span>    4444444444<br><span style="white-space:pre"></span>    4444444444<br><span style="white-space:pre"></span>    4444444444<br><span style="white-space:pre"></span>    4444444444<br><span style="white-space:pre"></span><{elseif $smarty.get.pd eq "five"}><span style="white-space:pre"></span>    5555555555<br><span style="white-space:pre"></span>    5555555555<br><span style="white-space:pre"></span>    5555555555<br><span style="white-space:pre"></span>    5555555555<br><span style="white-space:pre"></span>    5555555555<br><span style="white-space:pre"></span><{elseif $smarty.get.pd eq "six"}><span style="white-space:pre"></span>    666666666666<br><span style="white-space:pre"></span>    666666666666<br><span style="white-space:pre"></span>    666666666666<br><span style="white-space:pre"></span>    666666666666<br><span style="white-space:pre"></span>    666666666666<br><span style="white-space:pre"></span><{elseif $smarty.get.pd eq "seven"}><span style="white-space:pre"></span>77777777777<br><span style="white-space:pre"></span>77777777777<br><span style="white-space:pre"></span>77777777777<br><span style="white-space:pre"></span>77777777777<br><span style="white-space:pre"></span>77777777777<br><span style="white-space:pre"></span><{else}><span style="white-space:pre"></span>    <li><span style="white-space:pre"></span>    <h3>分类管理</h3><span style="white-space:pre"></span><ul><span style="white-space:pre"></span>    <li><a href="<{$app}>/cats/add" target="right">添加分类</a></li><span style="white-space:pre"></span><li><a href="<{$app}>/cats" target="right">编辑分类</a></li><span style="white-space:pre"></span></ul><span style="white-space:pre"></span></li><span style="white-space:pre"></span><li><span style="white-space:pre"></span>    <h3>商品管理</h3><span style="white-space:pre"></span><ul><span style="white-space:pre"></span>    <li><a href="<{$app}>/goods/add" target="right">添加商品</a></li><span style="white-space:pre"></span><li><a href="<{$app}>/goods" target="right">编辑商品</a></li><span style="white-space:pre"></span></ul><span style="white-space:pre"></span></li><span style="white-space:pre"></span><li><span style="white-space:pre"></span>    <h3>用户管理</h3><span style="white-space:pre"></span><ul><span style="white-space:pre"></span>    <li><a href="<{$app}>/user/add" target="right">添加用户</a></li><span style="white-space:pre"></span><li><a href="<{$app}>/user" target="right">编辑用户</a></li><span style="white-space:pre"></span></ul><span style="white-space:pre"></span></li><span style="white-space:pre"></span><{/if}><span style="white-space:pre"></span></ul><span style="white-space:pre"></span></body></html>
主页面,欢迎信息!
接下来:在control中分别建cats.class.php goods.class.php user.class.php 三个php文件
<?php    class Cats{//编辑分类function index(){$this->display();}function add(){$this->display();}}
最后,在view/default/下分别建cats goods user 三个文件夹,各自的文件夹下建 index.html 和 add.html 

输入相应的内容。

今天就学了这些,先写到这里面,明天学习了继续写。。。

         

0 0
原创粉丝点击