|
#1
|
|||
|
|||
|
Template depending of screen size ?
Dear all,
I'm a recent french user of pixelpost, and this is my first post in this forum I would like first to congratulate the authors of this photoblog. The code is well written and easy to understand. I am now working on my own template and I would like to have an automatic selection of the template depending of the screen size of the user. As it is possible to obtain the screen size with those javascript functions : Code:
window.innerWidth and window.innerHeight thank you in advance for your response; |
|
#2
|
|||
|
|||
|
Eric,
welcome here! I am glad that you like it! You can for sure include a template switch using javascript functions because you can include javascript in the template did you check out the simple template? It comes with a javascript function as well.. try to include the pixelpost-tags in the script, you have image-width and image-height as tags |
|
#3
|
||||
|
||||
|
it's certainly possible using some sort of javascript detection but there is no such addon or anything to switch the templates. looking at the styleswitcher we included in the simple template as connie suggested might be good start - perhaps you could modify it to include a certain stylesheet for certain screen resolutions.
__________________
Affordable Website Design in North Wales |
|
#5
|
|||
|
|||
|
OK,
It seems to run with an SQL update function in table config. First, a javascript function is called when index.php is open, this function detect screen size, a conditional test is performed, and if the size exceed a fixed number, then a pop-up window is open. This pop-up contains the update function. Then the opener is reloaded and the pop-up closed. I will send the code once it is "clean" ... |
|
#6
|
|||
|
|||
|
The problem is that php is executed on the server side, and javascript client side.
So, if more than one people are connected at the same time, there will be a problem because each client will try to execute the same update request. Another idea ? (it seems that I am the only person interested by this subject ? )
|
|
#7
|
||||
|
||||
|
Quote:
why exactly do you need different templates for different resolutions? perhaps there is a better solution.
__________________
Affordable Website Design in North Wales |
|
#8
|
|||
|
|||
|
You might be able to use your javascript function to simply record the screen size as a cookie, then use parts of my template switch hack to change the template depending upon the screen size. The following post sets out the switch hack, although I have no idea whether you can record the screen size as a cookie.
http://forum.pixelpost.org/showthread.php?t=3668 Good luck. Rob |
|
#9
|
||||
|
||||
|
Quote:
__________________
Traducteur de Pixelpost en français. Si vous utilisez les templates par défaut, téléchargez leur version française dans l'espace templates. photofloue.net : un blog en français sur les photoblogs et la photo photoblog work in progress | portfolio |
| Post Reply |
| Thread Tools | |
|
|