Skip Navigation

[Resolved] Infinite loop

This support ticket is created 8 years, 3 months ago. There's a good chance that you are reading advice that it now obsolete.

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.

Tagged: 

This topic contains 10 replies, has 4 voices.

Last updated by deanL 8 years, 2 months ago.

Assisted by: yuri.s.

Author
Posts
#354781

I'm using Views to cross-link pages. For example, from this page:
hidden link
Scroll to bottom, click the thumbnail right before the big banner (hidden link) and you will be directed to:
hidden link
Likewise, if you click the thumbnail below (hidden link) and you will be directed back to above page.

The View query is quite straightforward:
Include only posts with IDs set by the View shortcode attribute "ids" eg. [wpv-view name="view-name" ids="1"]
So I just manually enter the ID of page I want to crosslink to.

Problem now is, this works on some pages, and not on some.
Take a look at this page:
hidden link
Try click the thumbnails (this has two) and both pages will not load properly. If you check the code output you can see a lot of <div> nested within another.

I have spent countless hours trying to solve this but no luck. I have even updated my PHP to 5.6 but it didn't solve. Memory has been set to 512M. What else have I missed?

#354926

Tom

Thanks for contacting us!

Could you provide your code to get an idea what you did?

I was visiting your website and tested links.

When I clicked on the image you mentioned it forwarded me to a blog post:

hidden link

### Code Example ###

This is an example how you could manage your code:

 <a href="[wpv-view name="some-view"]">Some text</a>

Does not work due to default HTML around every view.

 <a href="[types field="some-field"][/types]">Some text</a>

Works but is not recommended, because constructing HTML attributes with ShortCode is not best practice by WordPress.

https://make.wordpress.org/core/handbook/best-practices/coding-standards/html/

### A possible solution, if you are using a VIEW to populate the link href element is using Custom Filters ###

You could use a Custom filter to output raw Loop Views.

https://toolset.com/documentation/user-guides/views-filters/

For further information or if you have any questions related to this ticket
please do not hesitate to contact us.

#354931

Hi Tom, I'm going to record a screencast to show you how I can replicate the problem. Can you make my next reply private?

#355149

Tom

Feel free to post it now.

#355575

shekhar
Supporter

Hi there,

Tom is on vacation. This is Shekhar here to help you further and I will take care of this ticket now. Hope this is OK.

#1
I have created a page "Testing View ToolSet Support" In order to test the problem in separate easy way. You can delete this page once the problem is solved.

#2
The problem that is creating infinite loop is "[wpv-post-excerpt length="128"]" used inside the views, if you remove this you will be able to view the page correctly.

The reason behind the loop might be visual composer used in the post editor and the function that renders excerpt is not responding.

In order to make it work properly you can create a custom field in the post and used the field from the view rather than post excerpt.

In alternative, could you please check if this view work properly when the "Ids that is called from the fields doesn't use visual composer"?

i will wait for the feedbacks.

Thanks

#355939

Hello Shekhar, thank you for looking into this, and apologies for the slow reply.

I can see how the page will load properly by removing [wpv-post-excerpt length="128"]. Funny thing is, in my other view (hidden link) I'm using the same [wpv-post-excerpt length="128"], and I have no problem loading those pages, for example:
hidden link
hidden link
All pages use same Post type with Visual Composer, the only thing different is they are placed under different categories. I can't understand how this might cause the problem...

#356011

shekhar
Supporter

Hi there,

Thank you for getting back to us.

While investing further into the Post Excerpt i found that you have used the views mistakenly.
Your views structure is as follows
[wpv-view name="wdzj" ids="2479"] ==> [wpv-view name="wdzj" ids="2503"] ==> [wpv-view name="xgyj" ids="2479"]
Which means the post will redirect to itself and create infinite loops.

You can not use the same id that you are calling the views into the post which is being loaded by the current view.

Could you please check if all the pages that are in infinite loops views is not repetitive?

Thanks

#356029

Shekhar, we didn't make the mistake as you have described. Maybe I should explain to you further what we are trying to achieve:

Basically, we want to cross reference stories with each other. For example:
Story A refers to Story B. Then;
Story B refers to Story A.

But we have not made the mistake of referring Story A to Story A as you have imagined.

The reason why I created two views is simply because I want each view to show different heading (H3). Look at each Loop Output again to see what I mean:
wdzj: hidden link
xgyj: hidden link

I can understand how this is difficult for you to troubleshoot because the site is in Chinese. That's why I created the screencast to show you as clearly as possible the problem I'm facing.

#356066

shekhar
Supporter

Hi there,

Sorry for the misunderstanding, In order to be more helpful, i have escalated this ticket to 2nd tier supporter, one of the second tier supporter will respond to you soon.

Thanks

#364389

Hi Dean, Shekhar escalated this issue to me. I'm sorry for the delayed response.

I tested this issue on your server as follows :

Accessed : hidden link
Clicked on both thumbnails at the bottom of the page for hidden link and hidden link

Both pages loaded normally and within a decent speed (under 4 seconds).

Can you confirm that this issue is still present in your server?

Regards,
Yuri.

#367846

Hi Yuri, based on your colleague: Shekhar's finding, he suspected the issue was caused by including Post Excerpt in the view code, and he suggested to remove it. I didn't like the solution at first, but since this has taken too long to be resolved, and my client was running out of patience, I had to resolve to remove the code anyway. That's why you were able to view the pages without issue.

I will eventually think up an alternative solution. Meanwhile you may close this ticket.

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.