MODX Community

Template output does not match database values

This is the first time I’ve encountered this particular issue, and I’m not a mySQL expert; however, I’m stumped as to what might be causing this particular bug.

My site has over 250 resources (pages), which doesn’t seem too large. I recently used ImportX to import 219 new resources using a CSV file. The import was successful, and I subsequently reviewed each individual resource to ensure the data was accurate and that all TVs had been populated accurately. Everything looked gorgeous.

However, when I view the new pages, the TVs specified in the template are not the correct ones for the resource I’m viewing. They’re usually off by one or two resource IDs. It’s a complete mystery, because when I look at the database in PHPMySQL, the resource IDs and TVs all match up. For example, if I look at the Template Variables for a particular resource–let’s say its resource ID is ‘126’–they are all the correct TVs for resource ID 126. But when I view that resource as a webpage, two of the TVs are correct, but two others are for resource ID 127.

To illustrate this very clearly…

Resource ID 126 is titled “Digging for Treasures.” The TVs for this resource in ModX are articleTitle (“Digging for Treasures”), articlePublication (“Electronic Soundmaker & Computer Music”), publicationDate (“Feb”), publicationYear (“1985”), and articleAuthor (“Richard Walmsley”).

The template for displaying resources of this type specifies:

[[*articleTitle]]

  • [[*articlePublication]]
  • [[*articleAuthor]]
  • [[*publicationDate]] [[*publicationYear]]

When I go to index.php?id=126, I see:

“Digging for Treasures”

Electronic Soundmaker & Computer Music
Robin Gibson
30-Mar 1985

The values “Robin Gibson” and “30 Mar 1985” are for resource ID 127.

Is anyone able to shed some light on where/how I might investigate further?

Thanks,
Michael

I was able to resolve this. It turns out I had duplicate database entries for the TVs, so multiple TVs were assigned to the same resource. This was a byproduct of me need to run multiple ImportX attempts and not deleting the failed imports thoroughly. I had deleted the primary resources, but not the TVs. Once I deleted the superfluous TV entries in PHPmySQL, everything works fine.

Thanks for reporting back on this. I’m glad you got it sorted. :slight_smile: