• Hi,

    First off, I apologize if I’ve posted this in the wrong forum or if this question has been answered a million times. I did take the effort to search, but I’ll admit that in general my search keywords aren’t especially imaginative.

    I’m curious what the “correct” way to create a new site in php is. I already have a small site of 6-7 pages based in php, and I’ve started to realize that I probably didn’t do things the way I should have when I created it. This became really apparent when I ran into some major difficulties when trying to integrate wordpress into my site, and rather than spending a lot of time trying to make it work, I’d rather just redesign the main site.

    Please don’t try to convince me to just hack wordpress into my site. I’ve been unhappy with my way of making sites but I’ve never asked what the right way was. I would like to make a page whose code I can be proud of. I’m a studying computer engineer, so that sort of thing is important to me ??

    I have several questions:

    What should I use for templating? At the moment I’m using some really old php3 script I found on google a few years back. I looked about a month ago for the script again on google, and couldn’t find it. I assume that this means that there must be much better things out there and I am curious: does anyone here have any suggestions? I don’t need anything fancy, but I would like the ability to generate portions of the page with my own php code (like a hit counter, or random quote).

    The second question is:

    I’ve seen many different ways of generating a site. The first (and the way I’m currently using) is to simply have a .php page for every page on the site. Another way I’ve seen is to have each page have its own subdirectory on the system, so that rather than “about.php” you have “about/”. The third way is to have just a single php page and have all the other pages be created by passing arguments to that one page (e.g. “index.php?page=about”).

    Thirdly, a question that is probably closely linked to the answers for the previous two:

    How should the page content be stored? At the moment, I store it inside the .php files between the <?php ?> tags for generating the header and footer of the page.

    Another question I have been wondering about is CSS related:

    Should I use CSS instead of tables? I’ve seen a trend toward this, but I’ve been unsure if it’s just a fad or if there are real advantages.

    Another question about site coding:

    This may be trivial, but whenever I’ve tried to use my templates in subdirectories, the image and php include paths no longer work. Now, the “hack” I’m currently using is to use absolute paths for navigation images in the layout and changing the working directory before including my formatting code. I can continue to do this, but I feel that there should be a cleaner way to do this. So I’m asking, is there a better way to do this?

    Now some questions about wordpress integration:

    What’s the best way to integrate a freshly build site with wordpress? I’ve seen articles about using themes to mimic the main site, but it seems like there should be a way to make wordpress use the main site’s templates.

    Should my main site’s .css file have anything to do with wordpress’s stuff? Should I just consolidate both my main site’s stuff and the wordpress stuff into a single file?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Do you have a WP install? Half of your questions would be answered just by looking at the code of the WP templates. In v1.5.x the templates form together a WP “theme”.
    The content is stored in MySQL database.

    Start with the Codex if you want to know more about WP.

    As for the general “site building questions”… I think they are beyond the scope of this forum.

    Yes, you should use CSS instead of tables for site structure.

    My advice would be install WordPress, and either look at the Default template (Admin > Presentation > Theme Editor > Main Template), or install another template and look at its files. Tweak and modify. After you see how all that works, you could probably make a theme from scratch (I couldn’t).

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Creating a site from scratch’ is closed to new replies.