[PHP] Re: Newbie asks about multi-lingual website strategies

2007-11-28 Thread Jeff Benetti
Wow! I love this group, ask and you shall receive.  Thanks everyone for the
comments and suggestions. 

 

The following snippet from Andrés Robinet would actually suit my current
project..

 

define('DEFAULT_LANG_ID', 'en');

 

function getLanguageId() {

  // Allow for language id override in $_GET, $_POST and $_COOKIE

  $req_lang_id = $_REQUEST['lang_id'];

  // Retrieve the one stored in the session if any

  $sess_lang_id = $_SESSION['lang_id'];

  // $lang_id will contain the lang id retrieved from request (overrides
session),

  // or from session or a default one

  $lang_id = isset($req_lang_id) ? $req_lang_id : (isset($sess_lang_id) ?

$sess_lang_id : DEFAULT_LANG_ID);

  // Save it for next time

  $_SESSION['lang_id'] = $lang_id;

  return $lang_id;

}

 

but the idea of getting a preferred language from the browser is also a
great strategy ( I didn’t know you could do that, I’m such a noob) so I
think that I will investgate that further. 

 

The problem with IP address is that usually it is not tied to one particular
user so I will scrap that idea.  

 

Am I correct that if two people are logged on using two different languages
that the session var will keep track of the different users (by IP I assume)
and the server won’t mess up?

 

Anyway thanks everyone for all the great help, I’m on a nearly vertical
learning curve here and it’s great to have this community to draw on.  I’m
pretty much working in a vacuum otherwise.

 

Jeff



[PHP] Newbie asks about multi-lingual website strategies

2007-11-27 Thread Jeff Benetti
I'm a noob so keep the comments to a noob's level please.

I am doing a website and my client wants the bulk of the text to be
bilingual (French and English).  The last site I did used php and mysql so I
am getting comfortable with that technology.  Typically I am using a single
php file and my menu constantly points to the same file with different id
options example index.php?id=30 and I want to use the same idea to choose
a language example index.php?lang=frid=30.  Pretty straight forward for
many of you folks but before I start reinventing the wheel I wondered if
anyone could offer any suggestions.  I have a couple of approaches in mind.

1: Session vars, I have never used this but it seems straight forward.
Drawbacks?
2: Cookies again not too big a deal, never used cookies either but it
doesn't seem to be mystifying however the fact that the user can turn
cookies off makes me not want to go this route.
3: Use the mysql database and log each ip address and record the preference
and maybe the last time on the site.  I am leaning in this direction because
I think it is the most robust but will it be slow?  First I have to get the
ip then I have to check to see if it is in my data base and then get the
language preference.  It would be great to have a standardized function that
I could use on all of my sites.  I live in a bilingual country (Canada) so
this could be a real selling point for my services.

Any any and all comments are welcome, it will be a learning curve no matter
which route I take so a little advice on the best direction pros cons would
be great.

And of course knowing that I will have many many thousands of people on my
site (hee hee) which option will perform best once I start accumulating
vistors.  That's one problem I see with the mysql solution, I think it may
start to be slow unless I start purging vistors who have not shown up in a
while or limit the number of entries.

Thanks,
Jeff

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Php session settings

2007-10-06 Thread Jeff Benetti
Hi all, I am new to PHP this is my second post to this group.

I have tried using the following CMS systems on my web server (remote)
Joomla
CMS made simple
Phpwebsite

And more recently
Coppermine photo album

All of these apps use PHP heavily.

None of these apps seem to run very well and they all require constantly
refreshing the browser.  When I installed CMS made simple (nice install
program) it checked for MySQL database, permissions etc. everything passed
the test but it flagged low memory allocation as a possible problem.  The
install succeeded but the program indicated that performance would be poor
or crippled.

My hosting service allows me to add a customized php.ini in the same folder
as the app.  I know nothing about php.ini so I was hoping someone could
point me to which of the many settings would be best to tweak.

Any help would be much appreciated

Thanks,
Jeff

Quick recap: constantly refreshing browser, could tweak php.ini, total
newbie, no hair left to pull out.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Php session settings

