[web-php] master: Sync news item layout and style (#1451)
| From: | Luffy via GitHub | Date: | Wed, 01 Oct 2025 05:52:33 +0000 |
| Subject: | [web-php] master: Sync news item layout and style (#1451) | ||
| Groups: | php.webmaster | ||
| Request: | Send a blank email to php-webmaster+get-33241@lists.php.net to get a copy of this message | ||
Author: Luffy (sy-records)
Committer: GitHub (web-flow)
Pusher: sy-records
Date: 2025-10-01T13:52:31+08:00
Commit: https://github.com/php/web-php/commit/5cd5778ab73d173c3c5d8581aaea98e8465eb519
Raw diff: https://github.com/php/web-php/commit/5cd5778ab73d173c3c5d8581aaea98e8465eb519.diff
Sync news item layout and style (#1451)
Changed paths:
M include/layout.inc
M styles/theme-base.css
Diff:
diff --git a/include/layout.inc b/include/layout.inc
index 83efa1c6bb..17f76b8fd4 100644
--- a/include/layout.inc
+++ b/include/layout.inc
@@ -111,9 +111,9 @@ function print_image($file, $alt = false, $align = false, $extras = false,
// Shortcut to usual news image printing (right floating
// image from the news dir with an alt and an URL)
-function news_image($URL, $image, $alt, $print = true)
+function news_image($URL, $image, $alt, $print = true, $align = 'right')
{
- $str = "<a href=\"$URL\">" . make_image("news/$image",
$alt, "right") . "</a>";
+ $str = "<a href=\"$URL\">" . make_image("news/$image",
$alt, $align) . "</a>";
if ($print) {
echo $str;
}
@@ -372,7 +372,7 @@ function print_news($news, $dog, $max = 5, $return = false) {
$image = "";
if (isset($item["newsImage"])) {
- $image = news_image($item["newsImage"]["link"],
$item["newsImage"]["content"], $item["newsImage"]["title"],
false);
+ $image = news_image($item["newsImage"]["link"],
$item["newsImage"]["content"], $item["newsImage"]["title"],
false, '');
}
$id = parse_url($item["id"]);
@@ -405,12 +405,12 @@ function print_news($news, $dog, $max = 5, $return = false) {
echo <<<EOT
<article class="newsItem">
- <header>
- <div class="newsImage">{$image}</div>
+ <header class="title">
+ <time class="newsdate"
datetime="{$item["published"]}">{$newsdate}</time>
<h2 class="newstitle"><a id="{$id}" href="{$permlink}"
rel="bookmark"
class="bookmark">{$item["title"]}</a></h2>
</header>
- <time class="newsdate"
datetime="{$item["published"]}">{$newsdate}</time>
<div class="newscontent">
+ <div class="newsImage">{$image}</div>
{$item["content"]}
</div>
</article>
diff --git a/styles/theme-base.css b/styles/theme-base.css
index 59b4ad6329..d6f7263cdf 100644
--- a/styles/theme-base.css
+++ b/styles/theme-base.css
@@ -1413,7 +1413,8 @@ aside.tips div.inner {
/* }}} */
/* {{{ News */
-.newsentry header h2 {
+.newsentry header h2,
+.newsItem header h2 {
margin:0;
}
.newsentry {
@@ -1427,7 +1428,8 @@ aside.tips div.inner {
float: right;
opacity: 0.8;
}
-.newsentry header time {
+.newsentry header time,
+.newsItem header time {
float:right;
line-height:3rem;
}
@@ -1436,7 +1438,8 @@ aside.tips div.inner {
line-height: 1.7rem;
}
-.newsentry .newsimage a {
+.newsentry .newsimage a,
+.newsItem .newsImage a {
float: right;
border: 0;
padding: 10px;