PHP Coding
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Codewalkers ForumsPHP RelatedPHP Coding

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Codewalkers Forums Sponsor:
  #1  
Old September 11th, 2002, 09:05 AM
DeVeRaS DeVeRaS is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: Portugal
Posts: 31 DeVeRaS User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 2
Send a message via ICQ to DeVeRaS
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.


Reply With Quote
  #2  
Old September 11th, 2002, 03:01 PM
notepad notepad is offline
Codewalkers Loyal (3000 - 3499 posts)
 
Join Date: Apr 2007
Location: Central, IL USA
Posts: 3,214 notepad User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 5
Send a message via AIM to notepad
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.

Reply With Quote
  #3  
Old September 11th, 2002, 03:35 PM
Nimco Nimco is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 132 Nimco User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 2
Send a message via AIM to Nimco
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:
Original - php Code
  1.  
  2. index.php?lang=en   // Loads english page
  3. index.php?lang=fr   // Loads french page
  4. index.php           // Loads english page
  5.  

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.

Reply With Quote
  #4  
Old September 13th, 2002, 10:03 AM
DeVeRaS DeVeRaS is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: Portugal
Posts: 31 DeVeRaS User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 2
Send a message via ICQ to DeVeRaS
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...

Reply With Quote
  #5  
Old September 18th, 2002, 09:47 AM
Anonymous Anonymous is offline
Registered User
Codewalkers God 35th Plane (22000 - 22499 posts)
 
Join Date: Apr 2007
Posts: 22,309 Anonymous User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 24
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...

Reply With Quote
  #6  
Old September 18th, 2002, 04:31 PM
notepad notepad is offline
Codewalkers Loyal (3000 - 3499 posts)
 
Join Date: Apr 2007
Location: Central, IL USA
Posts: 3,214 notepad User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 5
Send a message via AIM to notepad
RE: Expert Developmente

sorry, i just don't understand the question..

Reply With Quote
  #7  
Old September 18th, 2002, 09:25 PM
sarah's Avatar
sarah sarah is offline
Contributing User
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: Auckland, New Zealand
Posts: 127 sarah User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 5 m 32 sec
Reputation Power: 2
Send a message via ICQ to sarah Send a message via AIM to sarah Send a message via Google Talk to sarah
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.

Reply With Quote
  #8  
Old September 19th, 2002, 09:13 AM
DeVeRaS DeVeRaS is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: Portugal
Posts: 31 DeVeRaS User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 2
Send a message via ICQ to DeVeRaS
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

Reply With Quote
  #9  
Old September 19th, 2002, 02:31 PM
notepad notepad is offline
Codewalkers Loyal (3000 - 3499 posts)
 
Join Date: Apr 2007
Location: Central, IL USA
Posts: 3,214 notepad User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 5
Send a message via AIM to notepad
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..

Reply With Quote
  #10  
Old September 23rd, 2002, 12:35 PM
DeVeRaS DeVeRaS is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: Portugal
Posts: 31 DeVeRaS User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 2
Send a message via ICQ to DeVeRaS
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 ?

Reply With Quote
  #11  
Old September 23rd, 2002, 12:43 PM
DeVeRaS DeVeRaS is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: Portugal
Posts: 31 DeVeRaS User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 2
Send a message via ICQ to DeVeRaS
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 ?

Reply With Quote
  #12  
Old September 25th, 2002, 02:52 PM
DeVeRaS DeVeRaS is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: Portugal
Posts: 31 DeVeRaS User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 2
Send a message via ICQ to DeVeRaS
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

Reply With Quote
  #13  
Old September 26th, 2002, 08:44 AM
Anonymous Anonymous is offline
Registered User
Codewalkers God 35th Plane (22000 - 22499 posts)
 
Join Date: Apr 2007
Posts: 22,309 Anonymous User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 24
RE: Expert Developmente

and ? how about it ?

Reply With Quote
  #14  
Old September 28th, 2002, 11:07 PM
DeVeRaS DeVeRaS is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: Portugal
Posts: 31 DeVeRaS User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 2
Send a message via ICQ to DeVeRaS
RE: Expert Developmente

I would really like to know what you think on this matter.

Thanks

Reply With Quote
Reply

Viewing: Codewalkers ForumsPHP RelatedPHP Coding > Expert Developmente


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support |