2007-10-06 Thread Jeff Benetti
SERVER_SOFTWARE  Apache/1.3.34 (Unix) 
 
I have attached the output from phpinfo()
 
I cc'd the php-general group but I am not sure how an attachment will be
dealt with there.
 
Thanks,
Jeff
 


  _  

From: Nathan Nobbe [mailto:[EMAIL PROTECTED] 
Sent: October 6, 2007 9:08 AM
To: Jeff Benetti
Cc: php-general@lists.php.net
Subject: Re: [PHP] Php session settings


Jeff,

is  http://docs.php.net/manual/en/ini.core.php#ini.memory-limit
memory_limit the one youre looking for ?
that sounds strange; im sure the default would be appropriate.
i would recommend you create a script to show the current values
of the php.ini settings before you start changing them.

?php
echo phpinfo();
?

-nathan 

System  FreeBSD cgi20 4.10-RELEASE-p21 FreeBSD 4.10-RELEASE-p21 #0: Mo i386  
Build Date  Mar 22 2007 23:48:30  
Configure Command  ./configure --prefix=/usr/local/nf/php5 
--exec-prefix=/usr/local/nf/php5 --enable-exif --enable-dbase --enable-mbstring 
--with-mysql=/usr/local/nf --enable-discard-path 
--with-config-file-path=/usr/local/nf/php5/etc --with-zlib-dir=/usr/local/nf 
--with-iconv=/usr/local/nf --with-libxml-dir=/usr/local/nf 
--with-png-dir=/usr/local/nf --with-jpeg-dir=/usr/local/nf 
--with-imagick=/usr/local/nf --with-gd --with-curl=/usr/local/nf 
--with-openssl=/usr/local/nf --without-xpm --without-freetype 
--with-libxml-dir=/usr/local/nf --with-mcrypt=/usr/local/nf  
Server API  CGI  
Virtual Directory Support  disabled  
Configuration File (php.ini) Path  /usr/local/nf/php5/etc/php.ini  
PHP API  20041225  
PHP Extension  20060613  
Zend Extension  220060519  
Debug Build  no  
Thread Safety  disabled  
Zend Memory Manager  enabled  
IPv6 Support  enabled  
Registered PHP Streams  php, file, data, http, ftp, compress.zlib, https, ftps  
Registered Stream Socket Transports  tcp, udp, unix, udg, ssl, sslv3, sslv2, 
tls  
Registered Stream Filters  string.rot13, string.toupper, string.tolower, 
string.strip_tags, convert.*, consumed, convert.iconv.*, zlib.*  

 This program makes use of the Zend Scripting Language Engine:
Zend Engine v2.2.0, Copyright (c) 1998-2006 Zend Technologies
with the ionCube PHP Loader v3.1.28, Copyright (c) 2002-2007, by ionCube 
Ltd.
 




PHP Credits



Configuration
PHP Core
Directive Local Value Master Value 
allow_call_time_pass_reference On On 
allow_url_fopen On On 
allow_url_include Off Off 
always_populate_raw_post_data Off Off 
arg_separator.input   
arg_separator.output   
asp_tags Off Off 
auto_append_file no value no value 
auto_globals_jit On On 
auto_prepend_file no value no value 
browscap no value no value 
default_charset no value no value 
default_mimetype text/html text/html 
define_syslog_variables Off Off 
disable_classes no value no value 
disable_functions no value no value 
display_errors On On 
display_startup_errors Off Off 
doc_root no value no value 
docref_ext no value no value 
docref_root no value no value 
enable_dl On On 
error_append_string no value no value 
error_log no value no value 
error_prepend_string no value no value 
error_reporting no value no value 
expose_php On On 
extension_dir /usr/local/nf/php5/lib/php/extensions/no-debug-non-zts-20060613 
/usr/local/nf/php5/lib/php/extensions/no-debug-non-zts-20060613 
file_uploads On On 
highlight.bg #FF #FF 
highlight.comment #FF8000 #FF8000 
highlight.default #BB #BB 
highlight.html #00 #00 
highlight.keyword #007700 #007700 
highlight.string #DD #DD 
html_errors On On 
ignore_repeated_errors Off Off 
ignore_repeated_source Off Off 
ignore_user_abort Off Off 
implicit_flush Off Off 
include_path .:/usr/local/nf/php5/lib/php .:/usr/local/nf/php5/lib/php 
log_errors Off Off 
log_errors_max_len 1024 1024 
magic_quotes_gpc On On 
magic_quotes_runtime Off Off 
magic_quotes_sybase Off Off 
mail.force_extra_parameters no value no value 
max_execution_time 30 30 
max_input_time -1 -1 
open_basedir no value no value 
output_buffering 0 0 
output_handler no value no value 
post_max_size 8M 8M 
precision 14 14 
realpath_cache_size 16K 16K 
realpath_cache_ttl 120 120 
register_argc_argv On On 
register_globals On On 
register_long_arrays On On 
report_memleaks On On 
report_zend_debug On On 
safe_mode Off Off 
safe_mode_exec_dir /usr/local/php/bin /usr/local/php/bin 
safe_mode_gid Off Off 
safe_mode_include_dir no value no value 
sendmail_from no value no value 
sendmail_path /usr/sbin/sendmail -t -i  /usr/sbin/sendmail -t -i  
serialize_precision 100 100 
short_open_tag On On 
SMTP localhost localhost 
smtp_port 25 25 
sql.safe_mode Off Off 
track_errors Off Off 
unserialize_callback_func no value no value 
upload_max_filesize 2000 2000 
upload_tmp_dir /tmp/ /tmp/ 
user_dir no value no value 
variables_order EGPCS EGPCS 
xmlrpc_error_number 0 0 
xmlrpc_errors Off Off 
y2k_compliance

RE: [PHP] Php session settings

2007-10-06 Thread Jeff Benetti
Thanks,
I added a one line file called php.ini with the following line 
memory_limit = 16M
 
so far CMS made simple seems to run better (faster, no need for page
refresh)
 
Yes I will check out drupal
Jeff

  _  

From: Tom Friedhof [mailto:[EMAIL PROTECTED] 
Sent: October 6, 2007 11:18 AM
To: Jeff Benetti
Cc: php-general@lists.php.net
Subject: Re: [PHP] Php session settings


I almost always up the memory_limit in the php.ini.  Set the memory limit to
16M, or 32M (the default is 8M).  You want a higher memory_limit if you're
working with big file uploads or creating images with php or anything else
that takes a lot of memory. 

Also, if you're still researching which CMS to use, don't forget to check
out Drupal at http://drupal.org.  You can learn a lot about PHP by diving
into a well written project.  The Drupal code is very clean and organized. 

Tom Friedhof


On 10/6/07, Jeff Benetti [EMAIL PROTECTED] wrote: 

SERVER_SOFTWARE  Apache/1.3.34 (Unix) 
 
I have attached the output from phpinfo()
 
I cc'd the php-general group but I am not sure how an attachment will be
dealt with there.
 
Thanks,
Jeff
 


  _  

From: Nathan Nobbe [mailto:[EMAIL PROTECTED] 
Sent: October 6, 2007 9:08 AM
To: Jeff Benetti
Cc: php-general@lists.php.net
Subject: Re: [PHP] Php session settings


Jeff,

is  http://docs.php.net/manual/en/ini.core.php#ini.memory-limit
memory_limit the one youre looking for ?
that sounds strange; im sure the default would be appropriate.
i would recommend you create a script to show the current values
of the php.ini settings before you start changing them.

?php
echo phpinfo();
?

-nathan 

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php






[PHP] Using a variable for include statement

2007-09-11 Thread Jeff Benetti
Sorry if this is a noob question, I have used PERL, TCL and VB but I am just
getting into PHP.  If there is a better place to ask noobie questions then
let me know.

I want to use the include statement but I want to pass the name of the file
rather than hard code it.  It seems that PHP needs the file to be in its
defined PATH in order to do this (or am I wrong?).

My code works OK if I use hard coding

Example (works)

include ('somefile.php')

Example (doesn't work)

$TheFile = somefile.php

include ($TheFile)

Am I trying to do  something that is impossible?

If it is a path problem then how do I get around this, I can control my
local server config but I only have a local server for development.

Thanks,
Jeff

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php