Jump to content

the best way to display list of countries, categories, ...


php_guest

Recommended Posts

I have a list of countries and categories which are not in database. What is the best way to display them when I need them if I don't use object programming?

 

Let's say I have 30 categories.

$country_list = array(

'1'=>"category1",

'2'=>"category2",

'3'=>"category3"

...

);

 

Is the best way to create file lists.php and then I put into this file all lists? Than I require_once this file in every page. Or is better to create function show_lists($listsName) and store inside all lists?

 

 

If it will never change then it doesn't really matter.  If it will change infrequently then I would put it in an include file.  If it changes frequently, and you don't have or want a database, I would store it in a plain text file that can be read and written to.

I decided to put it in functions.php. But is it ok to have all functions in functions.php? Does it make any slower if you include in each page functions.php where you have all functions? Or it doesn't effect since I don't call all those functions but only 1?

 

thank you

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.