V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
binghe
V2EX  ›  程序员

像这种情况有没有办法对网页进行排版?

  •  
  •   binghe · 2015-08-23 16:06:29 +08:00 · 3797 次点击
    这是一个创建于 3177 天前的主题,其中的信息可能已经有所发展或是发生改变。
    事情是这样的,本机安装了一个 dedecms , php 的。后台添加了一些字段,结果发现添加的这些字段在后台信息录入界面无法排版,后台信息录入界面现在是这样的。如果我有 30 个字段,甚至 50 个字段那就一列非常长了,非常不美观。


    然后我找啊找,找到源码中只有这一句:
    <?php PrintAutoFieldsAdd ($cInfos['fieldset'],'autofield'); ?>

    然后又网上搜索,找到一个博客有提到这么一句 http://blog.xxtime.com/383 ,但是也不是我要的效果。

    我想要的效果是这样的:



    不知道有没有什么比较方便的方法可以到达我要的效果呢?
    19 条回复    2015-08-24 15:02:19 +08:00
    nevin47
        1
    nevin47  
       2015-08-23 16:20:15 +08:00
    我觉得我遇到这个问题的话可能会这么解决:
    1 、查看 PrintAutoFieldsAdd 代码,看看有没有跟格式控制相关的
    2 、直接查看你页面的跟表格相关 CSS ,然后看相关样式文件在什么地方,尝试直接修改 CSS
    3 、如果确定是 PrintAutoFieldsAdd 函数控制,然后其他地方也有调用,那么可能我会考虑直接重写一个新的函数,先完成这个功能,后面再按需求修改或者重构
    limuxy
        2
    limuxy  
       2015-08-23 16:38:51 +08:00 via Android
    政治面貌清白?!不是应该只有团员 党员 民主党派成员 群众 这 4 种吗!!!
    wd0g
        3
    wd0g  
       2015-08-23 16:44:24 +08:00
    你可以用下一步来解决这个问题:
    1:我们需要你的个人信息
    2:能否上传你的头像?
    3:xxxxxxxx

    题主,你懂我的撒!
    binghe
        4
    binghe  
    OP
       2015-08-23 17:06:45 +08:00
    @nevin47
    1 、控制格式相关的好像只有这一段:
    <table width="100%" border="0" cellspacing="0" cellpadding="0" style="margin-bottom:3px;">
    <tr>
    <td width="90" class="bline" height='24'>&nbsp;~name~:</td>
    <td class="bline">~form~</td>
    </tr>
    </table>


    2 、根页面表格相关的 css 好像也不行,我直接查看该页面源码, class 名称都是一样的。
    请忽略像“ xingbie ”这样的东西。-_-!!

    <tr>
    <td><table width="100%" border="0" cellspacing="0" cellpadding="0" style="margin-bottom:3px;">
    <tr>
    <td width="90" class="bline" height='24'>&nbsp;姓名:</td>
    <td class="bline"><input type='text' name='name' id='name' style='width:250px' class='intxt' value='' />
    </td>
    </tr>
    </table><table width="100%" border="0" cellspacing="0" cellpadding="0" style="margin-bottom:3px;">
    <tr>
    <td width="90" class="bline" height='24'>&nbsp;性别:</td>
    <td class="bline"><select name='xingbie' style='width:150px'><option value='男'>男</option>
    <option value='女'>女</option>
    </select>
    </td>
    </tr>
    </table><table width="100%" border="0" cellspacing="0" cellpadding="0" style="margin-bottom:3px;">
    <tr>
    <td width="90" class="bline" height='24'>&nbsp;出生日期:</td>
    <td class="bline"><input name="chushengriqi" value="2015-08-23 16:52:29" type="text" id="chushengriqi" style="width:250px" class="intxt" /> <script language="javascript" type="text/javascript">
    Calendar.setup ({
    inputField : "chushengriqi",
    ifFormat : "%Y-%m-%d %H:%M",
    showsTime : true,
    timeFormat : "24"
    });
    </script></td>
    </tr>
    </table><table width="100%" border="0" cellspacing="0" cellpadding="0" style="margin-bottom:3px;">
    <tr>
    <td width="90" class="bline" height='24'>&nbsp;婚姻状况:</td>
    <td class="bline"><select name='hunyinzhuangkuang' style='width:150px'><option value='已婚'>已婚</option>
    <option value='未婚'>未婚</option>
    </select>
    </td>
    </tr>



    3 、 PrintAutoFieldsAdd 函数内容是这样的:
    /**
    * 载入自定义表单(用于发布)
    *
    * @access public
    * @param string $fieldset 字段列表
    * @param string $loadtype 载入类型
    * @return string
    */
    function PrintAutoFieldsAdd (&$fieldset, $loadtype='all')
    {
    $dtp = new DedeTagParse ();
    $dtp->SetNameSpace ('field','<','>');
    $dtp->LoadSource ($fieldset );
    $dede_addonfields = '';
    if (is_array ($dtp->CTags ))
    {
    foreach ($dtp->CTags as $tid=>$ctag )
    {
    if ($loadtype!='autofield'
    || ($loadtype=='autofield' && $ctag->GetAtt ('autofield')==1 ) )
    {
    $dede_addonfields .= ( $dede_addonfields=="" ? $ctag->GetName ().",".$ctag->GetAtt ('type') : ";".$ctag->GetName ().",".$ctag->GetAtt ('type') );
    echo GetFormItemA ($ctag );
    }
    }
    }
    echo "<input type='hidden' name='dede_addonfields' value=\"".$dede_addonfields."\">\r\n";
    }

    /**
    * 载入自定义表单(用于编辑)
    *
    * @access public
    * @param string $fieldset 字段列表
    * @param string $fieldValues 字段值
    * @param string $loadtype 载入类型
    * @return string
    */
    function PrintAutoFieldsEdit (&$fieldset, &$fieldValues, $loadtype='all')
    {
    $dtp = new DedeTagParse ();
    $dtp->SetNameSpace ("field", "<", ">");
    $dtp->LoadSource ($fieldset );
    $dede_addonfields = "";
    if (is_array ($dtp->CTags ))
    {
    foreach ($dtp->CTags as $tid=>$ctag )
    {
    if ($loadtype != 'autofield'
    || ($loadtype == 'autofield' && $ctag->GetAtt ('autofield') == 1 ) )
    {
    $dede_addonfields .= ( $dede_addonfields=='' ? $ctag->GetName ().",".$ctag->GetAtt ('type') : ";".$ctag->GetName ().",".$ctag->GetAtt ('type') );
    echo GetFormItemValueA ($ctag, $fieldValues[$ctag->GetName ()]);
    }
    }
    }
    echo "<input type='hidden' name='dede_addonfields' value=\"".$dede_addonfields."\">\r\n";
    }



    按照这样的情况来看,是不是需要新写函数了?
    我是 PHP 文盲啊,怎么办
    binghe
        5
    binghe  
    OP
       2015-08-23 17:07:33 +08:00
    @limuxy 以前读书入团前,要整什么材料时,老师都让写“清白”。。。
    binghe
        6
    binghe  
    OP
       2015-08-23 17:08:08 +08:00
    @wd0g 可是这个不是让用户填写的,而且管理后台录入资料的。
    binghe
        7
    binghe  
    OP
       2015-08-23 17:12:15 +08:00
    @nevin47 PrintAutoFieldsAdd 这个函数除了添加、编辑外,其他地方应该没有调用了。
    squid157
        8
    squid157  
       2015-08-23 17:45:25 +08:00
    说个别的话题。。。政治面貌。。不是写那个内容的 貌似是有正式的内容选项和对应代码的
    squid157
        9
    squid157  
       2015-08-23 17:47:13 +08:00
    @binghe 包子党党员 /预备党员 /包子党团员 /民主党派 /群众 差不多这样,具体比这个复杂
    aprikyblue
        10
    aprikyblue  
       2015-08-23 20:10:28 +08:00
    @binghe
    清白 23333
    我很好奇其他选项是什么
    binghe
        11
    binghe  
    OP
       2015-08-23 20:15:31 +08:00   ❤️ 1
    @aprikyblue 党员、团员、清白 -_-!
    wd0g
        12
    wd0g  
       2015-08-23 23:00:08 +08:00
    分组栏,懂我的意思吧
    FrankFang128
        13
    FrankFang128  
       2015-08-24 01:41:22 +08:00
    分 Tab
    ZHenJ
        14
    ZHenJ  
       2015-08-24 09:20:06 +08:00
    @binghe 意思是党员和团员都不是清白的,高级黑啊。。。
    goodan
        15
    goodan  
       2015-08-24 09:32:33 +08:00
    清白,太强。。。
    misaka14
        16
    misaka14  
       2015-08-24 11:21:32 +08:00
    感觉 jquery easyui 能满足要求
    PHPwind
        17
    PHPwind  
       2015-08-24 13:51:37 +08:00 via iPhone
    清白......
    binghe
        18
    binghe  
    OP
       2015-08-24 15:00:04 +08:00
    @wd0g
    @FrankFang128
    @misaka14

    后台的代码只有

    <?php PrintAutoFieldsAdd ($cInfos['fieldset'],'autofield'); ?>



    <table width="100%" border="0" cellspacing="0" cellpadding="0" style="margin-bottom:3px;">
    <tr>
    <td width="90" class="bline" height='24'>&nbsp;~name~:</td>
    <td class="bline">~form~</td>
    </tr>
    </table>

    能用你们的方法实现吗?
    binghe
        19
    binghe  
    OP
       2015-08-24 15:02:19 +08:00
    @ZHenJ 叮咚……,小伙子,我是社区居委会的张大妈啊,你开门一下..
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   1161 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 25ms · UTC 17:50 · PVG 01:50 · LAX 10:50 · JFK 13:50
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.