Need help with website design - how to structure your website?

Discussion in 'HTML & Website Design' started by azure kitsune, Jul 12, 2009.

  1. #1
    Hi everyone,

    A few years ago, I started a website without really making any plans. For my template, I created header and footer pages, and used PHP to include these files into every single page.

    I'm starting to hate PHP now because of all the mess it creates, and realized that to move away from PHP (I'm leaning towards Perl), I would have to alter every single page of my website. I guess I don't really mind doing that this one time, but I want to make sure I never run into the same problem again.

    So my question is:

    What is the best way to structure a website? I know some people use something like "example.com/?page=pagename" which would take away the redundancy of the include statements in every page, but I don't know if this is good practice. Should I just install a CMS to do this stuff for me?

    Thanks.
     
    azure kitsune, Jul 12, 2009 IP
  2. Rodder7

    Rodder7 Active Member

    Messages:
    451
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    88
    #2
    If you want a easy solution, yes. Wordpress, Drupal, or Joomla. You can make friendly url's like my-site.c0m/my page/article-name vs. my-site.c0m/page-name.
     
    Rodder7, Jul 12, 2009 IP
  3. HorseGalleria

    HorseGalleria Peon

    Messages:
    91
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    0
    #3
    I did the opposite, I got away from perl and went with PHP. I didn't go with a CMS, instead I created a header and footer file like you. The index.php is used to fetch the other pages. If you click on either of the websites in my signature below, you will see the url for the pages look like horsegalleria.com/horse or horsemodels.com/faq. These are not folders, but rather the php files to be included between the header and footer. This simplified my site and you can't tell I running PHP. Another advantage, you can place your php files outside of the htdocs folder. The only php file I have that apache can see is index.php.
     
    HorseGalleria, Jul 12, 2009 IP
  4. Bogdanel

    Bogdanel Active Member

    Messages:
    77
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    65
    #4
    you run PHP with mod rewrite for URL :)
     
    Bogdanel, Jul 13, 2009 IP
  5. webtemppro

    webtemppro Guest

    Messages:
    12
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    yes, I would go for wordpress and develop from a "framework" theme such as thematic
     
    webtemppro, Jul 13, 2009 IP
  6. nontemplates

    nontemplates Peon

    Messages:
    782
    Likes Received:
    9
    Best Answers:
    0
    Trophy Points:
    0
    #6
    Don't want to start a flame war with Perl enthusiasts but there doesn't seem to be much of a future there. Maybe Python?
     
    nontemplates, Jul 13, 2009 IP
  7. azure kitsune

    azure kitsune Peon

    Messages:
    4
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #7
    Thanks for the replies everyone.

    The reason I want to switch to Perl is because I already know it. Why would you say that there isn't a future for Perl?

    HorseGalleria, that seems like a really nice way to arrange your website. Would something similar to that work with Perl?
     
    azure kitsune, Jul 13, 2009 IP
  8. rockyg

    rockyg Peon

    Messages:
    230
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    0
    #8
    The issue here isn't php - its your structuring of your code so I dunno why you're blaming PHP for the 'mess' it creates. PHP is only as good or as bad as the coder! And as you've said you created a site without really making any plans. We all did the same in the start :D

    I find PHP and the Smarty Templating engine great. Seperate out the code from the design and all you have to do is include your pages in the main template. Great if you got tons of some modules on the same page.
     
    rockyg, Jul 13, 2009 IP
  9. HorseGalleria

    HorseGalleria Peon

    Messages:
    91
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    0
    #9
    Yes, it would be very easy to do the same in Perl. I'm using a switch statement in my PHP code, but Perl 5 introduced a switch like statement called "given/when", or you could use "if/else" statements. If you want to see my index.php file, let me know and I will PM it to you. Don't be concerned about Perl going away, it isn't. Perl 6 has been in the works for some time.

    I wouldn't use Smarty for a simple site, it just adds another layer and you would need to learn Smarty. I have a 3rd party shopping cart using Smarty and as I look at the code, I keep asking myself, why did they use Smarty when native PHP would work just fine. To me, it adds bloat to the code and it runs slower. The should have used a MVC framework. My HorseGalleria site use a MVC no-framework framework to eliminate the bloat and complexity. The same no-framework framework could work with Perl also if your site gets more complex. Here is some info on it:

    http://toys.lerdorf.com/archives/38-The-no-framework-PHP-MVC-framework.html
     
    HorseGalleria, Jul 13, 2009 IP
  10. azure kitsune

    azure kitsune Peon

    Messages:
    4
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #10
    You're right. I'm sorry. The changing to Perl part was irrelevant to this question. (I had decided to add that extra phrase right before submitting the post! Bad idea!)

    I just wanted to know if whether or not a CMS would be a good choice to me. I think I feel more comfortable writing the code behind everything so I'll stick with not using a CMS for now.

    HorseGalleria, MVC seems like just concept I need! Thanks! I will definitely look into it! :)
     
    azure kitsune, Jul 13, 2009 IP
  11. r0bin

    r0bin Peon

    Messages:
    91
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #11
    I recommend you make a index.php file with a structure like this:
    - include(header.php)
    - include(menu.php)
    - include(<link clicked in menu.php>)
    - include(footer.php)

    This way you don't have to put any code in your content pages. You don't have to do this in PHP, it should be possible in Perl too. You can make your menu manually, or you could make a script that reads a folder with all your content-pages and puts them in the menu automatically.
     
    r0bin, Jul 14, 2009 IP