Hi, Will Thanks for releasing this great tool! I already some times add it in my index.php:
define('URL', fURL::get());
// I need to receive:
// $SEGMENT[n] n-segment value in current URL;
// $LAST_SEGMENT last segment in current URL;
// $LAST_SEGMENT_WOP last segment without page_number_segment ('page2' for example);
define('URL', fURL::get());
if (URL != '' && URL != '/') {
$parts = explode('/', URL);
if (count($parts) > 5) { exit('ERROR: Some message...'); }
$n = 1;
for ($i = 1; $i < 10; $i++) {
$SEGMENT[$n] = $parts[$i];
$n++;
}
$LAST_SEGMENT = (substr(URL, -1) == '/') ? $SEGMENT[count($parts)-2] : $SEGMENT[count($parts)-1];
$start_ls = substr($LAST_SEGMENT, 0, 4);
$end_ls = substr($LAST_SEGMENT, 4, strlen($LAST_SEGMENT));
if ($start_ls == "page" && (preg_match('/^\\d*$/', $end_ls) == 1)) {
$LAST_SEGMENT_WOP = (substr(URL, -1) == '/') ? $SEGMENT[count($parts)-3] : $SEGMENT[count($parts)-2];
$PGE_NUMBER = $end_ls;
} else {
$LAST_SEGMENT_WOP = $LAST_SEGMENT;
}
}
// Then...
$_GET['limit'] = $SEGMENT[2];
$limit = fRequest::get('limit', 'integer', 10);
// Or...
$_GET['limit'] = $LAST_SEGMENT_WOP;
$limit = fRequest::get('limit', 'integer', 10);
There are thoughts?