Hi
A view on a client site is causing a 502 error.
I'd send through links but I don't want to have this on a forum. Can I send an email or PM?
Thanks
Dear Matt,
I’ll send you a private email right now asking you for some private information. Please check your email in a couple of minutes, and if you don’t get it, let me know so I can send it again. Thanks.
Regards,
Caridad
Dear Matt,
We need to find out the error message from the errors log. Can you follow the instructions in PHP debugging here to enable WP_DEBUG, then cause the 502 gateway error and send me the file error_log.txt?
https://toolset.com/documentation/user-guides/debugging-types-and-views/
Please let me know if you are satisfied with my answer and if I can help you with any other questions you might have.
Regards,
Caridad
Dear Matt,
I just replied to your email requesting more information.
Thanks,
Caridad
Dear Matt,
The problem is in the location of the wpv-if shortcode. Can you try putting further inside, like this:
[wpv-layout-start]
[wpv-posts-found]
<!-- wpv-loop-start -->
<wpv-loop>
[wpv-if evaluate="'[wpv-post-check_kmf]' = '1'"]
[wpv-post-body view_template="Key Date Homepage"]
[/wpv-if]
</wpv-loop>
<!-- wpv-loop-end -->
[/wpv-posts-found]
[wpv-no-posts-found][wpml-string context="wpv-views"]<strong>No posts found</strong>[/wpml-string][/wpv-no-posts-found]
[wpv-layout-end]
The function you use can be simplified to:
add_shortcode( 'wpv-post-check_kmf', 'check_kmf_func');
function check_kmf_func($atts){
return !empty($_GET['kmf']);
}
Please let me know if you are satisfied with my answer and if I can help you with any other questions you might have.
Regards,
Caridad
Hi Caridad
Fantastic that's sorted it.
Cheers
Matt
Hi Caridad,
Thanks to your advice on this thread, we solved a problem similar to what Matt was facing! We had 502 errors that initially were intermittent and then they became permanent! I found this thread, removed the [wpv-if] statements from our Views, and the 502 errors disappeared!
Now, we need to re-write the [wpv-if] statements because we cannot do without them altogether.
I am looking at your example above and it somewhat makes sense but I am a bit unclear.
Please explain the best way to re-write these statements, especially when they are nested. What I mean is, here is an example of how we have them:
[wpv-layout-start]
[wpv-items-found]
<!-- wpv-loop-start -->
<div class="featuresfacilitiespropertyBox">
<h3 class="featuresfacilitiesHDR">Feature & Facilities</h3>
<ul class="featuresfacilitiesUL">
[wpv-if built_up_area_sqft="wpcf-builtupareasqft" evaluate="!empty($built_up_area_sqft)"]
<li class="builtupareasqft">Built up area (SqFt): [types field="builtupareasqft"][/types]</li>
[/wpv-if]
<li class="GatedCommunityYN">[types field="gatedcommunityyn" state="checked"]<img src="<em><u>hidden link</u></em>" width="24" height="24" class="size-full" />[/types][types field="gatedcommunityyn" state="unchecked"]<img src="<em><u>hidden link</u></em>" width="16" height="16" class="size-full" />[/types] In a Gated Community</li>
[wpv-if parking_spaces="wpcf-parkingspaces" evaluate="!empty($parking_spaces)"]
<li class="parkingspaces">Parking spaces: [types field="parkingspaces"][/types]</li>
[/wpv-if]
<li class="poolprivateyn">[types field="poolprivateyn" state="checked"]<img src="<em><u>hidden link</u></em>" width="24" height="24" class="size-full" />[/types][types field="poolprivateyn" state="unchecked"]<img src="<em><u>hidden link</u></em>" width="16" height="16" class="size-full" />[/types] Has a pool</li>
<li class="BalconyYN ">[types field="balconyyn" state="checked"]<img src="<em><u>hidden link</u></em>" width="24" height="24" class="size-full" />[/types][types field="balconyyn" state="unchecked"]<img src="<em><u>hidden link</u></em>" width="16" height="16" class="size-full" />[/types] Has a balcony</li>
<li class="MasterEnSuiteYN">[types field="masterensuiteyn" state="checked"]<img src="<em><u>hidden link</u></em>" width="24" height="24" class="size-full" />[/types][types field="masterensuiteyn" state="unchecked"]<img src="<em><u>hidden link</u></em>" width="16" height="16" class="size-full" />[/types] Master bedroom ensuite</li>
<li class="SeparateDiningYN">[types field="separatediningyn" state="checked"]<img src="<em><u>hidden link</u></em>" width="24" height="24" class="size-full" />[/types][types field="separatediningyn" state="unchecked"]<img src="<em><u>hidden link</u></em>" width="16" height="16" class="size-full" />[/types] Dining seperate from living room</li>
<li class="PrivateBackyardYN">[types field="privatebackyardyn" state="checked"]<img src="<em><u>hidden link</u></em>" width="24" height="24" class="size-full" />[/types][types field="privatebackyardyn" state="unchecked"]<img src="<em><u>hidden link</u></em>" width="16" height="16" class="size-full" />[/types] Has a private backyard/garden</li>
<li class="HasGuestHouseYN">[types field="hasguesthouseyn" state="checked"]<img src="<em><u>hidden link</u></em>" width="24" height="24" class="size-full" />[/types][types field="hasguesthouseyn" state="unchecked"]<img src="<em><u>hidden link</u></em>" width="16" height="16" class="size-full" />[/types] Has separate guest house</li>
<li class="DSQYN">[types field="dsqyn" state="checked"]<img src="<em><u>hidden link</u></em>" width="24" height="24" class="size-full" />[/types][types field="dsqyn" state="unchecked"]<img src="<em><u>hidden link</u></em>" width="16" height="16" class="size-full" />[/types] Has DSQ</li>
<li class="GymYN">[types field="gymyn" state="checked"]<img src="<em><u>hidden link</u></em>" width="24" height="24" class="size-full" />[/types][types field="gymyn" state="unchecked"]<img src="<em><u>hidden link</u></em>" width="16" height="16" class="size-full" />[/types] Has Gym</li>
<li class="isfurnished">[types field="isfurnished" state="checked"]<img src="<em><u>hidden link</u></em>" width="24" height="24" class="size-full" />[/types][types field="isfurnished" state="unchecked"]<img src="<em><u>hidden link</u></em>" width="16" height="16" class="size-full" />[/types] Is furnished</li>
[wpv-if interior_features="wpcf-interiorfeatures" evaluate="!empty($interior_features)"]
<li class="interiorfeatures">Interior features: [types field="interiorfeatures"][/types]</li>
[/wpv-if]
[wpv-if exterior_features="wpcf-exteriorfeatures" evaluate="!empty($exterior_features)"]
<li class="exteriorfeatures">Exterior features: [types field="exteriorfeatures"][/types]</li>
[/wpv-if]
[wpv-if topography="wpcf-topography" evaluate="!empty($topography)"]
<li class="topography">Topography: [types field="topography"][/types]</li>
[/wpv-if]
</ul>
</div>
<wpv-loop>
</wpv-loop>
<!-- wpv-loop-end -->
[/wpv-items-found]
[wpv-no-items-found]
[wpml-string context="wpv-views"]<strong>No items found</strong>[/wpml-string]
[/wpv-no-items-found]
[wpv-layout-end]
And here is another example:
[wpv-layout-start]
[wpv-items-found]
<div class="propertyBoxRdFrontage">
<h4 class="propertyBoxRdFrontageHRD">Road & Frontage</h4>
<ul class="propertyBoxRdFrontageUL">
[wpv-if street_name ="wpcf-streetname" evaluate="!empty($street_name)"]
<li class="streetname">Street Name: [types field="streetname"][/types]</li>
[/wpv-if]
[wpv-if frontage_type ="wpcf-frontagetype" evaluate="!empty($frontage_type)"]
<li class="frontagetype">Frontage Type: [types field="frontagetype"][/types]</li>
[/wpv-if]
[wpv-if frontage_length ="wpcf-frontagelength" evaluate="!empty($frontage_length)"]
<li class="frontagelength">Frontage Length: [types field="frontagelength"][/types]</li>
[/wpv-if]
[wpv-if road_frontage_type ="wpcf-roadfrontagetype" evaluate="!empty($road_frontage_type)"]
<li class="roadfrontagetype">Road Frontage Type: [types field="roadfrontagetype"][/types]</li>
[/wpv-if]
[wpv-if road_surface_type ="wpcf-roadsurfacetype" evaluate="!empty($road_surface_type)"]
<li class="roadsurfacetype">Road Surface Type: [types field="roadsurfacetype"][/types]</li>
[/wpv-if]
<li class="waterfrontyn"> [types field="waterfrontyn" state="checked"]<img src="<em><u>hidden link</u></em>" width="24" height="24" class="size-full" />[/types][types field="waterfrontyn" state="unchecked"]<img src="<em><u>hidden link</u></em>" width="16" height="16" class="size-full" />[/types] Waterfront</li>
[wpv-if water_body_name ="wpcf-waterbodyname" evaluate="!empty($water_body_name)"]
<li class="waterbodyname">Water Body Name: [types field="waterbodyname"][/types]</li>
[/wpv-if]
</ul>
</div>
<!-- wpv-loop-start -->
<wpv-loop>
</wpv-loop>
<!-- wpv-loop-end -->
[/wpv-items-found]
[wpv-no-items-found]
[wpml-string context="wpv-views"]<strong>No items found</strong>[/wpml-string]
[/wpv-no-items-found]
[wpv-layout-end]
How should we have them instead?
Thanks