|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Expert Developmente
Hi there.
My question regards the way in witch to gain more speed on the processing stange of a web site. I am building a site, for the home page only i have already far more than 10 diferent files ( the site is available in 5 languages ). My questions are: For the language that a user chooses i have separated files, i could do this with one file, but wont i loose speed(there are a LOT of variables)? I have the home page mounted with 5 diferente files, i did this so in the next pages of the site i can call then wend ever they are needed. Should i transform then to funcions or classes and put then on a single file ? Thanks for reading, i lack the expert developmente witch means i lack the experience of a log time developer. |
|
#2
|
|||
|
|||
|
RE: Expert Developmente
the bigger a file, the longer it takes to search.. however if you're only searching a specific section (language) of the file at a time - then it wouldn't make a difference.
|
|
#3
|
|||||
|
|||||
|
RE: Expert Developmente
Ideally what you could do is have the information you need for each language in a separate table, and then call each page with a query to determine which page to load, but default it to one language - English for example:
php Code:
You could also try setting a cookie with the language stored in so that future pages would know what language to use. Alternatively you could use dynamic text, so that the links change to add the language variable on as well. |
|
#4
|
|||
|
|||
|
RE: Expert Developmente
So i see. I can have a file with if clauses with all languages, and i wont loose time because the if is search 1st then the content inside the clause.
Or i can put the languages vars in a database ... I will go for file this time nad then test speed with Database. thanks. Well that part is done. Now how about the composition of the home page? has i said: I have the home page mounted with 5 diferente files, i did this so that in the next pages of the site i can call then wend ever they are needed. Should i transform then to functions or classes and put then on a single file ? thanks again... |
|
#5
|
|||
|
|||
|
RE: Expert Developmente
Now how about the composition of the home page? has i said:
I have the home page mounted with 5 diferente files, i did this so that in the next pages of the site i can call then wend ever they are needed. Should i transform then to functions or classes and put then on a single file ? thanks again... |
|
#6
|
|||
|
|||
|
RE: Expert Developmente
sorry, i just don't understand the question..
|
|
#7
|
||||
|
||||
|
RE: Expert Developmente
1: Remembering the language, how about sessions
2: If you have header, footer sections etc I wouldn't have thought there was much difference between including a new file or calling a function to generate the html. Looking at the top of this page there is a menu section with <home>, <php code>. For that I'd be tempted to have one script using a template (such as phplib but there are others) to parse in the correct labels and language tags. that way if you change the layout, order etc you only change it once. However for the body of your pages it gets a bit more complicated. I'd be tempted to keep to the template concept and have my articles in a database with an article id, language flag and content. |
|
#8
|
|||
|
|||
|
RE: Expert Developmente
Thanks Sarah, but could you explain ?
I have a index.php script, in witch i call 5 pages ( include ... ) so yes i have a header, footer etc. You are saing that i sould use classes. The point is that i get to keep then in a single file is that it ? Thanks |
|
#9
|
|||
|
|||
|
RE: Expert Developmente
ah i understand.. generally i think classes work harder and therefore would take more time to load. for your overall template you'd probably be better off just using the header and footer, as sarah was saying..
|
|
#10
|
|||
|
|||
|
RE: Expert Developmente
Thanks for the info.
It is not too complicated, but i belive that you have duplicated info. I made it by creating lots of variables, and this is why i wonder if it will be fast or not. example: Imagine page 1 that has 6 includes (3 for "en" 3 for "fr" ) in the same folder. at the top: IF __lang == "en" then include the en.inc else include fr.inc The rest of the file will be: echo $text1 echo $text2 echo $text3 echo $text4 This vars exist in both inc files. This way all i need is to call the include and the language is changed. What do you think ? |
|
#11
|
|||
|
|||
|
RE: Expert Developmente
Oh !!! 3 files because
Header Body Footer All the 3 have echo $text_var so they depend on the includ file. It works fine, ( on my pc ) what do you think about the guy/girl on the 56k modem ? Too long ? |
|
#12
|
|||
|
|||
|
RE: Expert Developmente
I cant agree there, just because of this ( i may be wrong of course ).
By having the same file used, and just calling the inc files with the language, makes that file always to be on the RAM, there for the time to go and seek on the Hard Drive for me main filedoest existe. But the proble is of course then incredible number of variables. What do you see coming to this work of mine, better yet, what can happeng if i use lots of vars ? Thansk |
|
#13
|
|||
|
|||
|
RE: Expert Developmente
and ? how about it ?
|
|
#14
|
|||
|
|||
|
RE: Expert Developmente
I would really like to know what you think on this matter.
Thanks |
![]() |
| Viewing: Codewalkers Forums > PHP Related > PHP Coding > Expert Developmente |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|