When developing a Perch site, it’s helpful to turn on Debug Mode.
The debug message displays various information such as SQL queries (and how long they take), templates used (or if not found) and routes matched (if you’re using Runway).
console.log(), except this is highlighted for you and easy to spot.
When you’re working on complex pages the debug message can get a bit long. It can be useful to mark the start and end of certain calls to check what’s going on.
For instance, the following will output a highlighted message right before and immediately after the debug messages related to
PerchUtil::mark('Start: Products listing'); perch_shop_products([ 'template' => 'products/list.html', 'count' => 15, ]); PerchUtil::mark('End: Products listing');
list.html template may have a Layout include too:
And you may be making more database queries from the Layout, so you can also use
PerchUtil::mark() in there too to help you spot any issues that may originate from there.