givanz / Vvveb

Powerful and easy to use cms to build websites, blogs or ecommerce stores.
https://www.vvveb.com
GNU Affero General Public License v3.0
239 stars 49 forks source link

Two Homepages in editor ? #98

Open Twilight-Computer opened 3 months ago

Twilight-Computer commented 3 months ago

In the "edit Website" 2 Homepages are displayed. Deleting 1 deletes both and you need to restore. However changes made to the "homepage" (which reflect in the index.html in the templates folder) do not render in the browser ?

eg. Make a change like remove a button / save / view webpage and button is still there ?

What is the "real" home page and why does this duplicate keep re-appearing ?

givanz commented 3 months ago

Sorry for the confusion, I need to make some changes to make it more obvious what is the difference between them.

The first one is the live homepage loaded with posts menus etc and the other is the theme's static template used to render the home page.

In Vvveb themes are fully working static html sites, when a page is rendered it just fills the template with dynamic data from the database.

The list includes all theme templates, when using Edit site or Design page the live page will be loaded first above theme templates with a different icon.

admin-bar

The difference between live homepage and template homepage is that on the live page you can edit both the content like posts name/image etc and the template.

Twilight-Computer commented 3 months ago

So after making and loosing many changes today - please confirm that I should be editing the first instance ? And should I be using the "design Page" from the live page view, as "edit website" seems to loose the changes made (and saved and backed up).

givanz commented 3 months ago

Design page and Edit website point to the same page for homepage, the first one is a shortcut that can be used to quickly edit the viewed page from frontend.

Can you please provide more details about the lost changes? maybe this is caused by a bug.

You can use revisions to restore previous versions of the page.

Editing the template will only save layout changes, editing the live homepage allows to change content also, you can edit product and post names or change their images.

I think the live version is best because it edits the home page as it is and avoids confusion.

Twilight-Computer commented 3 months ago

Here is an example of what I am seeing.

In the Testimonials section, I use the "Edit Home page" to remove the line "Some of our users" and change the format of the line "Hear what our user have to say" to be

and class mb-1 and save the changes. Screen shot below:

I can see these changes in the saved template (which is a copy of the landing template) in public/twilight-theme) - time stamp of change is correct and backup folder has a new backup file with similar time stamp).

"Preview Page" shows the correct content.

"View Page" shows incorrect content. (screen shot below):

Clear all cache and refresh browser page does not render any differences.

Contents of newly saved index.html in twilight-theme page shows correct code:

What am I missing here ?

Regards,

Gary Young

From: "Givan" @.> To: "givanz/Vvveb" @.> Cc: "Twilight Computer Services" @.>, "Author" @.> Date: 21/03/2024 06:44 AM Subject: Re: [givanz/Vvveb] Two Homepages in editor ? (Issue #98)

Design page and Edit website point to the same page for homepage, the first one is a shortcut that can be used to quickly edit the viewed page from frontend. Can you please provide more details about the lost changes? maybe this is caused by a bug. You can use revisions to restore previous versions of the page. Editing the template will only save layout changes, editing the live homepage allows to change content also, you can edit product and post names or change their images. I think the live version is best because it edits the home page as it is and avoids confusion. — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>

givanz commented 3 months ago

Thanks for details, there is a high chance this is caused by page cache folder permission issue.

Please empty the /public/page-cache/ folder and see if it works.

The folder needs php write permission, there should be a warning in admin > tools > cache if permission is lacking.

Twilight-Computer commented 3 months ago

Emptying the /public/page-cache does not seem to help, however I have confirmed that if I manually restart php-fpm, the changes become visible immediately ?

Does this point to anything else ?

PS - I have pulled the latest version and applied this to my site - noting a few other setting get overwritten when I do this. I will document what I see getting overwritten as a separate issue.

Regards,

Gary Young

From: "Givan" @.> To: "givanz/Vvveb" @.> Cc: "Twilight Computer Services" @.>, "Author" @.> Date: 24/03/2024 10:26 AM Subject: Re: [givanz/Vvveb] Two Homepages in editor ? (Issue #98)

Thanks for details, there is a high chance this is caused by page cache folder permission issue. Please empty the /public/page-cache/ folder and see if it works. The folder needs php write permission, there should be a warning in admin

tools > cache if permission is lacking. — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>

givanz commented 3 months ago

To keep settings after update, skip /config folder from the zip.

System settings like active plugins, routes and email are saved in /config to load before db is initialized.

One possible cause for working after restarting php is that APCu is used for caching and for some reason is not cleared on clear cache.

You can check if the current cache method from tools > system info > object cache

You can switch to file cache from /config/app.php to see if this solves the problem.

Twilight-Computer commented 3 months ago

Thanks for the note about /config folder - I will skip that in future.

I am using APCu and this shows after updating app.php. However it does not fix the update issue. Still needs to manually restart php-fpm.

I see nothing in the /var/log/php-fpm on restart, but I do see this error when I click "Edit Website" link in Admin:

[24-Mar-2024 11:53:38 Australia/Sydney] PHP Deprecated: ucfirst(): Passing null to parameter #1 ($string) of type string is deprecated in /var/www/html/twilight/storage/compiled-templates/admin_1_default_editor_editor.html on line 2008.

That line is:

                        <?php  if (isset($this->$name)) { $options = 

$this->$name; foreach($options as $key => $option){ if ($optgroup != $option['folder']) { $optgroup = $option['folder']; echo '<optgroup label="' . ucfirst($optgroup) . '">'; } ?><option value="<?php echo $option['file']; ?>" data-v-option <?php if ($option['file'] == 'blank.html') echo 'selected'; ?>><?php echo ucfirst($option['title']); ?><?php if ($optgroup != $option['folder']) { $optgroup = $option['folder']; echo "/"; } }} ?>

Regards,

Gary Young

From: "Givan" @.> To: "givanz/Vvveb" @.> Cc: "Twilight Computer Services" @.>, "Author" @.> Date: 24/03/2024 11:07 AM Subject: Re: [givanz/Vvveb] Two Homepages in editor ? (Issue #98)

To keep settings after update, skip /config folder from the zip. System settings like active plugins, routes and email are saved in /config to load before db is initialized. One possible cause for working after restarting php is that APCu is used for caching and for some reason is not cleared on clear cache. You can check if the current cache method from tools > system info > object cache You can switch to file cache from /config/app.php to see if this solves the problem. — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>

givanz commented 3 months ago

Can you also please empty /storage/compiled-templates? html files are converted to php and loaded from this folder.

Another issue that I've seen fixed by php restart on some setups is gettext translations cache.

To disable gettext please edit /system/functions.php line 478

and change

if (function_exists('_')) {

with

if ( ! function_exists('_')) {

Thanks for the bug report, It's fixed in the latest update https://github.com/givanz/Vvveb/commit/ae790bfc40893e8c45ff17b02eb7f6325d4aaa83