473,748 Members | 7,571 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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('P hoto 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("t hemes/*/theme.php" as $themefile) {include $themefile};
* Add to common.php something like "$themeengi ne = 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 1493

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

Similar topics

2
1473
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 apply one of the 30 or so color themes to that skin - so it's the same skin in different colors. I have looked at various skinning engines such as skinmagic, themeengine, directskin, etc, but none of those support color themes. Can anyone...
5
1956
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' directory. Anyone know why?
3
7066
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 Themes an older part of the .NET architecutre and simply included for backward compatibility or are Themes and Master Pages two different things meant to compliment each other? Can someone give me some insight please.
4
1683
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 which now work just fine with all my themes on my development machine but on my production server my non-standard themes are showing effects that are no longer in place even with a complete re-copy of my project. Problems like this with...
6
2493
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. Per microsoft "Only one theme can be applied to each page. You cannot apply multiple themes to a page, unlike style sheets where multiple style sheets can be applied."
3
2572
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
6616
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 where this would be used. As I understand it the precidence is like this.
2
1770
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 I could do easily in PHP, but now I see that it has some nicer theming features and master files. So I want to use web.config to switch which theme I'm using, and I want to be able to have several themes. My understanding of themes is that I...
1
1614
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. How can I accomplish this "making them available" without having the themes all automatically applied to each Web site? I understand that I can create "global themes" by placing the theme folders in...
0
8830
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9544
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9324
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8243
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6796
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6074
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4606
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4874
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3313
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.