This seems to be the crux of the problem. Even if you did resort to eval, how are you deciding what variables to check?
Am not. That’s exactly it.
Here is the non-code of what I am trying to achieve.
I am building a CMS/Templating system based on user defined DB tables. The system is based on a data objects ( data retrieved from the corresponding table)
Right now each data object is built at each individual template file.
i thought it might be nice to have a thisdoc() type function instead that would determine which variables are present, and use that to build a corresponding DB query for the data object.
examples:
url?cat=1
since $_GET[‘cat’] is set, use a corresponding query string ( one that may list all posts in category 1, for example)
url?post=15
since $_GET[‘ent’] is set, use a corresponding query string (one that retrieves post 15, for example)
url?post=15&cat=1
since $_GET[‘ent’] and $_GET[‘cat’] are set, use a corresponding query string (one that retrieves post 15,IF it’s in cat=1 for example)
url?pg=1
since $_GET[‘pg’] is set, use a corresponding query string (one that retrieves all post in category 1, if category one is marked as a page)
Since the tables in the DB are user defined, so are the query string variables/DB queries… this function would serve as a handler for that. So, I have NO ADVANCED knowledge of which variables will be needed at which point.
I mean, a user coudl decide to use this system to do a shopping cart, create a table for products, and use :
url?prod=5&cat=10&cheap=20
to use the ALSO USER GENERATED QUERY that retrieves ( 5 products, from category 20 that are cheaper than $20). I emphasize … the DB query itself is not important the user would determine this in a settings doc, this function is merely for the system to know which URL query strings go which which DB queries
I hope that’s clearer.