[eluser]Clooner[/eluser]
[quote author="Christophe28" date="1277229863"]Hi,
Thank you for your response.
I have added the following line in routes.php
Code:
$route['photos/(:any)/(:any)'] = 'photos/photofunction/$1,$2';
And added the following line in controller.php
Code:
function photofunction($username, $caption)
{
echo $username;
echo $caption;
}
But got the following warning when surfing to /photos/Christophe/mygreatphoto
Quote:A PHP Error was encountered
Severity: Warning
Message: Missing argument 2 for Photos::photofunction()
Filename: controllers/photos.php
Line Number: 13
Christophe,mygreatphoto
A PHP Error was encountered
Severity: Notice
Message: Undefined variable: caption
Filename: controllers/photos.php
Line Number: 17
I have changed a bit here and there, like ID to caption. I think this is ok? What am I missing here?
Dank je voor je hulp
Christophe[/quote]
The error says it can't find the second argument of. try this
Code:
function photofunction($username='geen', $caption='leeg')
{
echo $username;
echo $caption;
}
it won't give errors this way and will ste the $username to default geen and $caption to default leeg
and I believe the routes should be like this:
Code:
$route['photos/(:any)/(:any)'] = 'photos/photofunction/$1/$2';