PDA

View Full Version : Theme programming



vividona
02-09-2009, 06:32 AM
Hi guys,

I am programming a simple script. I made my codes in css. then I called all my php codes from other folder to my index.php. Then I link my index.php page with this css directory (Themes/ default/style.css). It works fine, but I think it is very stupid way. I know some people use index.php and index.template.php files in theme folder.
but for me all I have in themes folder are only style.css, header and footer in theme folder.

Plz explain to me in general how can I make a theme. and how can I include it in my index.php page.

zeromadpeter
02-09-2009, 05:05 PM
use a setting like
$themefolder = "";

store a cookie on there computer with a number or something to do with what theme they have loaded

then use the $themefolder setting to change where some images load and css.

vividona
02-10-2009, 05:25 AM
use a setting like
$themefolder = "";

store a cookie on there computer with a number or something to do with what theme they have loaded

then use the $themefolder setting to change where some images load and css.

Thank you for your help
I am using only css. Do you mean the directory to css files???

Thank in advance again, Zeromadpeter

zeromadpeter
02-10-2009, 11:45 AM
themes (folder)
jamesbond (folder)
theme.css (file)
header_layout.php (file)
footer_layout.php (file)
images (folder)
banner.jpg (file)
background.png (file)
iconthing.gif (file)


- index.php


<?php
// get the theme in use
$selected_theme = "jamesbond";
if(is_dir("themes/".$selected_theme."") == true)
{
// if the folders there go ahead and load (no other checks on files)
include("themes/".$selected_theme."/header.php");
echo "main page loads here yay";
include("themes/".$selected_theme."/footer.php");
}
else
{
// maybe put an error message here.
exit;
}
?>

this will give you the basic frame work for a theme's enabled site (thou the user cant change theme ^_^)
if you update header and footer to use $selected_theme you would not need to put a copy in each folder.

vividona
02-11-2009, 05:25 AM
Oooh zeromadpeter
you simplify the matter wonderfully
deeply thanx