php没有考虑到html

时间:2014-05-17 18:09:59

标签: php html css

Hullo:)

对不起,如果标题不清楚,但我不知道怎么问这个(+,我不是英国人:/)

所以!在那里,我试图建立一个带有PHP脚本的网站,该网站吐出一个成员列表。一切正常,但html / css部分没有考虑清单。

事情工作得很好(这里:http://occlumens.eu/fanlist/membership.php)但是代码很难看,所有的表都是在CSS中制作好东西的地狱。所以!我决定继续努力,尝试用div来让整体更有趣。

这里有一个直观的解释:http://occlumens.eu/fanlist/membership2.php

正如你所看到的,列表很好,但是框(html / css)没有列出。 从我所看到的情况来看,我的div课程一切顺利,但就好像它不会阅读" php。

如果我在css中创建一个min-height,它只会创建一个我想要的大盒子,但它仍然不会考虑到php。因此,如果列表更小或更大,它就不会延伸。

我该如何纠正?是因为列表是有条件的吗? (if条件)发送帮助:) 此外,我开始理解php,只开始:)因此,我没有编写脚本代码。

<div class="boxy">
    <h3>Members</h3>
    <p><a href="membership.php?sort=all">Complete list</a> - <a href="membership.php?sort=country">Sorted by country</a></p>
    <p>We have a total of <strong><?php echo PHPFANLIST_MEMBERCOUNT; ?></strong> member(s) from <strong><?php echo $country_count; ?></strong> different countries.</p>

    <?php if (($sort == 'country') && is_null($country)) { // Same sort as above! ?>
    <h2>Sorted by country</h2>
    <div class="membership">

        <div class="one_half">
            <a href="membership.php?sort=country">Country</a>
            <?php foreach ($countries as $country) { ?>
                <p><a href="membership.php?country=<?php echo htmlentities($country['name'], ENT_QUOTES, 'UTF-8'); ?>" title="<?php echo $country['name']; ?>"><?php $fake_member = new Member(); $fake_member->country = $country['name']; if (!DoPluginCalls('show_members_country', true, $fake_member)) { echo htmlentities($country['name'], ENT_QUOTES, 'UTF-8'); } ?></a></p>
            <?php } ?>
        </div>

        <div class="one_half">
            <a href="membership.php?sort=country&amp;orderby=num">Members</a>
            <?php foreach ($countries as $country) { ?>
                <p><?php echo $country['members']; ?></p>
            <?php } ?>      
        </div>
    </div>

<?php } else { 
    $querystring = '';
    $showmailcol = ShowMail(true, $fanlisting->settings['show_mail']);
?><h2><?php if (!is_null($country)) { $querystring = htmlentities('&country=' . $country, ENT_QUOTES, 'UTF-8'); ?>Sorted by country: <?php echo htmlentities($country, ENT_QUOTES, 'UTF-8'); } else {?>All members<?php } ?></h2>
    <div class="membership">

    <div class="one_fifth">
        <?php if ($fanlisting->settings['show_member_id']) { ?>
            <a href="membership.php?sort=all&amp;orderby=id<?php echo $querystring; ?>">ID</a>
        <?php } ?>
        <?php foreach ($members as $member) { ?>
            <?php if ($fanlisting->settings['show_member_id']) { ?>
                <p><?php if (!DoPluginCalls('show_members_id', true, $member)) { echo $member->id; }?></p>
            <?php } ?>
        <?php } ?>
    </div>

    <div class="one_fifth">
        <a href="membership.php?sort=all&amp;orderby=name<?php echo $querystring; ?>">Name</a>
        <?php foreach ($members as $member) { ?>
            <p><?php if (!DoPluginCalls('show_members_name', true, $member)) { echo htmlentities($member->name, ENT_QUOTES, 'UTF-8'); } ?></p>
        <?php } ?>
    </div>

    <div class="one_fifth">
        <?php if ($showmailcol) { ?>
            <a href="membership.php?sort=all&amp;orderby=mail<?php echo $querystring; ?>">E-mail</a>
        <?php } ?>
        <?php foreach ($members as $member) { ?>
            <?php if ($showmailcol) { ?>
                <p><?php if (!DoPluginCalls('show_members_mail', true, $member)) { if (ShowMail($member->showmail, $fanlisting->settings['show_mail'])) { ?><a href="mailto:<?php echo scramble_email(htmlentities($member->mail, ENT_QUOTES, 'UTF-8')); ?>">@</a><?php } else { echo '-'; } } // Plugin Call ?></p>
            <?php } ?>
        <?php } ?>
    </div>

    <div class="one_fifth">
        <?php if ($fanlisting->settings['show_url']) { ?>
            <a href="membership.php?sort=all&amp;orderby=url<?php echo $querystring; ?>">URL</a>
        <?php } ?>
        <?php foreach ($members as $member) { ?>
            <?php if ($fanlisting->settings['show_url']) { ?>
                <p><?php if (!DoPluginCalls('show_members_url', true, $member)) { if (!is_empty($member->url)) { ?><a href="<?php echo htmlentities(handle_site($member->url), ENT_QUOTES, 'UTF-8'); ?>" target="_blank"<?php if ($fanlisting->settings['url_nofollow']) { echo ' rel="nofollow"'; }?>>www</a><?php } else {echo 'www'; } } // Plugin Call ?></p>
            <?php } ?>
        <?php } ?>
    </div>

    <div class="one_fifth">
        <?php if ($fanlisting->settings['ask_country'] && is_null($country)) { ?>
            <a href="membership.php?sort=all&amp;orderby=country">Country</a>
        <?php } ?>
        <?php foreach ($members as $member) { ?>
            <?php if ($fanlisting->settings['ask_country'] && is_null($country)) { ?>
                <p><?php if (!DoPluginCalls('show_members_country', true, $member)) { if (!is_empty($member->country)) { echo htmlentities($member->country, ENT_QUOTES, 'UTF-8'); } else { echo '-'; } } // Plugin Call ?></p>
            <?php } ?>
        <?php } ?>
    </div>

    <div class="one_fifth">
        <?php if ($fanlisting->settings['show_custom'] && ($fanlisting->settings['custom_field_name'] != '')) { ?>
            <a href="membership.php?sort=all&amp;orderby=custom<?php echo $querystring; ?>"><?php echo htmlentities($fanlisting->settings['custom_field_name'], ENT_QUOTES, 'UTF-8'); ?></a>
        <?php } ?>
        <?php foreach ($members as $member) { ?>
            <?php if ($fanlisting->settings['show_custom'] && ($fanlisting->settings['custom_field_name'] != '')) { ?>
                <p><?php if (!DoPluginCalls('show_members_custom', true, $member)) { if (!is_empty($member->custom)) { echo htmlentities($member->custom, ENT_QUOTES, 'UTF-8'); } else { echo '-'; } } // Plugin Call ?></p>
            <?php } ?>
        <?php } ?>
    </div>
</div>
<?php } ?>

3 个答案:

答案 0 :(得分:1)

这看起来更好:

table {
text-align: left;
width: 100%;
}

答案 1 :(得分:1)

如果没有看到PHP代码,很难分辨。通过查看链接,您可以将表格的宽度设置为100%(或您想要的任何宽度)。如果你无法弄清楚如何在php中修改表标签,你总是可以使用父div这样用css引用它

.boxy table {
     width: 100%;
     /* any other styles here */
}

至于第二个例子,div没有包装所有内容的原因是因为它内部的div是向左浮动的。如果你把风格清楚的东西放在最后:在结束时,在结束的方框div之前,这将使它包裹所有的浮动内容。

<span style="clear: left>&nbsp;</span>

你可能会想要坚持使用表格,因为它会保留所有行。

答案 2 :(得分:0)

table{
text-align:center;
width:100%;
height:auto;
}

这绝对可以。