Powerful and easy to use cms to build websites, blogs or ecommerce stores.
HTML backendblogblog-engineblog-platformbloggingcmscontent-managementcontent-management-systemecommerceecommerce-platformno-codepage-builderphpphp-cmsphp7php8self-hostedshopping-cartweb-applicationwebsite-builder
Fixed component page builder loading detection to add empty content to avoid losing template code due to no content
givanze0048e6fe547
diff --git a/app/template/components/breadcrumb.tpl b/app/template/components/breadcrumb.tplindex 5333099..9c54bd6 100755--- a/app/template/components/breadcrumb.tpl+++ b/app/template/components/breadcrumb.tpl@@ -5,6 +5,7 @@@item|deleteAllButFirstChild@breadcrumb|prepend = <?php+$vvveb_is_page_edit = Vvveb\isEditor();if (isset($_breadcrumb_idx)) $_breadcrumb_idx++; else $_breadcrumb_idx = 0;$previous_component = isset($current_component)?$current_component:null;$breadcrumb = $current_component = $this->_component['breadcrumb'][$_breadcrumb_idx] ?? [];diff --git a/app/template/components/cart.tpl b/app/template/components/cart.tplindex e07953e..9a38154 100755--- a/app/template/components/cart.tpl+++ b/app/template/components/cart.tpl@@ -2,6 +2,7 @@@cart-product|deleteAllButFirstChild[data-v-component-cart]|prepend = <?php+$vvveb_is_page_edit = Vvveb\isEditor();if (isset($_cart_idx)) $_cart_idx++; else $_cart_idx = 0;$previous_component = isset($current_component)?$current_component:null;diff --git a/app/template/components/checkout/payment.tpl b/app/template/components/checkout/payment.tplindex 9a0433c..46a34c3 100755--- a/app/template/components/checkout/payment.tpl+++ b/app/template/components/checkout/payment.tpl@@ -4,6 +4,7 @@@payment|deleteAllButFirstChild@payments|prepend = <?php+$vvveb_is_page_edit = Vvveb\isEditor();if (isset($_payments_idx)) $_payments_idx++; else $_payments_idx = 0;$previous_component = isset($current_component)?$current_component:null;$payments = $current_component = $this->_component['checkout_payment'][$_payments_idx] ?? [];diff --git a/app/template/components/checkout/shipping.tpl b/app/template/components/checkout/shipping.tplindex 78f0d68..de03ec8 100755--- a/app/template/components/checkout/shipping.tpl+++ b/app/template/components/checkout/shipping.tpl@@ -4,6 +4,7 @@@shipping|deleteAllButFirstChild@shippings|prepend = <?php+$vvveb_is_page_edit = Vvveb\isEditor();if (isset($_shippings_idx)) $_shippings_idx++; else $_shippings_idx = 0;$previous_component = isset($current_component)?$current_component:null;$shippings = $current_component = $this->_component['checkout_shipping'][$_shippings_idx] ?? [];diff --git a/app/template/components/comments.tpl b/app/template/components/comments.tplindex f58a70a..46b4b56 100755--- a/app/template/components/comments.tpl+++ b/app/template/components/comments.tpl@@ -14,6 +14,7 @@ $limit = isset($comments['limit']) ? $comments['limit'] : 5;@comment|before = <?php+$vvveb_is_page_edit = Vvveb\isEditor();$_comments = $comments['comment'] ?? [];$_default = (isset($vvveb_is_page_edit) && $vvveb_is_page_edit ) ? [0 => ['comment_id' => 1, 'content' => '']] : false;$_comments = empty($_comments) ? $_default : $_comments;diff --git a/app/template/components/currency.tpl b/app/template/components/currency.tplindex f67cbdf..586881b 100755--- a/app/template/components/currency.tpl+++ b/app/template/components/currency.tpl@@ -4,6 +4,7 @@@currency|deleteAllButFirstChild@currencies|prepend = <?php+$vvveb_is_page_edit = Vvveb\isEditor();if (isset($_currency_idx)) $_currency_idx++; else $_currency_idx = 0;$previous_component = isset($current_component)?$current_component:null;$current_component = $this->_component['currency'][$_currency_idx] ?? [];diff --git a/app/template/components/language.tpl b/app/template/components/language.tplindex e08ea40..f21f522 100755--- a/app/template/components/language.tpl+++ b/app/template/components/language.tpl@@ -2,6 +2,7 @@@language|deleteAllButFirstChild[data-v-component-language]|prepend = <?php+$vvveb_is_page_edit = Vvveb\isEditor();if (isset($_language_idx)) $_language_idx++; else $_language_idx = 0;if(isset($this->_component['language']) && $this->_component['language'][$_language_idx]) {$language = $this->_component['language'][$_language_idx];diff --git a/app/template/components/menu.tpl b/app/template/components/menu.tplindex 5ffa6ff..7c30c7c 100755--- a/app/template/components/menu.tpl+++ b/app/template/components/menu.tpl@@ -8,6 +8,8 @@@category|deleteAllButFirstChild@categories|before = <?php+$vvveb_is_page_edit = Vvveb\isEditor();+if (isset($_menu_idx)) $_menu_idx++; else $_menu_idx = 0;$_categories = [];@@ -40,6 +42,7 @@ if (isset($this->_component['menu']) && isset($this->_component['menu'][$_menu_i//catch all data attributes@category [data-v-menu-item-*]|innerText = $category['@@__data-v-menu-item-(*)__@@']+ @category [data-v-menu-item-content] = <?php echo $category['content'] ?? '';?>@category [data-v-menu-item-url]|href = <?php if (isset($category['url'])) echo Vvveb\System\Sites::url($category['url']);?>@category [data-v-menu-item-img]|src = $category['images'][0]diff --git a/app/template/components/orders.tpl b/app/template/components/orders.tplindex 58f7627..e54757c 100755--- a/app/template/components/orders.tpl+++ b/app/template/components/orders.tpl@@ -4,6 +4,8 @@@order|deleteAllButFirstChild@ordercomp|prepend = <?php+$vvveb_is_page_edit = Vvveb\isEditor();+if (isset($_ordercomp_idx)) $_ordercomp_idx++; else $_ordercomp_idx = 0;$previous_component = isset($current_component)?$current_component:null;$ordercomp = $current_component = $this->_component['orders'][$_ordercomp_idx] ?? [];diff --git a/app/template/components/posts.tpl b/app/template/components/posts.tplindex ce9fb11..a21ef6d 100755--- a/app/template/components/posts.tpl+++ b/app/template/components/posts.tpl@@ -10,6 +10,8 @@@posts [data-v-search] = $posts['search']@posts|prepend = <?php+ $vvveb_is_page_edit = Vvveb\isEditor();+if (isset($_posts_idx)) $_posts_idx++; else $_posts_idx = 0;$previous_component = isset($current_component)?$current_component:null;$posts = $current_component = $this->_component['posts'][$_posts_idx] ?? [];diff --git a/app/template/components/posts_taxonomy.tpl b/app/template/components/posts_taxonomy.tplindex d7e171d..51fccb6 100644--- a/app/template/components/posts_taxonomy.tpl+++ b/app/template/components/posts_taxonomy.tpl@@ -1,6 +1,7 @@@post = [data-v-component-posts] [data-v-post]@post [data-v-post-categories]|before = <?php+$vvveb_is_page_edit = Vvveb\isEditor();$categories_count = 0;$_default = (isset($vvveb_is_page_edit) && $vvveb_is_page_edit ) ? [0 => []] : [];diff --git a/app/template/components/product.tpl b/app/template/components/product.tplindex 1fa2db4..2413d30 100755--- a/app/template/components/product.tpl+++ b/app/template/components/product.tpl@@ -6,6 +6,8 @@@product|data-v-type = 'product'@product|before = <?php+$vvveb_is_page_edit = Vvveb\isEditor();+if (isset($_product_idx)) $_product_idx++; else $_product_idx = 0;$previous_component = isset($component)?$component:null;@@ -33,6 +35,7 @@ $_pagination_limit = isset($product['limit']) ? $product['limit'] : 5;@product img[data-v-product-main-image]|src = <?php echo $product['image'];?>+@product [data-v-product-main-image-background-image]|style = <?php echo 'background-image: url(\'' . $product['image'] . '\');';?>@product a[data-v-product-main-image]|href = <?php echo reset($product['images'])['image'];?>@images [data-v-product-image]|deleteAllButFirstChild@@ -43,7 +46,7 @@ $_default = (isset($vvveb_is_page_edit) && $vvveb_is_page_edit ) ? [0 => ['produ$_images = empty($_images) ? $_default : $_images;if($_images) {- $i = 0;+ $i = 1;foreach ($_images as $index => $_image) { ?>@images [data-bs-slide-to]|data-bs-slide-to = <?php echo $i;?>diff --git a/app/template/components/product/attributes.tpl b/app/template/components/product/attributes.tplindex 2cbb30b..e6d8f85 100755--- a/app/template/components/product/attributes.tpl+++ b/app/template/components/product/attributes.tpl@@ -2,6 +2,7 @@@attribute = [data-v-component-product-attributes] [data-v-attributes]@attributes|prepend = <?php+$vvveb_is_page_edit = Vvveb\isEditor();if (isset($_attributes_idx)) $_attributes_idx++; else $_attributes_idx = 0;$previous_component = isset($current_component)?$current_component:null;$attributes = $current_component = $this->_component['product_attributes'][$_attributes_idx] ?? [];@@ -22,7 +23,7 @@ if($attributes && is_array($attributes['attribute'])) {foreach ($attributes['attribute'] as $index => $attribute) {?>@attribute [data-v-group]|before = <?php- if ($group != $attribute['group']) {+ if (isset($attribute['group']) && $group != $attribute['group']) {$group = $attribute['group'];?>diff --git a/app/template/components/product/manufacturers.tpl b/app/template/components/product/manufacturers.tplindex 5f6b26b..cecb130 100755--- a/app/template/components/product/manufacturers.tpl+++ b/app/template/components/product/manufacturers.tpl@@ -4,6 +4,7 @@@manufacturer|deleteAllButFirstChild@manufacturers|prepend = <?php+$vvveb_is_page_edit = Vvveb\isEditor();if (isset($_manufacturers_idx)) $_manufacturers_idx++; else $_manufacturers_idx = 0;$previous_component = isset($current_component)?$current_component:null;$manufacturers = $current_component = $this->_component['product_manufacturers'][$_manufacturers_idx] ?? [];diff --git a/app/template/components/product/options.tpl b/app/template/components/product/options.tplindex 0177307..cd425a7 100755--- a/app/template/components/product/options.tpl+++ b/app/template/components/product/options.tpl@@ -6,6 +6,7 @@@value|deleteAllButFirstChild@options|prepend = <?php+$vvveb_is_page_edit = Vvveb\isEditor();if (isset($_options_idx)) $_options_idx++; else $_options_idx = 0;$previous_component = isset($current_component)?$current_component:null;$product_options = $current_component = $this->_component['product_options'][$_options_idx] ?? [];diff --git a/app/template/components/product/subscriptions.tpl b/app/template/components/product/subscriptions.tplindex 046e615..ccef2b0 100755--- a/app/template/components/product/subscriptions.tpl+++ b/app/template/components/product/subscriptions.tpl@@ -4,6 +4,7 @@@subscription|deleteAllButFirstChild@subscriptions|prepend = <?php+$vvveb_is_page_edit = Vvveb\isEditor();if (isset($_subscriptions_idx)) $_subscriptions_idx++; else $_subscriptions_idx = 0;$previous_component = isset($current_component)?$current_component:null;$subscriptions = $current_component = $this->_component['product_subscriptions'][$_subscriptions_idx] ?? [];diff --git a/app/template/components/product/vendors.tpl b/app/template/components/product/vendors.tplindex c0a96ef..2280de7 100644--- a/app/template/components/product/vendors.tpl+++ b/app/template/components/product/vendors.tpl@@ -4,6 +4,7 @@@vendor|deleteAllButFirstChild@vendors|prepend = <?php+$vvveb_is_page_edit = Vvveb\isEditor();if (isset($_vendors_idx)) $_vendors_idx++; else $_vendors_idx = 0;$previous_component = isset($current_component)?$current_component:null;$vendors = $current_component = $this->_component['product_vendors'][$_vendors_idx] ?? [];diff --git a/app/template/components/products.tpl b/app/template/components/products.tplindex 926911e..ba28b6e 100755--- a/app/template/components/products.tpl+++ b/app/template/components/products.tpl@@ -8,26 +8,29 @@//set component variables@products|prepend = <?php+ $vvveb_is_page_edit = Vvveb\isEditor();+//use a counter to know which component instance we need to use if there are more than one component on page- if (isset($_products_idx)) $_products_idx++; else $_products_idx = 0;+ if (isset($products_idx)) $products_idx++; else $products_idx = 0;$previous_component = isset($current_component)?$current_component:null;- $_products = $current_component = $this->_component['products'][$_products_idx] ?? [];+ $products = $current_component = $this->_component['products'][$products_idx] ?? [];++ $count = $products['count'] ?? 0;+ $limit = isset($products['limit'])? $products['limit'] : 5;- $count = $_products['count'] ?? 0;- $limit = isset($_products['limit'])? $_products['limit'] : 5;+ //if page loaded in editor then set a fist empty product if there are no products+ //to render an empty product to avoid losing the html on edit+ $_default = (isset($vvveb_is_page_edit) && $vvveb_is_page_edit ) ? [0 => []] : false;+ //$_default = [0 => []];+ $_products = empty($products['products']) ? $_default : $products['products'];?>-@products [data-v-products-category] = <?php $_category = current($_products['products']);echo $_category['category'];?>-@products [data-v-products-count] = <?php echo $_products['count'] ?? ''?>-@products [data-v-products-manufacturer] = <?php $_manufacturer = current($_products['products']);echo $_manufacturer['manufacturer'];?>+@products [data-v-products-category] = <?php $_category = current($products);echo $_category['category'];?>+@products [data-v-products-count] = <?php echo $products['count'] ?? ''?>+@products [data-v-products-manufacturer] = <?php $_manufacturer = current($products);echo $_manufacturer['manufacturer'];?>@product|before = <?php-//if page loaded in editor then set a fist empty product if there are no products-//to render an empty product to avoid losing the html on edit-$_default = (isset($vvveb_is_page_edit) && $vvveb_is_page_edit ) ? [0 => []] : false;-//$_default = [0 => []];-$_products = empty($_products['products']) ? $_default : $_products['products'];if ($_products) {foreach ($_products as $index => $_product) { ?>diff --git a/app/template/components/questions.tpl b/app/template/components/questions.tplindex 9f50da5..b0587dd 100644--- a/app/template/components/questions.tpl+++ b/app/template/components/questions.tpl@@ -4,6 +4,8 @@@question|deleteAllButFirstChild@questions|prepend = <?php+$vvveb_is_page_edit = Vvveb\isEditor();+if (isset($_questions_idx)) $_questions_idx++; else $_questions_idx = 0;$previous_component = isset($current_component)?$current_component:null;$component_questions = $current_component = $this->_component['questions'][$_questions_idx] ?? [];diff --git a/app/template/components/reviews.tpl b/app/template/components/reviews.tplindex 4667188..5c44e3f 100755--- a/app/template/components/reviews.tpl+++ b/app/template/components/reviews.tpl@@ -6,6 +6,8 @@@review|deleteAllButFirstChild@reviews|prepend = <?php+$vvveb_is_page_edit = Vvveb\isEditor();+if (isset($_reviews_idx)) $_reviews_idx++; else $_reviews_idx = 0;$previous_component = isset($current_component)?$current_component:null;$product_review = $current_component = $this->_component['reviews'][$_reviews_idx] ?? [];diff --git a/app/template/components/user/address.tpl b/app/template/components/user/address.tplindex 99bdbc8..8485e70 100755--- a/app/template/components/user/address.tpl+++ b/app/template/components/user/address.tpl@@ -4,6 +4,7 @@@address|deleteAllButFirstChild@addresscomp|prepend = <?php+$vvveb_is_page_edit = Vvveb\isEditor();if (isset($_addresscomp_idx)) $_addresscomp_idx++; else $_addresscomp_idx = 0;$previous_component = isset($current_component)?$current_component:null;$addresscomp = $current_component = $this->_component['user_address'][$_addresscomp_idx] ?? [];