用html

时间:2016-02-14 19:55:29

标签: javascript php html

我正在尝试创建一个新闻网站,其中新闻应该被表示为图片和小文本,当您点击它时,将打开代表整个新闻的新页面,所以我想到了最好的方法来做到这一点,我应该做一个html表,其中有一行图像和一行文本或列表?或者它应该在一个sql表中,我用php调用它?

当我想发布一些新消息时,我想要一些容易添加的东西。我把它作为一个表,但我不确定这是正确的方法。当我想要添加新消息时,我不想删除旧消息我只想显示旧消息,就像你向下滚动页面一样,这里是表的代码,很简单。

<table id="context_table" cellspacing="5" border="2" cellpadding="0"   style="display: inline-block;">
<tr valign="top" align="right">
<td width="200" ><img src="paper.gif" alt="paper" height="115" /></td>
<td width="1" bgcolor=black><BR></td>
<td width="600" valign="top" align="left">
<p>Here is the news</p>
<p>news discription</p>
<tr valign="top" align="right">
<td width="200"><img src="1920x1920.jpg" alt="film" height="115" /></td>
<td width="1" bgcolor=black><BR></td>
<td width="600" valign="top" align="left">
<p>Here is the news</p>
<p>blah<br>blah<br>blah</p>
<tr valign="top" align="right">
<td width="200"><p>pictures</p></td>
<td width="1" bgcolor=black><BR></td>
<td width="600" valign="top" align="left">
<p>Here is the news</p>
<p>news discription</p>
<tr valign="top" align="right">
<td width="200"><p>pictures</p></td>
<td width="1" bgcolor=black><BR></td>
<td width="600" valign="top" align="left">
<p>Here is the news</p>
<p>blah<br>blah<br>blah</p>
<tr valign="top" align="right">
<td width="200"><p>pictures</p></td>
<td width="1" bgcolor=black><BR></td>
<td width="600" valign="top" align="left">
<p>Here is the news</p>
<p>blah<br>blah<br>blah</p>
<tr valign="top" align="right">
<td width="200"><p>pictures</p></td>
<td width="1" bgcolor=black><BR></td>
<td width="600" valign="top" align="left">
<p>Here is the news</p>
<p>blah<br>blah<br>blah</p>
<tr valign="top" align="right">
<td width="200"><p>pictures</p></td>
<td width="1" bgcolor=black><BR></td>
<td width="600" valign="top" align="left">
<p>Here is the news</p>
<p>blah<br>blah<br>blah</p>
<tr valign="top" align="right">
<td width="200"><p>pictures</p></td>
<td width="1" bgcolor=black><BR></td>
<td width="600" valign="top" align="left">
<p>Here is the news</p>
<p>blah<br>blah<br>blah</p>

</td>
</tr>

2 个答案:

答案 0 :(得分:1)

用桌子布置网站已经被大约10年了。对于表格,它很好,但不是布局。

我会标记一些这样的新闻文章:

<article>
    <a href="/link-to-article/" title="article title">
        <img src="link-to-image" alt="article title">
        <h2>Article title</h2>
        <p>Short description</p>
    </a>
</article>

你的问题的其余部分还不清楚所以需要一些更清楚的细节解释,以便能够帮助你想要的其余部分。

答案 1 :(得分:1)

为了向您的网站发布新闻,您需要一个管理界面,只有您作为管理员才能访问该界面。在那里,您可以发布,编辑或删除新闻。另一个是用户界面,读取新闻的读者别名。首先,您需要考虑将用于此的架构。 MVC(模型 - 视图 - 控制器)是用于Web应用程序的最广泛使用的体系结构。它将视图,控制器和模型彼此分开,这意味着设计和业务逻辑彼此独立。这里是深入理解MVC概念的链接: https://heim.ifi.uio.no/~trygver/themes/mvc/mvc-index.html http://c2.com/cgi/wiki?ModelViewController

有不同的js框架使用MVC概念,Ember,Angular,Backbone等。

所以,你可以在后端使用php,在前端使用js。

至于布局,表格已经过时,有一些例子,比如电子邮件。你需要使用div。

在您阅读并理解mvc的概念之后,您将更好地了解您将要做的事情。 :)