41 lines
1.8 KiB
Java
41 lines
1.8 KiB
Java
import java.sql.Connection;
|
|
import java.sql.DriverManager;
|
|
import java.sql.PreparedStatement;
|
|
|
|
public class FixNewsGrid {
|
|
public static void main(String[] args) {
|
|
try {
|
|
Connection conn = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521/sisvietnam", "sisvietnam", "sisvietnam");
|
|
String correctHtml = "{{#each news_posts}}\n" +
|
|
"<div class=\"featured-grid__item\">\n" +
|
|
" <article class=\"news-card news-card--featured\">\n" +
|
|
" <div class=\"news-card__image\">\n" +
|
|
" <div>\n" +
|
|
" <img loading=\"lazy\" src=\"{{featuredImageUrl}}\" alt=\"{{title}}\">\n" +
|
|
" </div>\n" +
|
|
" </div>\n" +
|
|
" <div class=\"news-card__content\">\n" +
|
|
" <div class=\"featured-grid__category\">\n" +
|
|
" <a href=\"#\">TIN TỨC</a>\n" +
|
|
" </div>\n" +
|
|
" <h3 class=\"news-card__title\">\n" +
|
|
" <a href=\"/post/{{slug}}\" rel=\"bookmark\">\n" +
|
|
" <span>{{title}}</span>\n" +
|
|
" </a>\n" +
|
|
" </h3>\n" +
|
|
" <div class=\"news-card__date\">{{date}}</div>\n" +
|
|
" </div>\n" +
|
|
" </article>\n" +
|
|
"</div>\n" +
|
|
"{{/each}}";
|
|
|
|
PreparedStatement pstmt = conn.prepareStatement("UPDATE sis_component_template SET html_template = ? WHERE slug = 'news-grid'");
|
|
pstmt.setString(1, correctHtml);
|
|
int updated = pstmt.executeUpdate();
|
|
System.out.println("Updated rows: " + updated);
|
|
} catch (Exception e) {
|
|
e.printStackTrace();
|
|
}
|
|
}
|
|
}
|