SitePoint Sponsor

User Tag List

Results 1 to 12 of 12

Thread: PHP Classes

  1. #1
    SitePoint Zealot MediaOhgr's Avatar
    Join Date
    Jul 2001
    Location
    Calgary, Alberta, Canada
    Posts
    189
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    PHP Classes

    Hey All!

    I'm looking to create some PHP code that will allow me to offer 4 or 5 different web site themes (skins) for the user to choose from. After a little research, I'm beginning to think that PHP Classes would be the way to go here. Am I correct in that assumption?

    What I'm thinking of for my themes is actually quite simple. Have 4 or 5 HTML headers that include the site logo and some theme specific graphics. Inlcude that into a header table, then create the classes to dictate the font, font sizes, colours, tables, borders, and other attributes. Then simply apply the class to the appropiate theme.

    My biggest problem is that I am a PHP newbie and have no idea how to actually impliment this grand theory of mine!

    Does anyone know of some good PHP Class tutorials that can help me out? I've found a few but nothing really helpful to the newbie.
    MediaOhgr - But then again, maybe it's just me ...

  2. #2
    :) delemtri's Avatar
    Join Date
    Jun 2001
    Posts
    579
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    What I'd use for skins is just a cookie or a session or even a page?skin=$skin variable. Then you can do something like:

    PHP Code:
    <?php include("top_$skin.php");
    include(
    "somethingthatisconstant.php");
    include(
    "nav_$skin.php");
    include(
    "somethingelseconstant.php");
    ?> content <?php
    include("footer_$skin.php");
    include(
    "morestuffthatstaysconstant.php"); ?>

  3. #3
    SitePoint Zealot MediaOhgr's Avatar
    Join Date
    Jul 2001
    Location
    Calgary, Alberta, Canada
    Posts
    189
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Include

    Hmmmm ... so basically use a bunch of includes for pre made tables and .inc files? Is there not an easier way to include one common file that will dictate the table attributes? IE: Colour, cellpadding, cellspacing, etc? Something where I could have a general page content page that takes on the skin common file as it's attributes?
    MediaOhgr - But then again, maybe it's just me ...

  4. #4
    Dumb PHP codin' cat
    Join Date
    Aug 2000
    Location
    San Diego, CA
    Posts
    5,460
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I think it would be way easier to use templates and some sort of class for this. That way you aren't dealing with a bunch of include files everywhere, in fact you can create your html layouts for each skin. Then you can just use PHP to read in the templates based on a session var and display the page, this way you can use the same logic for any template. Check out the template class at http://phplib.netuse.de
    Please don't PM me with questions.
    Use the forums, that is what they are here for.

  5. #5
    SitePoint Zealot MediaOhgr's Avatar
    Join Date
    Jul 2001
    Location
    Calgary, Alberta, Canada
    Posts
    189
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Oh boy ...

    I checked out that link, downloaded the software, unzipped it and looked at it and quickly came to the conclusion that I was lost!

    What is it all about?
    MediaOhgr - But then again, maybe it's just me ...

  6. #6
    SitePoint Guru prequel's Avatar
    Join Date
    Nov 1999
    Location
    Brisbane, Australia
    Posts
    682
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Oh boy ...

    Originally posted by MediaOhgr
    I checked out that link, downloaded the software, unzipped it and looked at it and quickly came to the conclusion that I was lost!

    What is it all about?
    same here i'm learning php and want to use phplib and came across

    http://www.devshed.com/Server_Side/PHP/PHPLib/

    but still pretty daunting hehe

  7. #7
    SitePoint Zealot MediaOhgr's Avatar
    Join Date
    Jul 2001
    Location
    Calgary, Alberta, Canada
    Posts
    189
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Thanks!

    Thanks for the heads up on that article. I too am a screaming newbie at PHP. I like to dive in and start learning by creating apps that I'll use on my website. That method worked well with HTML but may not be the case for PHP.
    MediaOhgr - But then again, maybe it's just me ...

  8. #8
    SitePoint Enthusiast smashway's Avatar
    Join Date
    Sep 2001
    Location
    Lausanne, Switzerland
    Posts
    27
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    PHPLib is really heavy, even for non-beginners...
    An alternate way could be to build some .css files, and then set a cookie on the user's side which will tell your site which theme to use. css can be really powerful!

  9. #9
    SitePoint Zealot MediaOhgr's Avatar
    Join Date
    Jul 2001
    Location
    Calgary, Alberta, Canada
    Posts
    189
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    CSS

    The only problem with CSS is I'm not knowledgable in that area either! Actually, I know more about PHP that I do CSS. Oh well. Supposidly we're going to be learning CSS this year in our Internet Production & Design class so that's a good thing.

    One other method I've considered is an attributes file for each skin. Something that has all the attributes of the tables etc and is called upon first thing on the php page as required. Then the templates of each page will simply take on the attributes outlined in each seperate skin file.
    Last edited by MediaOhgr; Sep 3, 2001 at 09:42.
    MediaOhgr - But then again, maybe it's just me ...

  10. #10
    SitePoint Enthusiast smashway's Avatar
    Join Date
    Sep 2001
    Location
    Lausanne, Switzerland
    Posts
    27
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    IMNSHO if you know php, it won't be difficult to learn css basics... browse through some tutorials, you'll see there are several ways to do it; choose one and study it for 1-2 hours and you'll be ready to design hip sites

    <update> check this link http://www.phpbuilder.com/columns/tim20000821.php3
    </update>
    Last edited by smashway; Sep 4, 2001 at 01:00.
    Smash

    Check this thread and help me: click here!

  11. #11
    SitePoint Guru
    Join Date
    Jan 2001
    Location
    Alkmaar, Netherlands
    Posts
    710
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    phplib template system is not that heavy when you get a grip of it. Just be patient, you will gain lot from learning it.

  12. #12
    SitePoint Wizard silver trophy TheOriginalH's Avatar
    Join Date
    Aug 2000
    Location
    Thailand
    Posts
    4,810
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    http://www.w3schools.com/css/

    CSS tutorial for ya.

    I'd use php to set cookies, use an id in the cookies to parse a "custom" css file in the header of your document.

    H
    ~The Artist Latterly Known as Crazy Hamster~
    922ee590a26bd62eb9b33cf2877a00df
    Currently delving into Django, GIT & CentOS


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •