Author Topic: Regarding the Code::Blocks homepage design contest  (Read 58339 times)

Offline mandrav

  • Project Leader
  • Administrator
  • Lives here!
  • *****
  • Posts: 4291
    • Code::Blocks IDE
Regarding the Code::Blocks homepage design contest
« Reply #90 on: July 09, 2005, 12:14:05 pm »
Quote
I agree with mispunt. The FAQ questions will need to be readded anyways..

That's what I meant. When the FAQ are added to the wiki, the FAQ link can point directly there. No need to have a separate FAQ section on the main site...

Quote
As you can see I have almost finished the download section

That's it! Simple and effective :)

Yiannis.
Be patient!
This bug will be fixed soon...

Offline per_eckerdal

  • Multiple posting newcomer
  • *
  • Posts: 49
Regarding the Code::Blocks homepage design contest
« Reply #91 on: July 09, 2005, 11:32:56 pm »
Here comes a long post (I've tried to structure it as good as i can, you decide if I succeeded :))

Now the site is finished!  :D

That was quite in time, because after the 13th I will not have access to a computer until August.. But now you at least have a site to use for the 1.0 release..

Features
(Here I'll tell you some of the less-obvious features of the site, mostly needed for the ones that should administer the site)

1. The tables of the database is prefixed by a non-hardcoded string that can be easily changed (a change in lib/db.php), so you will be able to use this site besides another webapp in the same database.

2. There is a a table in the database called cb_moved. When the 404 page is called, it looks in this table for common misspells and guesses. For example, it automatically redirects /handbook/ to /info/handbook/.. (It can also be used as the name says, for moved pages).

3. There is a table cb_gone containing pages that are gone. (410: Gone is VERY much more useful than a 404..)

4. The webroot is as little hardcoded as possible (to change the root of the page (eg. from /codeblocks/ to /). Three files need to be edited to change. (at least AFAIK :))

5. I use a simple yet powerful templating system for the pages. For example, the sitemap's code is
Code: [Select]
<?
require_once(dirname(__FILE__).'/../../lib/lib.php');
printStart("/help/sitemap/", 'Sitemap', "The sitemap for Code::Blocks's website", 'sitemap');
echo "<h1>Sitemap</h1>\n";
printNav(new SiteNav);
printEnd();
?>

Explaination:
The first line is the most robust way I know for importing a file without hardcoding the root of the page or using include dir in php.ini. The printStart method prints the code before the main data (It's a little ugly, I know, but I didn't have time for a more general system :( It can be changed later, tho). The printNav function prints the navigation (more about that later. The printEnd function prints the rest of the HTML code needed.

6. There is a pseudo-polymorphic (as far as you get with PHP 4 :?) navigation system. First, I hardcoded the navigation in the menu and the sitemap, but I realized that that wouldn't work, so I created this system:
There is a function printNav, which takes an object as argument. It calls startSec, printLink and endSec on that object for building the navigation. One advantage is that you can print the navigation in whatever way you want without needing to code more than the style. (But I did only create one style class, tho. The CSS did the rest for displaying properly in both the menu and the sitemap :))
The most significant advantage is that you will only need to edit the navigation in one place for the entire site..

7. There is a directory "forumtemplate" in the root dir. It contains a cut-down copy of the site, for use in forums.

Common tasks
(Here I'll tell how to do some common stuff)
Adding a new page:
1. Create the files:
1.1 Use the root index.php as a template (not required, but simpler)
1.2 Change the require_once line to include as many ../ as the depth of the directory structure e.g. "require_once(dirname(__FILE__).'/../lib/lib.php');" for /info/
1.3 Change the arguments to printStart
1.4 Add the content :)
2. Add the page in lib/nav.php
3. Add common faults and guesses to the cb_moved db table

Use the site's FAQ system:
(It is disabled, but not removed, here's how to enable it)
1. Rename info/faq.old => info/faq
2. Rename admin/faq.php.old => admin/faq.php.old
3. Uncomment the FAQ link in admin/index.php

Moving a page:
1. Move the files
2. Change references in lib/nav.php and the cb_moved db table
3. Add an entry in the cb_moved db table

How to install
(Here are the steps required to install the system)
1. Copy the files
2. Edit .htaccess, lib/lib.php, js/scripts.js to reflect the root (replace the /codeblocks/ with /)
3. Change lib/db.php and admin/auth.php to reflect the correct login info (for the database and admin interface, respectively.)
4. Change the "forum" and "help wanted" links in the lib/nav.php to link to the forum.
5. Add the Google ads in lib/ui.php (I don't know which code to use)
6. Copy the database (if you change the prefix, change the table names and the variable in lib/db.php)
7. If you have no /favicon.ico (which I believe you have, tho), you should remove the link tag from lib/ui.php

Other misc. things to note
1. I use the attribute rel="external" for all external links. There is a script that makes these show up in a new window. (I know it may seem stupid, but i do STRONGLY recommend this: it makes external links very different. Anyways, if we keep this convention, we can switch between the two, not if we don't..
2. If you want to change something, you can of course change it. Be careful, however. There might be some implicit illogical stuff lying around there: I haven't had time to clean the code very much.. Don't be too scared though: All pages (except the lib/* are 100% independent (except the path), so you can't screw up too much..)
3. One idea I have that I will probably implement in the future is a feature that allows you to customize the right column to contain news, new forum entries, etc. What d'y think?
4. About the handbook:
Currently it is an xml file with mixed custom and xhtml tags. I want to change this to only using custom tags. It will be *pain in the ass* creating xsl files to convert to other things than html otherwise..
The handbook php is currently generated by a script called transform.php (I won't tell the path here, its cpu usage might be used for a DoS attack (or I'm just paranoid.. :)) It uses PHP 5 functionality, so you might need to generate in on your computer to upload the result (out.php) to the server.

Distributing and copyright
I would STRONGLY recommend you not to release this code to the public. The OS community doesn't benefit from it, and it would be extremely much easier for crackers to find security holes.
But if you REALLY want to do it, you could, but don't blame me if the site gets screwed up by hackers :wink:
About Copyright: We must decide who's going to own this code. The OS licenses are not suited. I don't care very much, but I still want access to the code and possibility to change it :)


Can I post the code/mysql dump to mandrav@sourceforge.net?
/Per Eckerdal

Offline per_eckerdal

  • Multiple posting newcomer
  • *
  • Posts: 49
Regarding the Code::Blocks homepage design contest
« Reply #92 on: July 09, 2005, 11:41:19 pm »
Oh, one more thing that will need to be done: Move the current FAQ to the WiKi..

(I might need to shut my computer down, so you will maybe not be able to see the page.. :()
/Per Eckerdal

Offline mandrav

  • Project Leader
  • Administrator
  • Lives here!
  • *****
  • Posts: 4291
    • Code::Blocks IDE
Regarding the Code::Blocks homepage design contest
« Reply #93 on: July 10, 2005, 12:08:21 am »
Quote
About Copyright: We must decide who's going to own this code. The OS licenses are not suited. I don't care very much, but I still want access to the code and possibility to change it

Choose any copyright you want, as long as it lets us use the site ;)

Quote
Can I post the code/mysql dump to mandrav@sourceforge.net?

Yes sir, you certainly can :)

Yiannis.
Be patient!
This bug will be fixed soon...

Offline per_eckerdal

  • Multiple posting newcomer
  • *
  • Posts: 49
Regarding the Code::Blocks homepage design contest
« Reply #94 on: July 10, 2005, 12:25:45 am »
Okay, now I've sent you a mail.
/Per Eckerdal