喜悦国际村 
» 游客:  注册 | 登录 | 搜索 | 统计 | 喜悦证交所 | 帮助

RSS 订阅当前论坛  

$5.95 Web Hosting     

上一主题 下一主题
     
标题: [问题] 用PHPLIB的Templatete类的人士有没有碰到这样的问题?  
 
zjstandup
新手上路
Rank: 1



UID 79433
精华 0
积分 7
帖子 5
金钱 7 喜悦币
威望 0
人脉 0
阅读权限 10
注册 2006-9-2
状态 离线
[广告]: 代充Paypal帐号美元
用PHPLIB的Templatete类的人士有没有碰到这样的问题?

<select name="user_education" style="width:130px;">
        <Option value="0">保密</Option>
        <Option value="1">高中</Option>
        <Option value="2">中专</Option>
        <Option value="3">大专</Option>
        <Option value="4">本科</Option>
        <Option value="5">硕士</Option>
        <Option value="6">博士</Option>
</select>           

假如用户这次选择了博士,把6存进了数据库
下次用户想看看他这个选项选了什么,该怎么办?要判断6次?
2006-11-3 04:34 PM#1
查看资料  发短消息  顶部
 
zjstandup
新手上路
Rank: 1



UID 79433
精华 0
积分 7
帖子 5
金钱 7 喜悦币
威望 0
人脉 0
阅读权限 10
注册 2006-9-2
状态 离线
[广告]: Enom域名自助付费 自助注册 自助PUSH 主流域名COM等一律57.99元年
而且每个option里面设置一个模板变量?
2006-11-3 04:35 PM#2
查看资料  发短消息  顶部
 
netshark2005
注册会员
Rank: 2



UID 77516
精华 0
积分 53
帖子 46
金钱 53 喜悦币
威望 0
人脉 0
阅读权限 20
注册 2006-8-2
状态 离线
[推荐阅读] Google acquires Web applications pioneer JotSport Tue Oct 31, 3:33 PM ET
selected
2006-11-8 09:47 AM#3
查看资料  发短消息  顶部
 
dnsing
注册会员
Rank: 2


UID 70695
精华 0
积分 56
帖子 52
金钱 56 喜悦币
威望 0
人脉 0
阅读权限 20
注册 2006-3-30
状态 离线
[推荐阅读] 我对PHP5中接口的理解
用JavaScript就行了,如果要用PHP实现起来会比较慢,这样的小功能就交给JavaScript搞掂。
2006-11-9 11:47 PM#4
查看资料  访问主页  发短消息  顶部
 
剑枫 (雪花)
论坛元老
Rank: 8Rank: 8
欧玛嘎


UID 26144
精华 1
积分 4855
帖子 1727
金钱 4845 喜悦币
威望 10
人脉 0
阅读权限 90
注册 2004-2-14
来自 山东郓城
状态 离线
[推荐阅读] 模拟页面提交数据
引用这个js文件,所有的表单形式都支持,一个函数搞定。
Set(元素的name, 设定的值);
支持单选复选按钮,单选复选菜单,输入框,长文本

var EType;
/***
DreamEcm Formset
Date: Jul 13, 2006
Copyright: DreamSoft Co.,Ltd.
Mail: Dream@Dreamsoft.Ca
Author: Egmax
Update:
  Oct 28, 2006 : 支持checkbox和select多选
***/

function Submit(Fname)
{
        document.forms[Fname].submit();
}

function Dis(Eid)
{
        if(arguments.length == 1) { $(Eid).disabled = true; return; }
        var i;
        for (i=0; i<arguments.length; i++)
        if(typeof(arguments[i]) == 'string')  $(arguments[i]).disabled = true;
}

function Set(Fid, v)
{
        switch($(Fid).type) {
        case 'select-one'       : _Select  (Fid, v);  break;
        case 'select-multiple'  : _MSelect (Fid, v);  break;
        case 'checkbox'         : _Checkbox(Fid, v);  break;
        case 'radio'            : _Radio   (Fid, v);  break;
        default                 : _Input   (Fid, v);
        }
}

function Clk(Fname)
{
        $(Fname).click();
}

function $(EId)
{
        if(arguments.length == 1) return document.getElementsByName(EId)[0];
        var i,Es = new Array();
        for (i=0; i<arguments.length; i++)
                if(typeof(arguments[i]) == 'string')  Es.push(document.getElementsByName(arguments[i])[0]);
        return Es;
}

function _Input(Eid, v)
{
        $(Eid).value = v;
}

function _Select(Eid,v)
{
        var _obj = $(Eid);
        for(var i=0; i<_obj.options.length; i++)
        if(_obj.options[i].value == v) { _obj.options[i].selected = true; break; }
}

