hominid4
Member
Sorry, seems like I seen the answer to this years back but can't find it. Is it possible to have a variable within a placeholder?
$foo = 'bar';
$placeholder = '{'.$foo.'_table___element}';
Instead of: '{bar_table___element}';
A very simplified example of what I'm trying to achieve is, to dynamically pull a specified component of the URL path and dynamically populate the variable within the placeholder, such as:
My URLs (after "/classes/" contains the prefix of each respective table):
my-domain/classes/school_one
my-domain/classes/school_two
// Get school_one or school_two from current URL and use as the table prefix
$currentUri = JUri::current();
$tblPrefix = explode('/',$currentUri)[4];
$elSchoolClassName = '{'.$tblPrefix.'_classes___class_name}';
To return either one of the below placeholders based on the current URL:
$elSchoolClassName = '{school_one_classes___class_name}';
or
$elSchoolClassName = '{school_two_classes___class_name}';
I've been trying different tests with no luck and assume it's not possible (due to the code's firing order?) but thought I'd ask just to confirm.
Thanks!
J!: 3.9.28
Fabrik: Latest GitHub
$foo = 'bar';
$placeholder = '{'.$foo.'_table___element}';
Instead of: '{bar_table___element}';
A very simplified example of what I'm trying to achieve is, to dynamically pull a specified component of the URL path and dynamically populate the variable within the placeholder, such as:
My URLs (after "/classes/" contains the prefix of each respective table):
my-domain/classes/school_one
my-domain/classes/school_two
// Get school_one or school_two from current URL and use as the table prefix
$currentUri = JUri::current();
$tblPrefix = explode('/',$currentUri)[4];
$elSchoolClassName = '{'.$tblPrefix.'_classes___class_name}';
To return either one of the below placeholders based on the current URL:
$elSchoolClassName = '{school_one_classes___class_name}';
or
$elSchoolClassName = '{school_two_classes___class_name}';
I've been trying different tests with no luck and assume it's not possible (due to the code's firing order?) but thought I'd ask just to confirm.
Thanks!
J!: 3.9.28
Fabrik: Latest GitHub
Last edited: