Reputation: 3285
I am trying to clean my url, and since I am already using the slim framework for php, I thought i might use that has a tool to achieve clean url rather than .htaccess.
For example, I have the following code:
$app->get('/onemonth', function() use($app){
$app->render('searchPage.php?in_one_month');
})->name('onemonth');
It will only work if i remove the uri of searchPage.php. In other words, if i just have it as such:
$app->render('searchPage.php');
Any suggestions would be greatly appreciated.
Upvotes: 1
Views: 122
Reputation: 3114
I'm not sure if I understood correctly what you are trying to do.
I guess you want to pass some argument to your searchPage.php
file?
If that's the case you can do the following:
$app->render('searchPage.php', array('in_one_month' => true));
Then, in your searchPage.php
file you should have access to $data['in_one_month']
(I haven't tested the last bit)
Edit:
I set up a small repository for demonstration: GitHub
Upvotes: 1