function _MSelect(Eid,v)
{
        var _V   = ','+v+',';
        var _obj = $(Eid);
        for(var i=0; i<_obj.options.length; i++)
        if(_V.indexOf(','+_obj.options[i].value+',') != -1) { _obj.options[i].selected = true; }
}

function _Checkbox(Eid,v)
{
        var _V   = ','+v+',';
        var _Box = document.getElementsByName(Eid);
        for (var i=0; i<_Box.length; i++)
        if (_V.indexOf(','+_Box[i].value+',') != -1) { _Box[i].click(); }
}

function _Radio(Eid, Evalue)
{
        var _radio  = document.getElementsByName(Eid);
        for (var i=0; i<_radio.length; i++) if (_radio[i].value == Evalue) { _radio[i].click(); break; }
}




在场外支持奥运.....
2006-11-11 09:30 PM#5
查看资料  访问主页  发短消息  QQ  顶部
 
17521
注册会员
Rank: 2



UID 77914
精华 0
积分 119
帖子 97
金钱 119 喜悦币
威望 0
人脉 0
阅读权限 20
注册 2006-8-8
状态 离线
[推荐阅读] 求助!导入数据出错!
楼上几位好像不懂楼主的意思
2006-11-12 06:10 PM#6
查看资料  发短消息  顶部
 
heimayi (heimayi)
金牌会员
Rank: 6Rank: 6
高级会员



UID 11687
精华 2
积分 1619
帖子 1581
金钱 1599 喜悦币
威望 20
人脉 0
阅读权限 70
注册 2002-1-4
状态 离线
[推荐阅读] 无刷新聊天室的工作原理是什么?
好久没上来发帖了.
偶是这样解决的.您看看.也许对您有帮助.

<?php
<html>
<
head>
<
meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<
title>管理</title>
<
link href="../style/style.css" rel="stylesheet" type="text/css">
<
script type="text/javascript" src="../FCKeditor/fckeditor.js"></script>
<SCRIPT LANGUAGE="JavaScript">
<!--
function checkValue (obj)
{
    if (!obj.sLang.value)
    {
        alert ('请选择语言!');
        obj.sLang.focus ();
        return false;
    }

}
//-->
</SCRIPT>
<SCRIPT LANGUAGE="JavaScript">
<!--
function init()
{
    myForm.sLang.value = '{sLang}';
    myForm.sType.value = '{sType}';
}
//-->
</SCRIPT>
</head>

<body topmargin="5" onLoad="init();">
<table width="99%" height="100%" border="0" cellpadding="0" cellspacing="0" id="__01">
  <tr> 
    <td width="29" height="31"> <img src="../images/boder_01.gif" width="29" height="31" alt=""></td>
    <td background="../images/boder_02.gif">&nbsp; </td>
    <td width="31"> <img src="../images/boder_03.gif" width="31" height="31" alt=""></td>
  </tr>
  <tr> 
    <td background="../images/boder_04.gif">&nbsp; </td>
    <td valign="top"><TABLE WIDTH=100% height="100%" BORDER=0 align="center" CELLPADDING=0 CELLSPACING=0>
        <TR> 
          <TD height="60" valign="bottom"> <table width="98%" border="0" align="center" cellpadding="2" cellspacing="1">
              <tr> 
                <td height="55" valign="top"> {menu}</td>
              </tr>
            </table></TD>
        </TR>
        <TR> 
          <TD valign="top"><table width="98%" border="0" align="center" cellpadding="0" cellspacing="0">
              <tr> 
                <td height="30">栏目管理 <font color="#FF6600" size="1">&gt;&gt;</font> 
                  编辑</td>
              </tr>
              <tr> 
                <td><table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
                    <tr> 
                      <td background="../images/line.gif"><img src="../images/line.gif" width="24" height="3"></td>
                    </tr>
                    <tr> 
                      <td height="3"><table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
                          <tr> 
                            <td>&nbsp;</td>
                          </tr>
                          <tr> 
                            <td><table width="100%" border="0" cellpadding="3" cellspacing="1" bgcolor="#CCCCCC">
                                <FORM ACTION="mContentsEditOk.asp" METHOD=POST name="myForm" onSubmit="return checkValue(this);">
                                  <tr> 
                                    <td width="70" height="22" align="right" bgcolor="f7f7f7">语言:</td>
                                    <td bgcolor="#FFFFFF"><select name="sLang" class="form" id="sLang">
                                        <option value="" selected>选择</option>
                                        <option value="cn">中文</option>
                                        <option value="en">英文</option>
                                      </select></td>
                                  </tr>
                                  <tr> 
                                    <td width="70" height="22" align="right" bgcolor="f7f7f7">栏目:</td>
                                    <td bgcolor="#FFFFFF">
                                      <select name="sType" class="form" id="sType">
                                        <option value="" selected>选择</option>
                                        <option value="profile">公司介绍</option>
                                        <option value="structure">企业构架</option>
                                        <option value="honor">企业荣誉</option>
                                        <option value="culture">企业文化</option>
                                        <option value="hr">人力资源</option>
                                        <option value="contact">联系方式</option>
                                        <option value="link">友情链接</option>
                                      </select>
                                    </td>
                                  </tr>
                                  <tr> 
                                    <td height="22" align="right" bgcolor="f7f7f7">内容:</td>
                                    <td bgcolor="#FFFFFF">
                                    <script type="text/javascript">
                                    <!--
                                    // Automatically calculates the editor base path based on the _samples directory.
                                    // This is usefull only for these samples. A real application should use something like this:
                                    // oFCKeditor.BasePath = '/fckeditor/' ;    // '/fckeditor/' is the default value.
                                    //var sBasePath = document.location.pathname.substring(0,document.location.pathname.lastIndexOf('_samples')) ;

                                    var oFCKeditor = new FCKeditor( 'sContent' ) ;
                                    oFCKeditor.BasePath    = '/manli/admin/fckeditor/' ;
                                    oFCKeditor.Height    = 400 ;
                                    oFCKeditor.Value    = '{sContent}' ;
                                    oFCKeditor.Create() ;
                                    //-->
                                    </script>
                                    </td>
                                  </tr>
                                  <tr> 
                                    <td height="22" align="right" bgcolor="f7f7f7">&nbsp;</td>
                                    <td bgcolor="#FFFFFF"><INPUT TYPE="hidden" name="sID" value="{sID}"> 
                                      <input name="btnAdd" type="submit" class="form" value="编辑"></td>
                                  </tr>
                                </FORM>
                              </table></td>
                          </tr>
                          <tr> 
                            <td>&nbsp;</td>
                          </tr>
                        </table></td>
                    </tr>
                  </table></td>
              </tr>
            </table> </TD>
        </TR>
      </TABLE></td>
    <td background="../images/boder_06.gif">&nbsp; </td>
  </tr>
  <tr> 
    <td width="29" height="32"> <img src="../images/boder_07.gif" width="29" height="32" alt=""></td>
    <td background="../images/boder_08.gif">&nbsp; </td>
    <td> <img src="../images/boder_09.gif" width="31" height="32" alt=""></td>
  </tr>
