Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Recordsets in Templates

LEGEND ,
Feb 11, 2010 Feb 11, 2010

Trying to get used to templates ...

Is there a way to apply a recordset to a template file since it is content that appears on all pages? (PhP/MYSql)

Thanks Brad

TOPICS
Server side applications
417
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Feb 11, 2010 Feb 11, 2010

I should clarify that it is in the .dwt file that I can't add a recordset ... the php files are fine.

Brad

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Feb 12, 2010 Feb 12, 2010
LATEST

Templates are not designed to be used to propagate server-side code to child pages. If you look at the code in the head of a child page, you'll see the following immediately after the DOCTYPE declaration:

<!-- InstanceBegin template="/Templates/template_name.dwt.php" codeOutsideHTMLIsLocked="false" -->

This allows you to add server behaviors to child pages.

Templates work on the principle of locking code that is propagated to all pages. Since most server behavior code is placed outside the HTML, the areas above the DOCTYPE declaration and below the closing </html> tag need to be editable.

If you want a recordset to appear on every child page, you can do so by adding the following anywhere inside the head of the dwt page:

<!-- TemplateInfo codeOutsideHTMLIsLocked="true" -->

That will lock the areas above and below the HTML. Be warned, though, that locked means locked. Your recordset will be in every child page, but you won't be able to add any other server behaviors to the page if they need to add code above the DOCTYPE declaration.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines