[SOLVED] 3.3.0 (more likely 3.2.0) broke all images and links!
-
- Posts: 90
- Joined: Wed Sep 01, 2021 7:50 am
[SOLVED] 3.3.0 (more likely 3.2.0) broke all images and links!
I fancy v3.2.0 did it as I'm guessing that in order to provide sub-menus all my pages have moved to sub-folders.
Having upgraded to the latest version (from 3.1.4) and continuing to use my custom theme I find all my internal page links now require a "../" to work and none of the images stored at "data/files" display, because all the image links now require similar changes to the image URLs.
The images still appear when logged in as the admin screen is still at root level.
Is there guidance available on updating custom themes to cope with the v3.2.0 changes anywhere?
Having upgraded to the latest version (from 3.1.4) and continuing to use my custom theme I find all my internal page links now require a "../" to work and none of the images stored at "data/files" display, because all the image links now require similar changes to the image URLs.
The images still appear when logged in as the admin screen is still at root level.
Is there guidance available on updating custom themes to cope with the v3.2.0 changes anywhere?
-
- Posts: 90
- Joined: Wed Sep 01, 2021 7:50 am
Re: 3.3.0 (more likely 3.2.0) broke all images and links!
Mmm! My first guess isn't quite it!
Maybe it's not that the pages are now in sub-folders and just that WondeCMS is adding a "/" at the end of the URL.
Delete the slash and the images appear! Is this my theme that's incompatible or something not accounted for in the latest release.
Maybe it's not that the pages are now in sub-folders and just that WondeCMS is adding a "/" at the end of the URL.
Delete the slash and the images appear! Is this my theme that's incompatible or something not accounted for in the latest release.
-
- Posts: 90
- Joined: Wed Sep 01, 2021 7:50 am
Re: 3.3.0 (more likely 3.2.0) broke all images and links!
More testing...
While I need the ../ to make the links work while logged in, as soon as I log out to see the site as a ordinary user sees it then all I get is "Sorry page not found" screens. Take the ../ out again and the opposite happens. Works for a user but not when logged in.
I don't think I can blame that on my theme!
While I need the ../ to make the links work while logged in, as soon as I log out to see the site as a ordinary user sees it then all I get is "Sorry page not found" screens. Take the ../ out again and the opposite happens. Works for a user but not when logged in.
I don't think I can blame that on my theme!
-
- Posts: 90
- Joined: Wed Sep 01, 2021 7:50 am
Re: 3.3.0 (more likely 3.2.0) broke all images and links!
Just in case it matters... I removed the Summernote editor before making the upgrade to 3.3.0 and it's entirely possible I failed to notice the missing graphics for the very short period I had 3.2.0 installed.
Re: 3.3.0 (more likely 3.2.0) broke all images and links!
Hello Greg!
WonderCMS doesn't use subfolders for the subpages, it just nests them in the database.js file on your server.
To answer your first question, it's mentioned here https://wondercms.com/news that all custom themes require the wcms-modules.json file as instructed here in details: https://github.com/robiso/wondercms/wiki/Custom-modules
I'm not sure if your custom theme is the problem, but can you try this first:
1. Open your index.php file and replace the whole parseurl() function.
Replace (starts on line 1970)
with
If that doesn't solve it, we can dig a bit deeper. Also if this doesn't solve it, you can revert the changes with the old parseurl function.
2. How does your theme use the links? Can you please provide an example of your theme.php?
WonderCMS doesn't use subfolders for the subpages, it just nests them in the database.js file on your server.
To answer your first question, it's mentioned here https://wondercms.com/news that all custom themes require the wcms-modules.json file as instructed here in details: https://github.com/robiso/wondercms/wiki/Custom-modules
I'm not sure if your custom theme is the problem, but can you try this first:
1. Open your index.php file and replace the whole parseurl() function.
Replace (starts on line 1970)
Code: Select all
public function parseUrl(): string
{
$page = $_GET['page'] ?? null;
if (!isset($page) || !$page) {
$defaultPage = $this->get('config', 'defaultPage');
$this->currentPageTree = explode('/', $defaultPage);
return $defaultPage;
}
$this->currentPageTree = explode('/', rtrim($page, '/'));
if ($page === $this->get('config', 'login')) {
return htmlspecialchars($page, ENT_QUOTES);
}
$currentPage = end($this->currentPageTree);
return $this->slugify($currentPage);
}
Code: Select all
public function parseUrl(): string
{
if (!isset($_GET['page'])) {
$defaultPage = $this->get('config', 'defaultPage');
$this->currentPageTree = explode('/', $defaultPage);
return $defaultPage;
}
$this->currentPageTree = explode('/', rtrim($_GET['page'], '/'));
if ($_GET['page'] === $this->get('config', 'login')) {
return htmlspecialchars($_GET['page'], ENT_QUOTES);
}
$currentPage = end($this->currentPageTree);
return $this->slugify($currentPage);
}
2. How does your theme use the links? Can you please provide an example of your theme.php?
-
- Posts: 90
- Joined: Wed Sep 01, 2021 7:50 am
Re: 3.3.0 (more likely 3.2.0) broke all images and links!
Ah! I confess significant ignorance, but I also claim mitigation M'Lud! It actually says "Any custom (non official) plugins you have installed". There's no mention of themes, so I thought that bit didn't apply to me. but I have just looked at the GitHub link and I do see that it refers to "wcms-modules.json file with the following fields below". I'll have a go at creating such a file and report.wiz wrote: ↑Wed Feb 02, 2022 4:47 am WonderCMS doesn't use subfolders for the subpages, it just nests them in the database.js file on your server.
To answer your first question, it's mentioned here https://wondercms.com/news that all custom themes require the wcms-modules.json file as instructed here
I'll also play your suggested parseurl() function (though I will take a backup as I do recall reading that normally I shouldn't be playing with my index.php file!) and report my findings.
You can find my theme at:2. How does your theme use the links? Can you please provide an example of your theme.php?
https://github.com/NorfolkGreg/aivuk
It's my first venture into GitHub and very much a work in progress and designed with a specific client in mind (who is up to wrapping text in paragraph tags and a bit more).
The readme.md explains where I hope to go with the theme, (The UK Postcodes file it mentions isn't there yet as I haven't depersonalised the original yet.) Once I add the postcodes file I was planning to offer the theme to the community as I thought it might be another worthwhile starting point for others.
I'm happy to email you the address of my test site, but don't want search engines finding it while "under construction".
-
- Posts: 90
- Joined: Wed Sep 01, 2021 7:50 am
Re: 3.3.0 (more likely 3.2.0) broke all images and links!
PS: My reason for getting involved in WonderCMS was because my wife is due to retire from AIVuk and I hope to pass responsibility for maintaining their web site to one of the members. It's a fairly simple "brochure" site but the members are now recognising that their existing site doesn't respond to the searches that they expect potential clients to make hence the content is changing significantly too!
Re: 3.3.0 (more likely 3.2.0) broke all images and links!
Please email me the website (hi@wondercms.com), I think this can be solved on the theme level if you're using absolute paths.
Another issue was reported on Github, and this seemingly happens because we now add "/" at the end of URLs.
This was added due to subpages, and we're taking a deeper link. The website link is appreciated so the real issue can be found, as a proper fix, a minor change in the theme will be required (how images are listed), but it will be easier to understand the full extent of the issue you have.
Also, the News site was updated as mentioning the word "theme" was missed (thanks for pointing this out).
Another issue was reported on Github, and this seemingly happens because we now add "/" at the end of URLs.
This was added due to subpages, and we're taking a deeper link. The website link is appreciated so the real issue can be found, as a proper fix, a minor change in the theme will be required (how images are listed), but it will be easier to understand the full extent of the issue you have.
Also, the News site was updated as mentioning the word "theme" was missed (thanks for pointing this out).
Re: 3.3.0 (more likely 3.2.0) broke all images and links!
Also Greg, if you need a quick fix:
On line 2367 in index.php, replace the line
with
This will however break any subpages if you have them. Of course, always do backups, as you already know yourself.
Looking deeper into the issue, also please send the website so further debugging can be done.
On line 2367 in index.php, replace the line
Code: Select all
$parentSlug .= $item->slug . '/';
Code: Select all
$parentSlug .= $item->slug;
Looking deeper into the issue, also please send the website so further debugging can be done.
Re: 3.3.0 (more likely 3.2.0) broke all images and links!
Found a solution, expect a WonderCMS update which should fix these issues.
Greg, can you confirm this works for you as expected before we push out a new version?
On line 2368 in index.php, replace the line
with
Greg, can you confirm this works for you as expected before we push out a new version?
On line 2368 in index.php, replace the line
Code: Select all
$parentSlug .= $item->slug . '/';
Code: Select all
$parentSlug .= $subpages ? $item->slug . '/' : $item->slug;