</table>
</body>
</html>
?>
2006-11-12 09:14 PM#7
查看资料  发短消息  顶部
 
lwter (lwter)
注册会员
Rank: 2
一般会员



UID 28567
精华 0
积分 92
帖子 101
金钱 92 喜悦币
威望 0
人脉 0
阅读权限 20
注册 2004-5-15
状态 离线
[推荐阅读] apache下网页无法播放.dat格式文件
你的数据存为一个class类

class selData {

     /**
      * 取得学历
      *
      * return array
      */
      function selData() {
      }

     /**
      * 取得学历
      *
      * return array
      */
      function getYourData() {
            $s = array(
                                    1 => '高中',
                                    2 => '中专',
                                    ...    // 这里你自己加上
                                    6  =>'博士'
                             );
      }
}

先设好一个模板

<select name="selYourData" id="selectYourData">
<!-- BEGIN yourdata -->
<option value="{T:YourId}"{T:YourSelected}></option>
<!-- END yourdata -->
</select>


在一个public页
$getXL = &new selData();


第一次显示:
$t->set_block('Page','yourdata','YD');
$yourdata = $getXL->getYourData();

foreach($yourdata as $key => $value) {
       $t->set_var(array(
                                      'T:YourId' => $key,
                                      'T:YourValue' => $value
                           ));
       $t->parse('YD','yourdata',true);
}

修改的显示:

$yourdata = $getXL->getYourData();
$formDatabase->getFromDatabase();

$t->set_block('Page','yourdata','YD');
foreach($yourdata as $key => $value) {
       $t->set_var(array(
                                      'T:YourId' => $key,
                                      'T:YourValue' => $value,
                                      'T:YourSelected' => ($key == $formDatabase['Id']) ? ' selected="selected"':'' //  这里就是你想要选中的结果:)
                           ));
       $t->parse('YD','yourdata',true);
}

[ 本帖最后由 lwter 于 2006-11-13 09:10 AM 编辑 ]
2006-11-13 09:02 AM#8
查看资料  Blog  发短消息  顶部
     


  可打印版本 | 推荐给朋友 | 订阅主题 | 收藏主题 | 开通个人空间  


 




Powered by Discuz! 6.1.0  © 2001-2010 Comsenz Inc.
Processed in 0.063113 second(s), 6 queries

(冀ICP备05009913号) 管理员:sadly 邮箱/MSN: sadly@phpx.com QQ:824008(长隐) 清除 Cookies - - Archiver - WAP