Pixelpost

Authentic Photoblog Flavour


Go Back   Pixelpost Forum > DEVELOPMENT > Hacks and Modifications

Post Reply
 
Thread Tools
  #1  
Old 05-28-2006, 07:26 PM
Eric Offline
forum loafer
 
Join Date: May 2006
Posts: 10
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
, I wonder if it is possible to switch from a template to an other after detecting screen size.

thank you in advance for your response;
__________________
Eric
visit my photoblog : Egotrip
Reply With Quote
  #2  
Old 05-28-2006, 07:52 PM
Connie
Guest
 
Posts: n/a
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
Reply With Quote
  #3  
Old 05-28-2006, 08:46 PM
Joe[y]'s Avatar
Joe[y]+ Offline
Team Pixelpost
 
Join Date: Mar 2005
Location: UK
Posts: 3,101
Send a message via MSN to Joe[y]
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.
Reply With Quote
  #4  
Old 05-29-2006, 04:32 PM
Eric Offline
forum loafer
 
Join Date: May 2006
Posts: 10
Thank you for your responses.
As I am not very good in javacript, it may take a long time before i understand the styleswitcher file code ... but i will try ...

eric
__________________
Eric
visit my photoblog : Egotrip
Reply With Quote
  #5  
Old 05-29-2006, 07:19 PM
Eric Offline
forum loafer
 
Join Date: May 2006
Posts: 10
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" ...
__________________
Eric
visit my photoblog : Egotrip
Reply With Quote
  #6  
Old 05-30-2006, 04:40 PM
Eric Offline
forum loafer
 
Join Date: May 2006
Posts: 10
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 ? )
__________________
Eric
visit my photoblog : Egotrip
Reply With Quote
  #7  
Old 05-30-2006, 05:00 PM
Joe[y]'s Avatar
Joe[y]+ Offline
Team Pixelpost
 
Join Date: Mar 2005
Location: UK
Posts: 3,101
Send a message via MSN to Joe[y]
Quote:
Originally Posted by Eric
(it seems that I am the only person interested by this subject ? )
haha. i think you might be why exactly do you need different templates for different resolutions? perhaps there is a better solution.
Reply With Quote
  #8  
Old 05-30-2006, 06:29 PM
RobbieMc Offline
pp veteran
 
Join Date: Feb 2006
Location: Canada
Posts: 78
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
Reply With Quote
  #9  
Old 05-31-2006, 01:20 PM
phild's Avatar
phild Offline
pp veteran
 
Join Date: Oct 2005
Location: from paris with love
Posts: 85
Talking

Quote:
Originally Posted by Eric
(it seems that I am the only person interested by this subject ? )
No, you're not, we're just silentely watching you struggling until you get it right
__________________

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
Reply With Quote
Post Reply


Thread Tools




All times are GMT. The time now is 05:35 AM.

Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd. | Style Design: d3 designs