Skip Navigation

[Resolved] Parsing large HTML block

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.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Karachi (GMT+05:00)

Author
Posts
#2576391

Tell us what you are trying to do?
I am trying to embed large HTML code blocks from hidden link into a Toolset dynamic page.

Is there any documentation that you are following?
From the map source provider diagrams.net: hidden link
I've been using Toolset documentation as well but, haven't found an answer.

Is there a similar example that we can see?
A manually created-page is found here: hidden link

What is the link to your site?
The related Toolset configuration pages are:
Field Group for Maps: hidden link
Template for Maps: hidden link
Map Archive: hidden link
Final Display Page: hidden link

I created a Editor-user account for you using support@toolset.com and 9AG749*d9UlX&xxnG$pEPMq! as the password. If you would please look at this I would appreciate it.

#2576645

Hi,

Thank you for contacting us and I'd be happy to assist.

I tried to access the template and the custom field group, but the user you shared the access details for, didn't have permission.

Please delete this test user and create a new one with the 'administrator' user role. You can share that new username and password in the access details field section in the reply.
( the username and password shouldn't be included in the message of the ticket )

Note: Your next reply will be private and making a complete backup copy is recommended before sharing the access details.

regards,
Waqar

#2577513

Thank you for sharing the admin access details.

In the template 'Template for Maps' ( the template used for the single 'Maps' post pages ) and in the archive 'Maps-Archive' ( the archive used for the 'Maps' posts archive ), the 'Single Field' block is used to show the content from the custom field 'Map Content Code 1'.

In the settings of this block, I changed the output mode to 'Raw field content' ( screenshot: hidden link ), and the embed code for the map started showing correctly.

hidden link
(single map post page)

hidden link
(maps archive page)

#2578025

Hi Waqar. Thank you for the help. I had it working and now I can't seem to get it to work again.

I created the Archive page (hidden link) but, when clicking on a 'View Map' (other than the one for 'Intersections...', the map does not display.

When editing the Template or Archive page and changing from Embed Player or Raw Field Content all of this beginning content gets cut off:

<div class="mxgraph" style="max-width:100%;border:1px solid transparent;" data-mxgraph="{"highlight":"#0000ff","nav":true,"resize":true,"toolbar":"zoom layers tags lightbox","edit":"_blank","xml":"<mxfile host=\"app.diagrams.net\" modified=\"2023-03-21T19:00:09.449Z\" agent=\"5.0 (Windows)\" etag=\"aqSL_xdkQyLNNHuc0HtK\" version=\"21.0.10\" type=\"google\"><diagram id=\"Se8hYGpNridhpJQ4j5vo\" name=\"Page-1\">

Is there a way to ensure this content stays intact?

#2578079

One way I can imagine around this issue, if it isn't something you can help remedy, is the question of, if I can create a dynamic element that would be concatenated with the current field where I could first concatenate some other custom fields that would include the varying elements here including 'modified', 'etag', 'version', 'diagram id', and 'name'?

Actual Code
<div class="mxgraph" style="max-width:100%;border:1px solid transparent;" data-mxgraph="{"highlight":"#0000ff","nav":true,"resize":true,"toolbar":"zoom layers tags lightbox","edit":"_blank","xml":"<mxfile host=\"app.diagrams.net\" modified=\"2023-03-21T18:45:04.351Z\" agent=\"5.0 (Windows)\" etag=\"7eLRWTLMFHJyTw3iXPKQ\" version=\"21.0.10\" type=\"google\"><diagram id=\"9UItiflYGzto0uOVtZUF\" name=\"Page-1\">CODEHERE</diagram></mxfile>"}"></div>

Variable Template
<div class="mxgraph" style="max-width:100%;border:1px solid transparent;" data-mxgraph="{"highlight":"#0000ff","nav":true,"resize":true,"toolbar":"zoom layers tags lightbox","edit":"_blank","xml":"<mxfile host=\"app.diagrams.net\" modified=\"$TIMESTAMP\" agent=\"5.0 (Windows)\" etag=\"$ETAG\" version=\"21.0.10\" type=\"google\"><diagram id=\"$DIAGRAM_ID\" name=\"$NAME\">CODEHERE</diagram></mxfile>"}"></div>

If this is possible could you point me in the right direction as to how I would create this, assuming I added custom fields for each record that included that data?

Also, you will likely notice, on the Map Archive page I used an image vs. the live map code so I could get that up.

Thanks again!

#2579073

Thanks for writing back.

I noticed that the HTML line to include the script was added in the 'JS editor' section of the 'Template for Maps'.


<script type="text/javascript" src="<em><u>hidden link</u></em>"></script>

Because this is the 'HTML code to load the JS file' and not the 'JS code itself', I've moved it to the content part through a 'Custom HTML' block.
( screenshot: hidden link )

I've also created a test map post 'Test Map from TS support' ( hidden link ) and copied the map code from the manual page 'test_map' page ( hidden link ) into its 'Map Content Code 1' custom field and that code seems to work correctly without getting cut off.

Can you please check the map codes saved in the other map posts too and see if they were copied/pasted correctly?

As for generating the map's code dynamically through multiple custom fields, that is possible and you can register a custom shortcode for this.

Here are some useful guides on the topic:
https://codex.wordpress.org/Shortcode_API
hidden link

Note: For more personalized assistance around custom code, you can also consider hiring a professional from our list of recommended contractors:
https://toolset.com/contractors/

#2582791

My issue is resolved now. Thank you!