"Dynamic" styling

General discussion of development ideas and the approaches taken in the 3.x branch of phpBB. The current feature release of phpBB 3 is 3.3/Proteus.
Forum rules
Please do not post support questions regarding installing, updating, or upgrading phpBB 3.3.x. If you need support for phpBB 3.3.x please visit the 3.3.x Support Forum on phpbb.com.

If you have questions regarding writing extensions please post in Extension Writers Discussion to receive proper guidance from our staff and community.
Post Reply
Crise
Registered User
Posts: 4
Joined: Wed Aug 15, 2007 7:49 pm

"Dynamic" styling

Post by Crise »

I got a simple proposal, probably not something everyone would need but at the same time I think it is too insignificant to "mod" my phpBB installation for it.

I will admit I have not been following the hooks discussion for 3.1 very closely and perhaps this is easily doable with the hooks, in which case forget about it. Then again if it is not possible to do something like this with a hook perhaps this should be rewritten as a hook location request, if possible within the boundaries of the system.

Ok, finally to the point, holidays are coming again and since I am a loving person I want to share some of that spirit with my community to do this that usually means a tweaked CSS with some colour adjustments and logo swap, and maybe some other things (javascript snow, anyone? yeah, it is annoying).

So I started thinking, I do these same small style edits every year just to remove them not long after adding them. Since phpBB already does things such as loops and conditional statements in its templates I though why not a conditional statement based on the server date (or date range).

So something such as (syntax wise):

Code: Select all

<!-- IF DATE(m-d) gte DATE(12-20|m-d) and DATE(m-d) lt DATE(12-27|m-d) -->
      ... something ...
<!-- ENDIF -->
Or the laymans version: add S_DATE_DAY, S_DATE_MON, S_DATE_YEAR as template variables.

This would allow me to edit the style once and forget about it. Now, since I don't want this to sound quite as self-centered suggestion as it does up to this point I went through the trouble of thinking how this could be useful in general.

I imagine some style authors have either done, or been asked to do themed versions of their styles for some occasions like Christmas for instance, whether it is adding santa to the header or changing some colours around or that ever so amusing javascript based snow fall that someone wants. Wouldn't it be just so much easier to have it all packeaged in one with this (no need to change users style preference for something like this). Of course as not to upset the users who love javascript snow as much as I do it might be good idea to have something to disable this if desired.

Okay, yeah kinda useless request but it could have uses other than holidays f.ex. all the times I have forgotten an anniversary of the site then posted week late saying: "Hey, we had an anniversary last week but I forgot, like everyone else :P" or something similar I could have just have the logo be different on that day with this to remind myself to make a topic about it. Also we can't have people forget the International Save the Kittens -day (ok, just made that up couldn't think of any actual day).

Just something I thought about after a sudden revelation about the same things I do every year, take it what it is worth (probably nothing :P but posted anyways).

User avatar
hanakin
Front-End Dev Team Lead
Front-End Dev Team Lead
Posts: 968
Joined: Sat Dec 25, 2010 9:02 pm
Contact:

Re: "Dynamic" styling

Post by hanakin »

not sure this is something that should be added into the software. Sounds more like a mod and a very easy one at that create a variable in common that gets the current date through php's then in your template define a variable = the dates you want to change and compare the two
Donations welcome via Paypal Image

igorw
Registered User
Posts: 500
Joined: Thu Jan 04, 2007 11:47 pm

Re: "Dynamic" styling

Post by igorw »

The 3.0 hooks system would probably already allow you to do this, but you'd be abusing it terribly. The way you'd accomplish this is have a hook that assigns a template variable 'IS_XMAS', depending on the current date. This would be some page_header hook (or something). Then you could just use that in your templates.

I agree, I see no point in adding this to the core explicitly.

Post Reply