you can't detect screen size using PHP.. but if you insist you can check if it is accessed from a mobile device via User Agent Strings
i used this library before to check if a user is accessing the site in a mobile, a tablet or a desktop device..
https://code.google.com/p/php-mobile-detect/
there, you can do something like this:
include 'Mobile_Detect.php';
$detect = new Mobile_Detect;
// Check if acessed from mobile
if ($detect->isMobile()) {
include 'small-slider.php';
} else {
include 'slider.php';
}
take note that that $detect->isMobile()
will return true on tablets too, so if you want only mobile devices to use the small slider, use this instead:
if ($detect->isMobile()&&!$detect->isTablet()) {
» see the API for more info
although based from experience, this is a better approach for separate mobile sites than for responsive design.