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
Share on other sites

It's not terrible for big sites. It's terrible for any site that is larger-than-tiny.

You could start with learning about sqlite which is an embedded flat file database.

Or you might think again, and consider using some actual database.

Link to comment
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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.