Forum Moderators: coopster

Message Too Old, No Replies

best approach to make theme based system

         

phparion

3:33 pm on Jan 9, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Hi

You might have worked with theme based softwares like wordpress, phpbb and drupal etc. Where you can change your site looks and structure sometimes with just one click in the admin panel i.e changing theme.

I was about to make a customized discussion forum in php and want to use these theme system so that i can reuse this software for my other future projects and can control the looks and structure of the forum easily from a theme system.

What is the best approach to implement theme bases system? Also I am not using any template system like smarty etc. My software is pure, apache mod rewrite, php and mysql.

thank you.

henry0

7:01 pm on Jan 9, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



If I am correct you need to search WebmasterWorld for CSS PHP in the php forum.

I am almost positive that we had a thread about dynamically serving a skin/css

thecoalman

9:42 pm on Jan 9, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



You can serve the css to the client as a php file.

<link href="www.yoursite.com/css/style.php" rel="stylesheet" type="text/css">

From there you could pull the theme data from a database.

henry0

10:51 pm on Jan 9, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



from there you may implement a cookie system to allow storing "your skin"

jatar_k

11:18 pm on Jan 9, 2008 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



this one henry?

Server Side Scripting in CSS Files [webmasterworld.com]

henry0

11:37 pm on Jan 9, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Yes thanks jatar
some day I shall start a thread with a topic of:
"How archaving from WebmasterWorld" :)

phparion

2:42 pm on Jan 10, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



I think I didn't make myself clear enough about my question. I have read this thread you just mentioned.

If you have got any chance to work with drupal or wordpress. You just copy a complete folder of different pages, not only css, to the theme folder and then from admin panel you can select that new theme and implement it on the site. NOT FOR INDIVIDUAL USERS like done on phpbb etc to personalize your visit experience. I am talking about themes like wordpress etc have. These themes not only changes style but the structure of the site too.

I am looking to make that kind of system from where i can make new themes and change them from the admin panel. Not only CSS styling but complete structure of the site with the same backend.

thank you very much

coopster

6:33 pm on Jan 10, 2008 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Style/markup can obviously be changed via the CSS so indeed, that should be a major part of the theme-based system you create. You may also see a second option which is a configuration file (or configuration options stored in a database) which allow the user to set the options they want to display and perhaps even where they want to display them.

thecoalman

4:09 am on Jan 11, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



This is a little beyond my knowledge and to post the entire method would probably take more than a few pages even if I could but I'll give it go for simple explanation.

If you examine the way it's accomplished in phpbb the php script is simply creating all the variables and then parses the template page at the end of the script. For example this is last few lines in index.php :


page_header($user->lang['INDEX']);

$template->set_filenames(array(
'body' => 'index_body.html')
);

page_footer();

To simplify it, your php file:


<?php
$my_variable = 'This is my template';
include 'my_template.php';
?>

Your html template:


<p><?php echo $my_variable;?></p>

Note that phpbb does this differently, the template file is instead loaded into an array and parsed.

phparion

5:23 am on Jan 11, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



thank you all for your informative inputs. I think i have reached somewhere to get started, as soon as I complete this system I will post back here about my method of making a theme based system.