MODX Community

Template or chunk won't save

I have been problems when creating a template or a chunk and adding " [[~[[*id]]]] ", the template or chunk will not save, example:

<div class="eventos">
              <div class="eventos-thum">
                <img src="[[+tv.eventThumbImage]]" alt="[[+pagetitle]]" />
              <div class="eventos-body">
                <div class="eventos-date">
                    <i class="fas fa-calendar-alt"></i>
                  <span>[[+tv.startDate]] - [[+tv.endDate]]</span>
                <div class="eventos-title">
                  <span class=" fas fa-map-marker-alt"></span>
                  <span class=" badge badge-success"> Eventos</span>
              <a href="[[~[[+id]]]]"></a>

this does not work on a local server either in the hosting server, the chunk or template won’t save, when I delete [[~[[+id]]] the chunk will save, I do not see any error messages in the console.

1 Like

At least 99% percent of the time, when a specific chunk or template won’t save based on its content, and there’s no error message, the problem is the server’s mod_security rules. That said, mod_security shouldn’t affect your local server, and I’ve never seen mod_security object to a standard link tag (though I’ve seen it reject some pretty wacky stuff), so I’m at a loss.

1 Like

Good day @davidslds.

The example you provided at the top of the page (1), the one present in your code (2), and the one at the bottom of the page (3) are not the same:

  1. [[~[[*id]]]]
  2. [[~[[+id]]]]
  3. [[~[[+id]]]

Which of them is not allowing you to save the page? :grimacing:

This is what is not working (1) [[~[[+id]]]] and also this one (2) [[~[[*id]]]]. Number 1 I am using it in a chunk to retrieve the children resources under events in the home page and all events page, and number (2) I am using it for the template where are all the info and details about the event. neither let me save it.
The way I am doing it right now is going directly to the database copying and pasting the code in the column where the code goes. A little be tedious to work like that but I need to advance in this website

If some will encounter this problem I try adding the following schema for the links [[~[[+id]]&scheme=full]] and [[~[[*id]]&scheme=full]] and is letting me save the template and the chunk with not problems in the local server and hosting server . Better to do it this way instead of going to the database.

1 Like

[[~[[+id]]&scheme= full]]

Great answer. Note that although the forum’s software doesn’t show it, the property full is surrounded by back-ticks. It’s a good habit to enclose all properties in back-ticks, though some will work without them.

FYI, one way to make them show up in Forum posts is to indent the code four spaces. Another is to add three back-ticks above and below the code.