This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.

darki73
darki73

$uri = $_SERVER['REQUEST_URI'];
$exploded = explode('/', $uri);
$array = array_values(array_filter($exploded));
$route = [];
$index = 0;
foreach ($array as $item) { $route[$index] = [ 'route' => $index, 'translation' => ($index === 0) ? $index : $route[$index]['translation'] . '.' . $index ]; $index++; } return $route;`

For some reason, this code results in wrong pointer to the 'unexisting' array element. I have 3 elements in the main array i'm working with, starting counting from 0 and should finish on 2. But due to some unknown power, after setting first element in the new array, second one throws undefined offset error. Can someone tell me how PHP code is processed in the layout code block?

1-1 of 1

You cannot edit posts or make replies: the forum has moved to talk.octobercms.com.