Cotonti / Open Source PHP Content Management FrameworkContent Management Framework

List available tags and blocks in CoTemplate

Документація / Розширення Cotonti / Теми / List available tags and blocks in CoTemplate

Use CoTemplate debugging features to learn what tags and blocks are available on specific page or to dump variable contents on screen

Эта страница еще не переведена на украинский. Отображен оригинал страницы на английском языке. Вы можете зарегистрироваться и помочь с переводом.

Since Cotonti 0.9.1 a new set of debugging facilities is available to template designers.

The first one is block/tags listing mode. It outputs a plain tree of blocks and assigned tags in them for the current page. Example:

TPL debug mode

To get such a debug page, you need to make sure debug_mode is enabled for your Cotonti instance first. Open datas/config.php and make sure you have debug_mode enabled:

$cfg['debug_mode'] = TRUE;

Then you can see a TPL dump of any page by simply appending tpl_debug=1 parameter to the URL of the page, e.g.

  • http://example.com/page.php?al=test&tpl_debug=1
  • http://example.com/path/to/page/?tpl_debug=1

 

There are several notes about TPL Debug functioning:

  • Blocks are indented by 20px per each level of nesting.
  • For loop blocks (which usually have _ROW in their name) only the first instance is shown.
  • Tag values are trimmed to 60 characters.

Another useful feature which is now available is variable dumps. To see a dump of the variable instead of its content, you add special dump() callback to it using a pipe sign, e.g.

{MY_TAG|dump}
{PHP.usr.profile|dump}
or even {PHP|dump}

For example, if you place {PHP.out|dump} in header.tpl, you will see somewhat like this:

TPL dump function

And finally, one of the most frequently asked questions:

Q:
Where can I get the list of all global tags?
A:
In any of your pages if you embed {PHP|dump} in it. But get ready to see all the global PHP variables defined in the script!

 


1. pieter  18.04.2011 14:16

Thanks: 0

Thx, this will be very helpfull.

2. Bosco  19.04.2011 15:11

Thanks: 0

indeed, this will help loads of peepz with getting more out of Cotonti.

 

Всього: 3, на сторінці: 3

Додавання комментарів доступно лише зареєстрованим користувачам