• 请不要在回答技术问题时复制粘贴 AI 生成的内容
binghe
V2EX  ›  程序员

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

  •  
  •   binghe · Aug 23, 2015 · 4336 views
    This topic created in 3941 days ago, the information mentioned may be changed or developed.
    事情是这样的,本机安装了一个 dedecms , php 的。后台添加了一些字段,结果发现添加的这些字段在后台信息录入界面无法排版,后台信息录入界面现在是这样的。如果我有 30 个字段,甚至 50 个字段那就一列非常长了,非常不美观。


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

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

    我想要的效果是这样的:



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

    题主,你懂我的撒!
    binghe
        4
    binghe  
    OP
       Aug 23, 2015
    @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
       Aug 23, 2015
    @limuxy 以前读书入团前,要整什么材料时,老师都让写“清白”。。。
    binghe
        6
    binghe  
    OP
       Aug 23, 2015
    @wd0g 可是这个不是让用户填写的,而且管理后台录入资料的。
    binghe
        7
    binghe  
    OP
       Aug 23, 2015
    @nevin47 PrintAutoFieldsAdd 这个函数除了添加、编辑外,其他地方应该没有调用了。
    squid157
        8
    squid157  
       Aug 23, 2015
    说个别的话题。。。政治面貌。。不是写那个内容的 貌似是有正式的内容选项和对应代码的
    squid157
        9
    squid157  
       Aug 23, 2015
    @binghe 包子党党员 /预备党员 /包子党团员 /民主党派 /群众 差不多这样,具体比这个复杂
    aprikyblue
        10
    aprikyblue  
       Aug 23, 2015
    @binghe
    清白 23333
    我很好奇其他选项是什么
    binghe
        11
    binghe  
    OP
       Aug 23, 2015   ❤️ 1
    @aprikyblue 党员、团员、清白 -_-!
    wd0g
        12
    wd0g  
       Aug 23, 2015
    分组栏,懂我的意思吧
    FrankFang128
        13
    FrankFang128  
       Aug 24, 2015
    分 Tab
    ZHenJ
        14
    ZHenJ  
       Aug 24, 2015
    @binghe 意思是党员和团员都不是清白的,高级黑啊。。。
    goodan
        15
    goodan  
       Aug 24, 2015
    清白,太强。。。
    misaka14
        16
    misaka14  
       Aug 24, 2015
    感觉 jquery easyui 能满足要求
    PHPwind
        17
    PHPwind  
       Aug 24, 2015 via iPhone
    清白......
    binghe
        18
    binghe  
    OP
       Aug 24, 2015
    @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
       Aug 24, 2015
    @ZHenJ 叮咚……,小伙子,我是社区居委会的张大妈啊,你开门一下..
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   2903 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 47ms · UTC 09:12 · PVG 17:12 · LAX 02:12 · JFK 05:12
    ♥ Do have faith in what you're doing.