From d2350aa8eea141dc9b49438386e19393cba1c5d7 Mon Sep 17 00:00:00 2001 From: Patrick Date: Thu, 4 Feb 2021 20:02:16 +0100 Subject: [PATCH] improved blog templates - Different buttons depending on post type - Count Images in Galleries - Fix missing Teaser in Messages without images --- core/posts-list.php | 55 +++++++++++-------- lib/lang/de/dict-frontend.php | 2 + lib/lang/en/dict-frontend.php | 5 +- .../default/templates/posts/post-list-l.tpl | 5 +- .../templates/posts/post-list-m-wo.tpl | 2 +- 5 files changed, 41 insertions(+), 28 deletions(-) diff --git a/core/posts-list.php b/core/posts-list.php index e52eea90..cac3bf91 100644 --- a/core/posts-list.php +++ b/core/posts-list.php @@ -242,9 +242,6 @@ } - $this_entry = str_replace("{read_more_text}", $lang['btn_read_more'], $this_entry); - $this_entry = str_replace('{post_href}', $post_href, $this_entry); - $this_entry = str_replace('{post_author}', $get_posts[$k]['post_autor'], $this_entry); $this_entry = str_replace('{post_title}', $get_posts[$k]['post_title'], $this_entry); $this_entry = str_replace('{post_teaser}', $post_teaser, $this_entry); @@ -275,33 +272,47 @@ $this_entry = str_replace("{post_tpl_event_prices}", $price_list, $this_entry); /* products */ - if($get_posts[$k]['post_product_tax'] == '1') { - $tax = $fc_prefs['prefs_posts_products_default_tax']; - } else if($get_posts[$k]['post_product_tax'] == '2') { - $tax = $fc_prefs['prefs_posts_products_tax_alt1']; - } else { - $tax = $fc_prefs['prefs_posts_products_tax_alt2']; + if($get_posts[$k]['post_type'] == 'p') { + + if($get_posts[$k]['post_product_tax'] == '1') { + $tax = $fc_prefs['prefs_posts_products_default_tax']; + } else if($get_posts[$k]['post_product_tax'] == '2') { + $tax = $fc_prefs['prefs_posts_products_tax_alt1']; + } else { + $tax = $fc_prefs['prefs_posts_products_tax_alt2']; + } + + $post_price_net = str_replace('.', '', $get_posts[$k]['post_product_price_net']); + $post_price_net = str_replace(',', '.', $post_price_net); + + $post_price_gross = $post_price_net*($tax+100)/100;; + $post_price_gross = fc_post_print_currency($post_price_gross); + $post_price_net = fc_post_print_currency($post_price_net); + + $this_entry = str_replace("{post_price_gross}", $post_price_gross, $this_entry); + $this_entry = str_replace("{post_price_net}", $post_price_net, $this_entry); + $this_entry = str_replace("{post_price_tax}", $tax, $this_entry); + $this_entry = str_replace("{post_currency}", $get_posts[$k]['post_product_currency'], $this_entry); + $this_entry = str_replace("{post_product_unit}", $get_posts[$k]['post_product_unit'], $this_entry); + $this_entry = str_replace("{post_product_price_label}", $get_posts[$k]['post_product_price_label'], $this_entry); + + $this_entry = str_replace("{read_more_text}", $lang['btn_open_product'], $this_entry); } - $post_price_net = str_replace('.', '', $get_posts[$k]['post_product_price_net']); - $post_price_net = str_replace(',', '.', $post_price_net); - - $post_price_gross = $post_price_net*($tax+100)/100;; - $post_price_gross = fc_post_print_currency($post_price_gross); - $post_price_net = fc_post_print_currency($post_price_net); - $this_entry = str_replace("{post_price_gross}", $post_price_gross, $this_entry); - $this_entry = str_replace("{post_price_net}", $post_price_net, $this_entry); - $this_entry = str_replace("{post_price_tax}", $tax, $this_entry); - $this_entry = str_replace("{post_currency}", $get_posts[$k]['post_product_currency'], $this_entry); - $this_entry = str_replace("{post_product_unit}", $get_posts[$k]['post_product_unit'], $this_entry); - $this_entry = str_replace("{post_product_price_label}", $get_posts[$k]['post_product_price_label'], $this_entry); /* links */ $this_entry = str_replace("{post_external_link}", $get_posts[$k]['post_link'], $this_entry); - $this_entry = str_replace("{post_thumbnails}", $thumbnails_str, $this_entry); + /* gallery */ + if($get_posts[$k]['post_type'] == 'g') { + $this_entry = str_replace("{post_thumbnails}", $thumbnails_str, $this_entry); + $this_entry = str_replace("{read_more_text}", $lang['btn_show_gallery'], $this_entry); + $this_entry = str_replace("{cnt_images}", $cnt_thumbs_array, $this_entry); + } + $this_entry = str_replace("{read_more_text}", $lang['btn_read_more'], $this_entry); + $this_entry = str_replace('{post_href}', $post_href, $this_entry); $posts_list .= $this_entry; diff --git a/lib/lang/de/dict-frontend.php b/lib/lang/de/dict-frontend.php index ead5f9e9..766f350d 100644 --- a/lib/lang/de/dict-frontend.php +++ b/lib/lang/de/dict-frontend.php @@ -72,6 +72,8 @@ $lang['link_register'] = "Jetzt registrieren ..."; $lang['btn_read_more'] = "weiter lesen"; $lang['btn_download'] = "Download"; +$lang['btn_show_gallery'] = "Alle {cnt_images} Bilder anzeigen"; +$lang['btn_open_product'] = "Weitere Informationen"; /* Messages */ $lang['msg_missingfield'] = "Alle Felder müssen ausgefüllt werden"; diff --git a/lib/lang/en/dict-frontend.php b/lib/lang/en/dict-frontend.php index 8d92feed..10c9b7de 100644 --- a/lib/lang/en/dict-frontend.php +++ b/lib/lang/en/dict-frontend.php @@ -69,9 +69,10 @@ $lang['button_acp_edit_page'] = "Edit Page"; $lang['link_delete_avatar'] = "Delete Avatar"; $lang['link_register'] = "Register now ..."; -$lang['btn_read_more'] = "read more"; +$lang['btn_read_more'] = "Read more"; $lang['btn_download'] = "Download"; - +$lang['btn_show_gallery'] = "Show {cnt_images} Images"; +$lang['btn_open_product'] = "More Informations"; /* Messages */ $lang['msg_missingfield'] = "All fields are required"; diff --git a/styles/default/templates/posts/post-list-l.tpl b/styles/default/templates/posts/post-list-l.tpl index 53ceb5c3..51bc0d95 100644 --- a/styles/default/templates/posts/post-list-l.tpl +++ b/styles/default/templates/posts/post-list-l.tpl @@ -7,15 +7,14 @@
{post_releasedate} -

{post_title}

+

{post_title}

{post_teaser} -

{post_external_link}

+

{post_external_link}

{post_cats}

-

{read_more_text}

\ No newline at end of file diff --git a/styles/default/templates/posts/post-list-m-wo.tpl b/styles/default/templates/posts/post-list-m-wo.tpl index e9091cc1..6593b9e0 100644 --- a/styles/default/templates/posts/post-list-m-wo.tpl +++ b/styles/default/templates/posts/post-list-m-wo.tpl @@ -2,7 +2,7 @@ {post_author} {post_releasedate}

{post_title}

- + {post_teaser}

{post_cats}