[Resolved] how to escape characters in loop editor?

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 15 replies, has 2 voices.

Last updated by malagaS 7 months, 3 weeks ago.

Assigned support staff: Christian Cox.

Author
Posts
#1383571

I am trying to: escape double quotes in the [wpv-items-found] section (before loop start)

Link to a page where the issue can be seen:

I expected to see:

Instead, I got:

#1383595

Christian Cox
Supporter

Languages: English (English )

Timezone: America/New_York (GMT-04:00)

Hi, are you trying to escape double quotes in a shortcode attribute? There aren't really any escape characters you can use like backslash or anything. What about the entity:

"

If that doesn't work, I'll need some more information about what you're trying to accomplish, maybe a full code example?

#1383601

hi, here's my code:

[wpv-items-found]
<a href="mailto:aaa@aaa.com?subject=aaa &body=aaaa.%0D%0D
<!-- wpv-loop-start -->

#1383605

Christian Cox
Supporter

Languages: English (English )

Timezone: America/New_York (GMT-04:00)

Try %22 instead of double quotes in URL parameters.

#1383609

i've tried that - it breaks the link in the output. so the link tries to go to a page instead of opening the email client.

#1383619

Christian Cox
Supporter

Languages: English (English )

Timezone: America/New_York (GMT-04:00)

I'll have to log in and take a closer look, may I have access credentials? Please let me know where I can find the link on the front-end of the site.

#1385209

Christian Cox
Supporter

Languages: English (English )

Timezone: America/New_York (GMT-04:00)

I'm not able to see the output on the front-end because it's a password-protected post. Can you provide the password, or remove the restriction temporarily?

Also in the View I don't see anything like the link you described. Is the link part of a custom field? If so, which field?

#1385333

Hi, sorry, i've tried so many things to get this working the view has changed by now. but the code i had in there was this, and no, not part of a custom field. just a string with a double quote that i need to comment out:

[wpv-layout-start]
[wpv-items-found]
<a href="mailto:aaa@aaaa.com?subject=Employee Verification &body=Hi Please review the following . Thank you.%0D%0D
<!-- wpv-loop-start -->
<wpv-loop>
[wpv-post-body view_template="loop-item-in-members-by-community-search"]
</wpv-loop>
<!-- wpv-loop-end -->
%0D%0DSincerely">Email</a>
[/wpv-items-found]
[wpv-no-items-found]
[wpml-string context="wpv-views"]No items found[/wpml-string]
[/wpv-no-items-found]
[wpv-layout-end]

#1385351

Christian Cox
Supporter

Languages: English (English )

Timezone: America/New_York (GMT-04:00)

The quot entity works fine here. I think the problem is the line breaks, and I would not use a Loop Template. Be sure the checkbox is checked for "Disable the wrapping DIV around the View". Then remove the line breaks in the View's loop output editor, and place the contents directly into the loop without using a template:

[wpv-layout-start]
[wpv-items-found]<a href="mailto:aaa@aaaa.com?subject=Employee Verification &body=Hi Please review the following . Thank you.%0D%0D<!-- wpv-loop-start --><wpv-loop>[wpv-post-title], &quot;Quote test&quot;, [types field="some-field"][/types] </wpv-loop><!-- wpv-loop-end -->%0D%0DSincerely">Email</a>[/wpv-items-found]
[wpv-no-items-found]
[wpml-string context="wpv-views"]No items found[/wpml-string]
[/wpv-no-items-found]
[wpv-layout-end]
#1385367

i only want this to display on the page one time - outside of the loop. (before the loop)

#1385369

and it needs to show up in the browser as part of the same string as the text outputted by the loop. so it can't be in another part of the layout.

#1385391

Christian Cox
Supporter

Languages: English (English )

Timezone: America/New_York (GMT-04:00)

I'm not sure I understand. It sounds like you want to create one mailto link. The subject of the email should contain the looped contents from the View. Let us assume there are 3 posts in the results. Their titles are:
Post Title 1
Post Title 2
Post Title 3

I also included a custom field, because I cannot see the contents of your loop template so I thought you might need an example. The posts each have a custom field called "some-field". The values for those fields in each post, respectively are:
field value 1
field value 2
field value 3

The View code I shared will produce one mailto link with the following structure:

<a href="mailto:aaa@aaaa.com?subject=Employee Verification &body=Hi Please review the following . Thank you.%0D%0DPost Title 1, &quot;Quote test&quot;, field value 1 Post Title 2, &quot;Quote test&quot;, field value 2 Post Title 3, &quot;Quote test&quot;, field value 3%0D%0DSincerely">Email</a>

Is that what you expect? If not, I need more information. What is the exact code structure you expect to produce with this View, given some known post values? Please give me specific details.

#1385431

yes, I got to that point and it does create the link, but in the template works. so i thought the code characters (double quote, the question mark, and the '=' and the '</a>' at the end) were breaking the loop code. the code colors change if i remove them so i thought that indicated something was wrong. i want the link to display, and then i want any content in the template to run. if i remove those characters then the items in the template display on the page. so i thought i should be escaping them.

#1385433

Christian Cox
Supporter

Languages: English (English )

Timezone: America/New_York (GMT-04:00)

yes, I got to that point and it does create the link, but in the template works
I don't understand this comment, sorry! I need to see a specific example to understand the problem better. Could you show me the EXACT code you want to produce, then show me the EXACT code that is being produced? Then I can compare and make a suggestion.

the code colors change if i remove them so i thought that indicated something was wrong.
Disregard the code colors in the editor for this View, you're nesting complex quotes and shortcodes so the editor colors are probably wrong 🙂

i want the link to display, and then i want any content in the template to run.
It sounds like you want to create the link, then display the looped posts again after the link. If so, you probably need two Views - one for the link and one for the display after the link.

#1385523

tested and it turns out it's the '<' that needs to be commented - sorry about that. so now, if i replace '<' with '<' in 2 places i get the correct full string but not as a link - just as text in the browser. but the items in the template do display. I'll do it your way so i get the link, and work on a second view. thank you - ok to close this ticket.