Jump to content

PHP Flat File Suggestions


Dillon

Recommended Posts

Hello, I am learning PHP on my own, I want to make a flat file forum with php. I dont know where to start. I am not sure how to make an array for the language file or anything? Does anyone have suggestions how to start? What different methods would I have to use (functions, etc.). I have heard that flat file is terrible with big websites, because it takes longer to load... Any suggestions how to do this? Thanks!

 

-Dillon

Link to comment
https://forums.phpfreaks.com/topic/187731-php-flat-file-suggestions/
Share on other sites

You are asking a lot to be addressed in a forum post. But, if you are new to PHP I would suggest not building your own flat file database from scratch. There are some freely available modules that you can use. Just do a google seach for "php flat file database" and you'll find some good resources.

 

But, a better question is why would you want to use a flat-file database? There are very cheap host (and even free ones I believe) that provide MySQL database support. Doesn't make sense to learn how to use some less than optimal solution when you can do it the right way.

As for creating a array for languages then break them up into files, (so you only load the required one)

ie

<?php
$lang = array(
"Hello" => "Hello",
"bye" => "Good Bye"
);
?>

 

 

<?php
$lang = array(
"Hello" => "Hallo",
"bye" => "Auf Wiedersehen"
);
?>

 

then you can include the desired language

ie

<?php
$langID = "en";
include $langID.".php";
echo $lang['Hello'];
?>

or

<?php
$langID = "de";
include $langID.".php";
echo $lang['Hello'];
?>

 

Hope that help,

as for the forum i agree with Mchl, that sqllite is a good option

Thanks for the quick replies! I just figured it would be a cool thing to mess around with. Since there arnt many flat file forum scripts... I am just messing around with it to learn, I dont want to make a full forum from it. How could I set up sqlite? Thanks!

 

-Dillon

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.