0

Im creating a picture viewer for a friend of mine but i am unable to use a database because his hosting doesn't allow one.

So im left trying to use ini files but i dont know how to write a structured ini file using php..i have successfully put together a script to read it via parse_ini_file() and break it down into it seperate categories and keys but i need to know how to write the acctuall structure if there isn't one already.

For example

[flowerpics]
picone = filelocation
pictwo = filelocation

[artpics]    
picone = filelocation

this is how im basing my parse_ini_file() script for ...so what if he wants to add a whole new category to this file ..lets say he wants to add "Rockandrollpics" ...how can i go about adding that into an ini file?

1

2 Answers 2

1

If I were you, I would consider using some standard - like JSON, YAML, or even BJSON - it's almost as simple as INI files, but gives you more control about structuring the data. Your example with JSON:

"flowerpics"
{
    "picone" : "filelocation"; 
    "pictwo" : "filelocation"; 
}

"artpics"
{
    "picone" : "filelocation";
}
Sign up to request clarification or add additional context in comments.

Comments

0

If you don't use Mysql you can try to use SqlLite instead of. You needn't anything except php extension sqllite. Look at http://php.net/manual/en/book.sqlite.php for more info.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.