•  

    Answers Categories

      < ?php wp_list_categories('show_count=1&title_li=&exclude=341'); ?>
     
  •  
     
  •  

    Questions Categories

      < ?php wp_list_categories('show_count=1&title_li=&child_of=341'); ?>
     
 

Generate a CSV file using PHP 

by on February 28, 2006

Q: How do you create a CSV file dynamically with PHP? I have tried many of the examples on the web but while the save/open prompt does show, it lets me know my file is unable to be opened. I need this to not be a file that is stored on my server but instead created at the time of demand.

A: The key to generating a CSV file using PHP that will be sent to your users web browser for them to open and do with as they want is to make sure you tell the browser that it is coming. Normally using PHP you just send the browser an html document and that is what the browser expects.

You need to tell the web browser to expect a file. In order to do this you have to use the header() functions built into PHP.

header(‘Expires: 0’);
header(‘Cache-control: private’);
header(‘Cache-Control: must-revalidate, post-check=0, pre-check=0’);
header(‘Content-Description: File Transfer’);
header(‘Content-Type: application/vnd.ms-excel’);
header(‘Content-disposition: attachment; filename=”file_name.xls”‘);

Then you just echo your data. You have to make sure not to send any information before you call your header functions or else you will get errors on your page and the file will not be downloadable but will be displayed in the browser.

 
 

Open source forum software 

by on February 25, 2006

Q: Do you know of any good open source forums? I’m working on a site running on the Apache web server and I was wondering if there are any good ones.

A: The most well known piece of open source forum software is phpBB, which is programmed in PHP. This software should be easy for you to setup on your apache environment.

I know many people that use phpBB on their sites and like it a lot. I have personally opted for a non-open source product called vBulletin to use when I have to setup forum software. The reason I go this route is phpBB gets very slow if you have a lot of visitors to your site at a time or over a million or so posts.

If you expect to keep things small then phpBB is a great option; there are also options for migrating to paid forum software down the road from phpBB.

 
 

Partitioning Your Hard Drive While Installing Windows XP 

by on February 4, 2006

Q: How do I reinstall Windows XP using only part of the drive space, reserving the rest for win95 and Linux?

A: During the install process of Windows XP you will come across a “partition” screen that will show you your hard drives that are installed and give you some information about them. I suggest viewing “Partitioning A Blank Hard Drive During XP Installation” to see what screens I am talking about.

You will want to split the main drive up into the number of partitions you will want. Just make sure you do not format the other drives as NTSF or windows 95 and Linux wont be able to be installed on them. Also, while it is suggested that you use NTSF for Windows XP you might want to consider not using it so that the other operating systems can access the files on that partition. You will lose some security control when doing this but you will allow the 3 operating systems to be able to share data more easily.

You have another alternative to reinstalling though. Some companies make software that will allow you to repartition your hard drive, this way you do not have to worry about reinstalling windows. Some of them will even help you with your dual booting needs. I have put a small list together below.

Partition Magic has to be the most well known piece of software for making partitions after an operating system has been installed. You can find it for a little bit less money from amazon.com though.

Acronis Disk Director 10.0 is another piece of software that might work for you as well so you might want to take a look at it too.