FRIHOSTFORUMSFAQTOSBLOGSDIRECTORY
You are invited to Log in or Register a Frihost Account!

Resolution Based Something Displayer

 


Kurosaki-Ichigo
Say for example i have a site and i want a different layout for each screen resolution. Like if it was 1024x800 the page layout1.html would come. If 800x600 the page layout2.html would come. You know.

I need a script that selects random images from a specific folder too.

Hey thnx. Actually im a bit curious and its really interesting this PHP. You dont need to go like :

blablabla = "you put your images here".

I know how php works a little and can figure it out myself. Just gimme the script Very Happy .
Karrde
PHP is a server-side language, so its not really capable of pulling client-side information like screen resolution. You can, however, do what you're wanting with Javascript.

Code:

<script type="text/javascript">
<!--
if ((screen.width = 1024) && (screen.height = 768))
{
 window.location="layout1.html";
}
else if ((screen.width = 800) && (screen.height = 600))
{
  window.location="layout2.html";
}
//-->
</script>


That should do more or less what you're after. Adjust to suit, of course.

As for a random image from a directory, this might help.
Reply to topic    Frihost Forum Index -> Scripting -> Php and MySQL

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2007 Frihost, forums powered by phpBB.