用HTML表示新闻更好


what is better to represent news in 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>

用表格布置网站已经皱眉了大约 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>

您问题的其余部分非常不清楚,因此需要更清楚地解释更多详细信息,以便能够帮助解决您想要的其余内容。

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

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

因此,您可以在后端使用 php,在前端使用 js。

至于布局,表格已经过时,有一些期望,比如电子邮件。为此,您需要使用div。

在你阅读并理解了 mvc 的概念之后,你会对你将要做的事情有一个更好的理解:)。