473,386 Members | 1,708 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Porting a themes engine to OO

Hey again!

In my quest to make proper use of OO PHP I would like to ask for a
critique of the current method of doing themes in the Camera Life
(http://fdcl.sf.net) software and see if an OO approach is more
appropriate. This program consists of multiple PHP pages that include a
common.php file. My motivation is to make making themes easier, so we
can get more theme contributors!

Themes consist of image files, a css file and a PHP file that generates
HTML. An example is linked from here:
http://fdcl.sourceforge.net/index.php?content=themes In order to
"install a theme," you untar the package into your "themes" folder and
select the new theme from the administrative page.

* The common.php file gets the preference: $theme =
$preferences['theme']
* The page you are viewing (if it is interactive, and needs themes),
has: include("common.php");
include("themes/$theme/theme.php");
* The first line in HEAD of the page you are viewing is: <link
rel="stylesheet" href="themes/<?= $theme ?>/theme.css">
* The page you are viewing makes some HTML calls to the theme engine
(in the golbal namespace) like this: html_section('Photo Tasks and
Information');
* Any themed images on the page go like this: <img src="themes/<?=
$theme ?>/images/small-photo" ...>, images can be in any format,
because the software explicitly requires content negotiation :-)

I am wondering if I should update this to a OO approach, and if so,
how? My first guess would be to:

* Create themes/theme_base.php with a "theme" class and stubs for all
the html functions.
* All themes/*/theme.php will be classes that extend the "theme" class
* Change common.php to something like:
foreach(glob("themes/*/theme.php" as $themefile) {include $themefile};
* Add to common.php something like "$themeengine = new
$preferences['theme']". Here $preferences['theme'] is the name of a
type that will instantiate $themeengine.
* On each page the user sees, change to calls like:
$themeengine->html_section(...)

Please let me know if this is an abuse of the OO concept of PHP, or if
there are other considerations that I am overlooking. And thanks for
your quick and helpful responses to my last OO question.

Thank in advance,
FD

Jan 3 '06 #1
0 1479

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: meyer_phillip | last post by:
I am looking for an application skinning engine that supports colour themes. Winamp is an example of an app supporting colour themes. For example in Winamp I can pick the "Winamp Modern" skin and...
5
by: Jan Hyde | last post by:
I keep reading that there should be a couple of built in themes in the directory ...\Microsoft.NET\Framework\v2.x.xxxxx\ASP.NETClientFiles\Themes I've yet to see any machine with this 'Themes'...
3
by: johannblake | last post by:
I'm reading up on Themes and Master Pages in ASP.NET 2.0 but I cannot seem to understand what the difference between the two are. Do Master Pages essentially end up doing what Themes do? Is...
4
by: Sean | last post by:
My experience now working with master pages on and off for 6 months is that they can be very dangerous when working with themes. One example in particular is the changes I made to my banner menu...
6
by: Clinton Farleigh | last post by:
Hi, I was going to ask a question, but I think I've answered it so now I am going to rant about how crappy ASP.NET themes are instead. As I've indicated above, my problem today is with themes....
3
by: WT | last post by:
Hello, I need to list all available themes for a .NET app, is there any API in ..NET2 for this or should I explore the folder files using IO methods ? Thanks for indication CS
11
by: New Bee | last post by:
Hi, I have been looking at Themes and Skins today and now resonably understand how they work at a ground level. But I have a couple of questions. 1. ) StyleSheetTheme I dont understand...
2
by: mike | last post by:
Hi. I am having trouble grasping the concept of applying a consistent theme to an ASP.net website. I didn't used to like ASP because it was too hard to apply a theme from a common theme folder like...
1
by: Cramer | last post by:
Using 3.5: Suppose I have defined 20+ themes (including multiple graphics, ..skin files, and css files per theme), and I want to make those themes *available* to all the Web sites on my Web server....
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.