OK, I am really serious about a new project of mine. I am going to create a new CMS...and It will have two basic versions. 1 with mySQL and one with flat files. This is because I could afford a real host, I had to create my own scripts cause I couldn't use mySQL.

Well the point of this is I am stumped...not on database or anything...it's the skins\themes. I know that eventully I want to be able to change the themes and layout. But, I don't wanna have to create a whole new site to do so.

So, I would really apreciate anything that you could offer me. Advice, snippets, anything!?

Also, could some one please explain the skin\theme code with PHP-NUKE. It looks really nice...because it has the header layout in an html file, the footer, and even the induviual blocks layout in html. But I cannot find out where it puts it all together.

Thanks in advance,
Shawn Kurtz
shawn_kurtz@hotmail.com

    Well, using CSS can help (or rather, is the method that you should use).

    Different themes can then just involve changing the stylesheet(s).

      That is a way to take care of the theme\skin. But, I am allowing people to change the layout. Like moving the login box here instead of here. And that involves more than style sheets.

        No it doesn't. Not if you're using the box model to it's full capacity.

          Check out CSS at w3c. Also, have a look a CSS Zen Garden to see some examples of how powerful css can be. Note that all the examples there are using exactly the same html files and just changing the css.
          The Messiah has arrived, and he is cascading 😃

            Thanks for the site, but that's not what I need.

            Basiclly what I need is to be able to include the index into the template, which i don't think I can...

            My dream structure(probally cant be done) is:

            index.php
            globals.php
            template.php
            [includes]
            [themes]
            .......||
            ....> [default]
            ...................|| default.layout.php
            ...................|| default.style.php
            ...................|| [images]

              What exactly do you want to do ? You want users to be change the complete layout ? What if they only want to change 1 page and leave all the rest up to you ? Will that be possible?

              You'll want a mixture of CSS (include an other file) and templates. I've done something like what you want with patTemplate (www.php-tools.de) but it should be possible with other template engines aswell. I include the template file for a particular page from a subdir for every user if that file exists and if not, I include the default template file.

                The users aren't going to change the themes I will, I am working on a complete CMS, and I have to get the theme's set up before anything.

                  same reasoning goes ... you can use a subdir for every theme and if the file does not exist in that subdir, include the one from the default dir.

                    but, how do I get the INDEX into the THEME? All the content is in index or whatever file and the look\style\theme\layout is in the THEME?

                      I don't see what the fuss is about.

                      Sure you could have changeable layouts - go for it. Worth it? I do doubt it unless you get ALOT of people using it...it's a CMS not a web portal...

                      Changing styles. Very simple. Put it in their preferences...

                      $user_defined_css = "StarWars.css";
                      
                      <link rel=\"stylesheet\" href=\"CSS/$user_defined_css\" type=\"text/css\">
                      

                      Voila...v

                        Originally posted by ShawnK
                        but, how do I get the INDEX into the THEME? All the content is in index or whatever file and the look\style\theme\layout is in the THEME?

                        I don't get it... you have the same index for everybody, you load a different template depending on what you want ... and combine both. What's teh problem?

                          What I orginally wanted was...

                          I have a page...index.php

                          <?PHP
                          $title = "";
                          $width = "":
                          $content .= "";
                          $content .= "";
                          $blah = "";
                          $blah2 = "";
                          ?>
                          

                          Not really like that...but just a page with all of the scripting in it...so if you used it without a layout...it wouldn't do shiznat.

                          and then you have a file ./themes/default/layout.tpl.php

                          <body>
                          
                          <div align="center">
                          
                            <table border="0" width="956" height="100%" cellspacing="0" cellpadding="0">
                              <tr>
                          
                          
                            <td width="954" height="106" colspan="3" valign="top" align="center">
                              <p align="center"><br>
                              <br>
                              <? echo("$banner" , ".jpg") ?></td>
                          
                          </tr>
                          <center>
                          <tr>
                          
                            <td class="" width="<? echo $horzmenu['width'] ?>" height="<? echo $horzmenu['height'] ?>" colspan="3">
                              <p align="center"><? echo $menu ?></p>
                            </td>
                          
                          </tr>
                          </table>
                          
                          </body>
                          

                          Now, do you get what I mean by putting the INDEX into the TEMPLATE?

                            Ooooohhh, I see what you're getting at.
                            The wy we organize things at work is that you have a file in the web root let's say index.php this would look somthing like this.

                            //index.php
                            $PAGE_NAME='index.php';
                            $PAGE_NAME_NOEXT='index';
                            $SOME_FLAG=true;
                            $CSS_FILE='style.css';
                            
                            include('./includes/theinclude.php');
                            

                            and all rot files would have this structure and they would all include this generic theinclude.php file. Within theinclude.php you would have something like this.

                            //theinclude.php
                            //includes all your standard headers like db connection
                            //standard, site wide functions etc.
                            include('./headers/standardheaders.php');
                            //include the logic of your page, which you users would not have the opportunity to edit
                            include('./logic/'.$PAGE_NAME_NOEXT.'_logic.php');
                            //include the display file which would handle all the display for the page
                            include('./display/'.$PAGE_NAME_NOEXT'._display.php');
                            

                            You can also incorperate a standard header and footer so that you have a little more control.
                            Is that the sort of thing you mean?
                            I would still suggest that you try to make it as CSS oriented as possible and just use this structure for content changes. The magor advantage with a centralised structure like this is that you can make site wide changes by changing your theinclude.php file and not have to worry about making the chages throughout all your other files.
                            HTH
                            Bubble

                              along these lines...i do it quasi-dynamically...

                              something...

                              if you have index.php?event=admin

                              then your page could call up in an include...

                              include('path/$event.inc.php');

                              you'd have to be sure you setup a path if people mess with the url...and security as well...

                              but then, everything resides at the same level, style sheets work from one location...etc...v

                                i have done something similar to what i think you want in a CMS i am building myself, the way I have done it is in a config.php included on every page i set the template/scheme I want to use for example;

                                $config['template'] = '1';
                                $config['scheme'] = 'blue';

                                The templates are stored in a folder, templates/<template> and images in images/<template> any images which are scheme specific (asin they are for blue/red/yellow scheme etc) will be in images/<template>/<scheme>

                                Now, for the templating I have template.php which has all my classes in. (at college at the moment so cant paste any snips but ill try and remember as best i can 🙂)

                                class page {
                                
                                // setting up the vars
                                var $page_name;
                                var $page_template;
                                var $page_title;
                                var $page_html;
                                
                                  function page($name, $title, $template="template") {
                                  // default template = template
                                    $this->page_name = $name;
                                    $this->page_title = $title;
                                    $this->page_template = $template;
                                  }
                                
                                  function show($content) {
                                    // this is where output the $content inside the template wrapper
                                    $this->page_html = implode("", dir_to.$this->page_template.".html");
                                    // some str_replace for scheme variable in templates etc
                                    $this->page_html = str_replace("{\$scheme\$}", $config['scheme'], $this->page_html);
                                
                                   // now i echo the page
                                   echo $this->page_html;
                                  }
                                }
                                
                                i have a 2nd class for for templates now.
                                class templates {
                                 // do the var stuff here
                                
                                  function templates($template) {
                                    // set template var to $template
                                   // template html = implode("", templatefile.html);
                                  }
                                
                                  function variable($variable, $replace) {
                                   // do a str_replace in the template html for {$$variable$} and replace with $replace
                                  }
                                
                                  function show() {
                                    return $html
                                  }
                                }
                                
                                // now for an example of how i use it
                                $page = new page("name", "title");
                                
                                $template = new templates("templatename");
                                $variable = // database result for example
                                $template->variable("something", $variable);
                                $html = $template->show();
                                
                                $page->show($html);
                                

                                it might be a bad example, but i hope you kind of understood it 🙂
                                ill paste the actual class file i have and example usage later if i remember.

                                  Write a Reply...