Forum

Thread tagged as: Question, Error

Shared content regions are overriding page specific content regions.

Hi.

I recently upgraded a website from Perch 2.4.9 to 2.5.2, and it appears to have changed the way regions behave. I have a shared region called "Products", and on two of my site pages I have regions also called "Products". Each of these regions have completely different templates.

Since the upgrade, the site pages show the content from the shared "Products" region, instead of their page specific "Products" region content. Even if I use perch_custom_content() function with the "pages" option, to let Perch know explicitly which region I'm intending to display, the shared region content is still output on these page.

Before I applied the 2.5.2 upgrade, the regions on these pages were displaying correctly.

Any advice on how to fix this would be appreciated.

Thanks.

James Harrison

James Harrison 0 points

  • 7 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

I'm not aware of any change to that behaviour between those versions. I'll have a look into it tomorrow and see if I can reproduce it. If not I may need more info from you.

Hi Drew, thanks for the quick response.

I reverted my repository to a commit before I upgraded Perch and restored my database to an earlier version too, and the regions work fine again, so it definitely looks like something about going from 2.4.9 to 2.5.2 is the cause.

Sure, just let me know what information you need to help you figure it out and I'll send it over.

Thanks.

Drew McLellan

Drew McLellan 2638 points
Perch Support

This behaviour really hasn't changed, but there are factors that could change the result you're seeing. Have you changed MySQL version, or reimported your database, or anything along those lines?

Unfortunately, it looks like the exact behaviour when you have a shared region and a local region with the same key is not as I'd intended. I'd intended that the local override the shared, which is what you were expecting too, I think. Whether or not this happens depends a bit on the whim of the MySQL server involved, which is regrettable.

I'm going to fix this for 2.5.3, which will unfortunately risk changing the behaviour for existing sites - but as you've seen, the behaviour can be unpredictable, so better to break it while someone is in attendance than risk it changing when no one expects it further down the line.

I haven't changed the version of MySQL I've been using (which is 5.5.15). I also haven't reimported my database either.

I definitely think the page specific regions should be the ones that load first if there is a shared region with the same name. I think it's the behaviour most developers would expect.

Thanks for taking the time to look into this.

Drew McLellan

Drew McLellan 2638 points
Perch Support

Let me know how you get on with 2.5.3.

Everything works correctly since I applied the update. Thanks.