Skip Navigation

[Resolved] Using a view in a content template like a page builder – no posts

This thread is resolved. Here is a description of the problem and solution.

Problem:

Shortcode [wpv-autop] breaks Toolset image block JS codes

Solution:

It is fixed in the latest version of Toolset Blocks plugin.

Relevant Documentation:

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

This topic contains 18 replies, has 2 voices.

Last updated by martinE-4 2 months, 3 weeks ago.

Assigned support staff: Luo Yang.

Author
Posts
#1626229

Luo, I am sorry there must still be a problem. I thought I checked this out properly but apparently I did not. The same problem still exists after the views 3.2 update. I still need the 'fake view' to make the footer appear properly. eg.

I can give you the credentials for the staging site if you need them to go and remove the fake view and see for yourself. (or maybe you can see it like you did above by just putting the function into footer.php directly).

My footer fails if there is no other view on the page, hence the need for a 'fake view'. Here is a page where I need the 'fake view' to make the footer work:
hidden link

using the template 'template for pages6' which has a view in it called 'fake view'. Without this view the footer fails.

This continues the old ticket:
https://toolset.com/forums/topic/using-a-view-in-a-content-template-like-a-page-builder-no-posts/page/3/

#1628675

Luo Yang
Supporter

Languages: English (English ) Chinese (Simplified) (简体中文 )

Timezone: Asia/Hong_Kong (GMT+08:00)

Hello,

Thanks for the details, I am checking it in your website, will update here if there is any found.

#1628693

Luo Yang
Supporter

Languages: English (English ) Chinese (Simplified) (简体中文 )

Timezone: Asia/Hong_Kong (GMT+08:00)

I can see the problem in your website, and I have tried the similar settings in my localhost with a fresh WordPress installation: Put the PHP codes into theme file "footer.php" directly, it works fine.

So there might be other compatibility issue, I am downloading the duplicator package file from your website, will update here if there is anything found.

#1630115

Luo Yang
Supporter

Languages: English (English ) Chinese (Simplified) (简体中文 )

Timezone: Asia/Hong_Kong (GMT+08:00)

I have done below modifications in your website:
Edit the Snippet PHP code item "Query filter merge views", choose option "Only run once", save.

Please test again, check if it is fixed.

#1633957

No, it does not work:

even if I deactivate the Snippet "Query filter merge views" and delete the "Merge Related Items View" (which was a complicated scenario that you helped me solve to combine multiple views)

and replace it with a simpler view: "Related Pages and Directory Items", without the "Fake Blank" view this page (and others) fails: hidden link

However, if I insert the "Fake Blank" view it works...

#1634095

Luo Yang
Supporter

Languages: English (English ) Chinese (Simplified) (简体中文 )

Timezone: Asia/Hong_Kong (GMT+08:00)

It works fine in my localhost with your duplicator package, see screenshot: bc-ascmap.JPG

And you should be able to notice that:
In the problem URL:
hidden link
It does not output the post view "Related Pages and Directory Items"
But in my localhost, it can display the post view "Related Pages and Directory Items", see my screenshot.

So it should be a server problem, please check the PHP debug logs:
https://toolset.com/documentation/programmer-reference/debugging-sites-built-with-toolset/

If you need assistance to locate the problem, please provide your website FTP access in below private message box.

#1634849
#1636897

Luo Yang
Supporter

Languages: English (English ) Chinese (Simplified) (简体中文 )

Timezone: Asia/Hong_Kong (GMT+08:00)

I have tried the FTP access you provided above, it is not valid, I get these error messages:

Response:	331 User debug@icasc.ca OK. Password required
Command:	PASS ************
Response:	530 Login authentication failed

Please check it, make sure it is valid, thanks

#1637663

My apology Luo. The user is 'staging@' not 'debug@'

My fault.

That will take you to the root directory where you can see the error_log file which shows this as the most recent error:

[18-May-2020 09:10:45 UTC] PHP Parse error: syntax error, unexpected 'var' (T_VAR), expecting end of file in /home/icasc/public_html/staging/wp-content/plugins/gp-premium/elements/class-hooks.php(180) : eval()'d code on line 9

Apparently there are no more recent errors? Even though I put the log errors lines in the wp-config.php -- the errors were apparently being logged there prior to me putting the lines in the wp-config.php (line 57...)

#1638141

Luo Yang
Supporter

Languages: English (English ) Chinese (Simplified) (简体中文 )

Timezone: Asia/Hong_Kong (GMT+08:00)

Thanks for the details, I am checking it in your website, will update here if there is any find

#1639677

Luo Yang
Supporter

Languages: English (English ) Chinese (Simplified) (简体中文 )

Timezone: Asia/Hong_Kong (GMT+08:00)

Here are what I found:
Check the source codes of problem URL:
view-source:hidden link
Line 599 ~ 604:

<style id="' + 'toolset-blocks-styling' + '"></style>
<p>' );
}
		var style = document.getElementById( 'toolset-blocks-styling' );
		var styleTmp = document.querySelector( '.toolset-blocks-styling-tmp' );</p>
<p>		if( style && styleTmp ) {

There are extra HTML p tags in above codes, and conducts below JS errors:

Uncaught SyntaxError: Invalid or unexpected token

I am trying to dig and reproduce the same problem in a fresh WP installation, will update here if there is any news.

#1643047

Luo Yang
Supporter

Languages: English (English ) Chinese (Simplified) (简体中文 )

Timezone: Asia/Hong_Kong (GMT+08:00)

The problem is in content template "Template for Pages6", in the shortcode block, you are using below codes:
[wpv-autop][types field='page_body'][/types][/wpv-autop]

The [wpv-autop]..[/wpv-autop] shortcode outputs those extra HTML p tag in JS codes as I mentioned above, remove the [wpv-autop]..[/wpv-autop] shortcode, then the grid blocks works.

Can you confirm it in your website? I will escalate this issue. thanks

#1644403

Yes, removing the [wpv-autop] shortcode fixes the problem, but then of course the paragraph spacing of the custom field is lost...

Let me know when it is fixed. Thanks so much, Luo. Really appreciate all your hard work in tracking this down!

#1647537

Luo Yang
Supporter

Languages: English (English ) Chinese (Simplified) (简体中文 )

Timezone: Asia/Hong_Kong (GMT+08:00)

Sorry for the delay answer, checking it with our developers, will update here if there is any news.

#1650309

Luo Yang
Supporter

Languages: English (English ) Chinese (Simplified) (简体中文 )

Timezone: Asia/Hong_Kong (GMT+08:00)

I can duplicate the same problem in fresh WP installation, and have escalated it, will update here if there is any news.