Feature #276
Add inserttag for current page ID
| Status: | Completed | Start: | ||
|---|---|---|---|---|
| Priority: | Normal | Due date: | ||
| Assigned to: | leo | % Done: | 100% |
|
| Category: | frontend | |||
| Target version: | 2.6.3 |
Description
This has been requested many times. People want to refer to the tl_page table by using the current page ID. Up to now, they have to use the other variables {{env::page_alias}}, which can change then the client renames the page.
Typical scenario is inside a module where you want to make the module use a condition clause that is checking the ID of the current page, e.g.
pagecategory={{env::page_id}}
Note. Don't want to place the actual ID in the place of "id", the inserttag should return the current page ID, e.g. 6.
Perhaps I can suggest that you move the current page variables to be returned as you do with the {{user::xxx}} inserttag, e.g. {{page::xxxx}}
{{page::id}} {{page::name}} {{page::alias}}
History
Updated by thyon over 1 year ago
I actually provided the example above of a categorization system by using pages (e.g. tl_page), and therefore to filter the data by category or page, requires the module to be able to filter one of its fields (the category) by the current page ID, e.g. An example would be to enable inserttags in your Listing module (condition textarea), so that people can write smart queries using the page ID, eg.
Listing Module Condition Clause (WHERE):
member={{user::id}} AND category={{env::page_id}}
This will show only the data where the current logged-in user is matched in the data and also the current page is the category. That allows people to use TL's tl_page structure as a hierarchical categorization system, but only use 1 listing module (as the condition adapts to the current page).
Of course to enable this feature above, you'll have to add the $this->replaceInsertTags($this->condition) in your code to enable inserttags in the condition clause, which could be part of this request.
No worries for now, I'll just add it as a custom feature to the catalog extension instead (I'll do it in the module).
Updated by leo over 1 year ago
So you are basically requesting a new insert tag {{env::page_id}} and a small change to the listing module (run replaceInsertTags() before the condition is parsed)?
Updated by thyon over 1 year ago
yep. that's it. i understand if its not a high priority, as I'm including this in my catalog release anyways.
Updated by leo over 1 year ago
- Status changed from New to Accepted
It may not be a high priority, but it is not much effort to add it.
Updated by leo over 1 year ago
- Status changed from Accepted to Completed
Also available in: Atom