Trongate PHP Framework Docs
Introduction
Basic Concepts
Understanding Routing
Intercepting Requests
Module Fundamentals
Database Operations
Templates
Helpers
Form Handling
Form Validation
Working With Files
Image Manipulation
Working With Dates & Times
Language Control
Authorization & Authentication
Tips And Best Practices

Flashdata Helpers

Flashdata is for one-time messages. Set it. It displays once. It never displays again.

Two functions. That’s literally all:

  • stores the message
  • returns the message (and kills it)

Setting Flashdata

In a controller, after you’ve done the thing:

Displaying Flashdata

In any view (usually right under the headline or in your template). Because the function returns a string, you must use an echo statement to display it:

Default output:

Refresh the page → gone. Forever.

Customizing the Markup

By default, flashdata wraps your message in a boring green paragraph. Change it whenever you want.

Option 1 – One-off override (in a view)

Output:

Option 2 – Global default (the smart way)

Add this once in config/config.php:

Now every single call to <?= flashdata() ?> in your entire app automatically uses your markup — no extra arguments needed.

Define FLASHDATA_OPEN and FLASHDATA_CLOSE once in config, then just write everywhere. Put that line in your main template and every page is flashdata-ready forever.

Option 3 – Mix both (when you want to be special)

You can still override the globals on a single page whenever you feel like it:

Drop <?= flashdata() ?> into your main template once. Every page becomes flashdata-ready forever.

You’re welcome.