php-general Digest 8 Feb 2010 17:09:28 -0000 Issue 6580

Topics (messages 301870 through 301887):

pecl install geoip doesnt work. Warning: 
opendir(/var/tmp/pear-build-root/install-geoip-1.0.7//var/www/pear): failed to 
open dir: No such file or directory in PEAR/Builder.php on line 188
        301870 by: David Taveras
        301872 by: Jochem Maas

Re: php selecting multiple stylesheets
        301871 by: Paul M Foster
        301873 by: TG
        301875 by: Ashley Sheridan
        301879 by: Stephan Ebelt
        301881 by: Ashley Sheridan
        301882 by: Michael A. Peters
        301883 by: Al
        301885 by: tedd
        301886 by: Ashley Sheridan
        301887 by: Michael A. Peters

Re: simplexml - can it do what I need?
        301874 by: TerryA
        301876 by: Ashley Sheridan
        301878 by: TerryA
        301884 by: TerryA

Re: Issue with blocked socket stream
        301877 by: Phani Raju

Re: Help with regex (search/replace) please
        301880 by: Gautam Bhatia

Administrivia:

To subscribe to the digest, e-mail:
        php-general-digest-subscr...@lists.php.net

To unsubscribe from the digest, e-mail:
        php-general-digest-unsubscr...@lists.php.net

To post to the list, e-mail:
        php-gene...@lists.php.net


----------------------------------------------------------------------
--- Begin Message ---
Hello,

Before writing to the general list I tried to search for a pecl users
list but apparently it is closed only to developers.

Iam running pecl install geoip, it confirms as per below that it was
installed correctly but a find / -name geoip.so yields nothing, the
paths mentioned at the end also do not exist. I assume this is because
of the warning in the subject like of this message. Does anybody know
what to do?

Ive tried to uninstall pear and installed it again without luck. Iam
using PEAR-1.9.0 , php5.2.8, and GeoIP-1.4.6.

Thanks

David T.


# /root/bin/pecl install geoip
downloading geoip-1.0.7.tgz ...
Starting to download geoip-1.0.7.tgz (9,416 bytes)
.....done: 9,416 bytes
3 source files, building
running: phpize
Configuring for:
PHP Api Version:         20041225
Zend Module Api No:      20060613
Zend Extension Api No:   220060519
configure.in:145: warning: AC_CACHE_VAL(lt_prog_compiler_static_works,
...): suspicious cache-id, must contain _cv_ to be cached
/usr/local/share/autoconf-2.62/autoconf/general.m4:1987: AC_CACHE_VAL
is expanded from...
/usr/local/share/autoconf-2.62/autoconf/general.m4:2000:
AC_CACHE_CHECK is expanded from...
aclocal.m4:3565: AC_LIBTOOL_LINKER_OPTION is expanded from...
aclocal.m4:5577: _LT_AC_LANG_C_CONFIG is expanded from...
aclocal.m4:5472: AC_LIBTOOL_LANG_C_CONFIG is expanded from...
aclocal.m4:3089: AC_LIBTOOL_SETUP is expanded from...
aclocal.m4:2947: _AC_PROG_LIBTOOL is expanded from...
aclocal.m4:2927: AC_PROG_LIBTOOL is expanded from...
configure.in:145: the top level
configure.in:145: warning: AC_CACHE_VAL(lt_prog_compiler_pic_works,
...): suspicious cache-id, must contain _cv_ to be cached
aclocal.m4:3528: AC_LIBTOOL_COMPILER_OPTION is expanded from...
aclocal.m4:8099: AC_LIBTOOL_PROG_COMPILER_PIC is expanded from...
configure.in:145: warning:
AC_CACHE_VAL(lt_prog_compiler_pic_works_CXX, ...): suspicious
cache-id, must contain _cv_ to be cached
aclocal.m4:6529: _LT_AC_LANG_CXX_CONFIG is expanded from...
aclocal.m4:5585: AC_LIBTOOL_LANG_CXX_CONFIG is expanded from...
aclocal.m4:4717: _LT_AC_TAGCONFIG is expanded from...
configure.in:145: warning: AC_CACHE_VAL(lt_prog_compiler_static_works,
...): suspicious cache-id, must contain _cv_ to be cached
/usr/local/share/autoconf-2.62/autoconf/general.m4:1987: AC_CACHE_VAL
is expanded from...
/usr/local/share/autoconf-2.62/autoconf/general.m4:2000:
AC_CACHE_CHECK is expanded from...
aclocal.m4:3565: AC_LIBTOOL_LINKER_OPTION is expanded from...
aclocal.m4:5577: _LT_AC_LANG_C_CONFIG is expanded from...
aclocal.m4:5472: AC_LIBTOOL_LANG_C_CONFIG is expanded from...
aclocal.m4:3089: AC_LIBTOOL_SETUP is expanded from...
aclocal.m4:2947: _AC_PROG_LIBTOOL is expanded from...
aclocal.m4:2927: AC_PROG_LIBTOOL is expanded from...
configure.in:145: the top level
configure.in:145: warning: AC_CACHE_VAL(lt_prog_compiler_pic_works,
...): suspicious cache-id, must contain _cv_ to be cached
aclocal.m4:3528: AC_LIBTOOL_COMPILER_OPTION is expanded from...
aclocal.m4:8099: AC_LIBTOOL_PROG_COMPILER_PIC is expanded from...
configure.in:145: warning:
AC_CACHE_VAL(lt_prog_compiler_pic_works_CXX, ...): suspicious
cache-id, must contain _cv_ to be cached
aclocal.m4:6529: _LT_AC_LANG_CXX_CONFIG is expanded from...
aclocal.m4:5585: AC_LIBTOOL_LANG_CXX_CONFIG is expanded from...
aclocal.m4:4717: _LT_AC_TAGCONFIG is expanded from...
building in /var/tmp/pear-build-root/geoip-1.0.7
running: /root/temp/geoip/configure
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for a sed that does not truncate output... /usr/bin/sed
checking for gcc... gcc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables...
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking how to run the C preprocessor... gcc -E
checking for icc... no
checking whether gcc and cc understand -c and -o together... yes
checking for system library directory... lib
checking if compiler supports -R... yes
checking build system type... i386-unknown-openbsd4.5
checking host system type... i386-unknown-openbsd4.5
checking target system type... i386-unknown-openbsd4.5
checking for PHP prefix... /var/www/pear
checking for PHP includes... -I/usr/local/share/php5/include
-I/usr/local/share/php5/include/main
-I/usr/local/share/php5/include/TSRM
-I/usr/local/share/php5/include/Zend
-I/usr/local/share/php5/include/ext
-I/usr/local/share/php5/include/ext/date/lib
checking for PHP extension directory... /var/www/lib/php/modules
checking for PHP installed headers prefix... /usr/local/share/php5/include
checking if debug is enabled... no
checking if zts is enabled... no
checking for re2c... no
configure: WARNING: You will need re2c 0.13.4 or later if you want to
regenerate PHP parsers.
checking for gawk... no
checking for nawk... nawk
checking if nawk is broken... no
checking for geoip support... yes, shared
checking for geoip files in default path... found in /usr/local
checking for GeoIP_open in -lGeoIP... yes
checking for GeoIP_setup_custom_directory in -lGeoIP... yes
checking for GeoIP_set_charset in -lGeoIP... yes
checking for GeoIP_continent_by_id in -lGeoIP... yes
checking for LGPL compatible GeoIP libs... expr: non-numeric argument
cannot detect
checking library features to determine version (not acurate)... found 1004005
checking for ld used by gcc... /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld... yes
checking for /usr/bin/ld option to reload object files... -r
checking for BSD-compatible nm... /usr/bin/nm -B
checking whether ln -s works... yes
checking how to recognise dependent libraries... match_pattern
/lib[^/]+(\.so\.[0-9]+\.[0-9]+|\.so|_pic\.a)$
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking dlfcn.h usability... yes
checking dlfcn.h presence... yes
checking for dlfcn.h... yes
checking the maximum length of command line arguments... 196608
checking command to parse /usr/bin/nm -B output from gcc object... ok
checking for objdir... .libs
checking for ar... ar
checking for ranlib... ranlib
checking for strip... strip
checking if gcc static flag  works... yes
checking if gcc supports -fno-rtti -fno-exceptions... no
checking for gcc option to produce PIC... -fPIC
checking if gcc PIC flag -fPIC works... yes
checking if gcc supports -c -o file.o... yes
checking whether the gcc linker (/usr/bin/ld) supports shared libraries... yes
checking whether -lc should be explicitly linked in... yes
checking dynamic linker characteristics... openbsd4.5 ld.so
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... no

creating libtool
appending configuration tag "CXX" to libtool
configure: creating ./config.status
config.status: creating config.h
running: make
/bin/sh /var/tmp/pear-build-root/geoip-1.0.7/libtool --mode=compile
gcc  -I. -I/root/temp/geoip -DPHP_ATOM_INC
-I/var/tmp/pear-build-root/geoip-1.0.7/include
-I/var/tmp/pear-build-root/geoip-1.0.7/main -I/root/temp/geoip
-I/usr/local/share/php5/include -I/usr/local/share/php5/include/main
-I/usr/local/share/php5/include/TSRM
-I/usr/local/share/php5/include/Zend
-I/usr/local/share/php5/include/ext
-I/usr/local/share/php5/include/ext/date/lib -I/usr/local/include
-I/usr/local/share/php5/include -DHAVE_CONFIG_H  -g -O2   -c
/root/temp/geoip/geoip.c -o geoip.lo
mkdir .libs
 gcc -I. -I/root/temp/geoip -DPHP_ATOM_INC
-I/var/tmp/pear-build-root/geoip-1.0.7/include
-I/var/tmp/pear-build-root/geoip-1.0.7/main -I/root/temp/geoip
-I/usr/local/share/php5/include -I/usr/local/share/php5/include/main
-I/usr/local/share/php5/include/TSRM
-I/usr/local/share/php5/include/Zend
-I/usr/local/share/php5/include/ext
-I/usr/local/share/php5/include/ext/date/lib -I/usr/local/include
-I/usr/local/share/php5/include -DHAVE_CONFIG_H -g -O2 -c
/root/temp/geoip/geoip.c  -fPIC -DPIC -o .libs/geoip.o
/bin/sh /var/tmp/pear-build-root/geoip-1.0.7/libtool --mode=link gcc
-DPHP_ATOM_INC -I/var/tmp/pear-build-root/geoip-1.0.7/include
-I/var/tmp/pear-build-root/geoip-1.0.7/main -I/root/temp/geoip
-I/usr/local/share/php5/include -I/usr/local/share/php5/include/main
-I/usr/local/share/php5/include/TSRM
-I/usr/local/share/php5/include/Zend
-I/usr/local/share/php5/include/ext
-I/usr/local/share/php5/include/ext/date/lib -I/usr/local/include
-I/usr/local/share/php5/include -DHAVE_CONFIG_H  -g -O2   -o
./geoip.la -export-dynamic -avoid-version -prefer-pic -module -rpath
/var/tmp/pear-build-root/geoip-1.0.7/modules  geoip.lo
-R/usr/local/lib -L/usr/local/lib -lGeoIP
gcc -shared  -fPIC -DPIC -o ./.libs/geoip.so  .libs/geoip.o
-L/usr/local/lib -lGeoIP
creating ./geoip.la
(cd ./.libs && rm -f geoip.la && ln -s ../geoip.la geoip.la)
/bin/sh /var/tmp/pear-build-root/geoip-1.0.7/libtool --mode=install cp
./geoip.la /var/tmp/pear-build-root/geoip-1.0.7/modules
cp ./.libs/geoip.so /var/tmp/pear-build-root/geoip-1.0.7/modules/geoip.so
cp ./.libs/geoip.lai /var/tmp/pear-build-root/geoip-1.0.7/modules/geoip.la
PATH="$PATH:/sbin" ldconfig -m /var/tmp/pear-build-root/geoip-1.0.7/modules
----------------------------------------------------------------------
Libraries have been installed in:
   /var/tmp/pear-build-root/geoip-1.0.7/modules

If you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the `-LLIBDIR'
flag during linking and do at least one of the following:
   - add LIBDIR to the `LD_LIBRARY_PATH' environment variable
     during execution
   - use the `-Wl,-rpath,LIBDIR' linker flag

See any operating system documentation about shared libraries for
more information, such as the ld(1) and ld.so(8) manual pages.
----------------------------------------------------------------------

Build complete.
Don't forget to run 'make test'.

running: make INSTALL_ROOT="/var/tmp/pear-build-root/install-geoip-1.0.7"
install
Installing shared extensions:
/var/tmp/pear-build-root/install-geoip-1.0.7/var/www/lib/php/modules/
running: find "/var/tmp/pear-build-root/install-geoip-1.0.7" | xargs ls -dils
831492   4 drwxr-xr-x  3 root  wheel    512 Feb  7 22:06
/var/tmp/pear-build-root/install-geoip-1.0.7
831539   4 drwxr-xr-x  3 root  wheel    512 Feb  7 22:06
/var/tmp/pear-build-root/install-geoip-1.0.7/var
831540   4 drwxr-xr-x  3 root  wheel    512 Feb  7 22:06
/var/tmp/pear-build-root/install-geoip-1.0.7/var/www
831541   4 drwxr-xr-x  3 root  wheel    512 Feb  7 22:06
/var/tmp/pear-build-root/install-geoip-1.0.7/var/www/lib
831542   4 drwxr-xr-x  3 root  wheel    512 Feb  7 22:06
/var/tmp/pear-build-root/install-geoip-1.0.7/var/www/lib/php
831543   4 drwxr-xr-x  2 root  wheel    512 Feb  7 22:06
/var/tmp/pear-build-root/install-geoip-1.0.7/var/www/lib/php/modules
831538 136 -rwxr-xr-x  1 root  wheel  68605 Feb  7 22:06
/var/tmp/pear-build-root/install-geoip-1.0.7/var/www/lib/php/modules/geoip.so

Warning: opendir(/var/tmp/pear-build-root/install-geoip-1.0.7//var/www/pear):
failed to open dir: No such file or directory in PEAR/Builder.php on
line 188

Warning: opendir(/var/tmp/pear-build-root/install-geoip-1.0.7//var/www/pear):
failed to open dir: No such file or directory in
/root/PEAR/PEAR/Builder.php on line 188

Build process completed successfully
install ok: channel://pecl.php.net/geoip-1.0.7
# ls /var/tmp/pear-build-root/install-geoip-1.0.7/var/www/lib/php/modules/
ls: /var/tmp/pear-build-root/install-geoip-1.0.7/var/www/lib/php/modules/:
No such file or directory
#
# find "/var/tmp/pear-build-root/install-geoip-1.0.7" | xargs ls -dils
find: /var/tmp/pear-build-root/install-geoip-1.0.7: No such file or directory
2806282 4 drwxr-xr-x  6 501  501  1024 Feb  7 22:05 .

--- End Message ---
--- Begin Message ---
Op 2/8/10 4:35 AM, David Taveras schreef:
> /root/bin/pecl install geoip

without giving it much thought ... try this:

> sudo /root/bin/pecl install geoip

this is assuming you we're not running the command as root in the first place.


--- End Message ---
--- Begin Message ---
On Sun, Feb 07, 2010 at 11:20:18PM -0500, David Mehler wrote:

> Hello,
> I'm trying to set up a web site. This site has multiple stylesheets,
> one default stylesheet that should be used if the other is not chosen.
> The second is a high contrast stylesheet and can be selected by user's
> who need it. I'm also thinking of adding two more for smaller and
> larger font selections. My issue is I want the high contrast sheet to
> be used on all subsequent pages and on subsequent visits to the site
> by user's who have selected it. I thought of using php with this and
> cookies. I'm using php5 and would appreciate any suggestions, googling
> has shown some examples, but none are working.
> Thanks.
> Dave.

There are two main PHP-centric solutions to this. First is cookies (as
you described) and the second is using the $_SESSION global array.

Doing this is relatively straightforward, so if it's not working for
you, I see two possibilities: 1) You're not actually doing it right. 2)
The users isn't pressing the "Reload" button after selecting the
stylesheet. (My experience has been that simply redisplaying a page will
not clear the cached CSS styles for that page. You must hit the "Reload"
button. In fact, in some cases, like offices with caching webservers or
proxies, an admin will have to be called in to clear the cache on the
proxy/server as well.)

You should be able to do something like this (I'm using SESSION
variables because cookies are more complicated):

<?php
// Top of page
session_start();

if ($_SESSION['stylesheet'] == 'enlarged_print')
        $css = 'enlarged_print.css';
else
        ...

?>
<html>
...
<link href="<?php echo $css; ?>" rel="stylesheet" type="text/css"/>
...
</html>

Paul

-- 
Paul M. Foster

--- End Message ---
--- Begin Message ---
You could use PHP and cookies (session variables are only useful until the 
browser is closed, so it's not as persistant as it sounds like you may 
want).

You could also have a system where users log in and they can save their 
preferences on their user account settings.

What you may also look into is using Javascript (which can also set and 
retrieve cookies) and with a good Javascript library like jQuery, it 
should be relatively easy to dynamically switch style sheets.

Here's an example of a jQuery based stylesheet switcher:
http://www.kelvinluck.com/assets/jquery/styleswitch/toggle.html

Click the styles1, styles2 and styles3 links.


Also, there are JS scripts for adjusting font size, so you may not need a 
completely different stylesheet.  But it would mean having well designed 
HTML that will scale nicely with the font change.   Or you could just 
have a different stylesheet, as you mentioned, so you know it will look 
exactly how you want.  You can see an example of a font size JS here:
http://www.joomla-beez.com/

Keep clicking the links in the upper right and you can continue to increase 
or decrease the size quite a bit, not just one step.


I know this is a PHP list but I think a client side script may work better 
in this case.

-TG

----- Original Message -----
From: David Mehler <dave.meh...@gmail.com>
To: php-gene...@lists.php.net
Date: Sun, 7 Feb 2010 23:20:18 -0500
Subject: [PHP] php selecting multiple stylesheets

> Hello,
> I'm trying to set up a web site. This site has multiple stylesheets,
> one default stylesheet that should be used if the other is not chosen.
> The second is a high contrast stylesheet and can be selected by user's
> who need it. I'm also thinking of adding two more for smaller and
> larger font selections. My issue is I want the high contrast sheet to
> be used on all subsequent pages and on subsequent visits to the site
> by user's who have selected it. I thought of using php with this and
> cookies. I'm using php5 and would appreciate any suggestions, googling
> has shown some examples, but none are working.
> Thanks.
> Dave.
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 

--- End Message ---
--- Begin Message ---
On Sun, 2010-02-07 at 23:45 -0500, Paul M Foster wrote:

> On Sun, Feb 07, 2010 at 11:20:18PM -0500, David Mehler wrote:
> 
> > Hello,
> > I'm trying to set up a web site. This site has multiple stylesheets,
> > one default stylesheet that should be used if the other is not chosen.
> > The second is a high contrast stylesheet and can be selected by user's
> > who need it. I'm also thinking of adding two more for smaller and
> > larger font selections. My issue is I want the high contrast sheet to
> > be used on all subsequent pages and on subsequent visits to the site
> > by user's who have selected it. I thought of using php with this and
> > cookies. I'm using php5 and would appreciate any suggestions, googling
> > has shown some examples, but none are working.
> > Thanks.
> > Dave.
> 
> There are two main PHP-centric solutions to this. First is cookies (as
> you described) and the second is using the $_SESSION global array.
> 
> Doing this is relatively straightforward, so if it's not working for
> you, I see two possibilities: 1) You're not actually doing it right. 2)
> The users isn't pressing the "Reload" button after selecting the
> stylesheet. (My experience has been that simply redisplaying a page will
> not clear the cached CSS styles for that page. You must hit the "Reload"
> button. In fact, in some cases, like offices with caching webservers or
> proxies, an admin will have to be called in to clear the cache on the
> proxy/server as well.)
> 
> You should be able to do something like this (I'm using SESSION
> variables because cookies are more complicated):
> 
> <?php
> // Top of page
> session_start();
> 
> if ($_SESSION['stylesheet'] == 'enlarged_print')
>       $css = 'enlarged_print.css';
> else
>       ...
> 
> ?>
> <html>
> ...
> <link href="<?php echo $css; ?>" rel="stylesheet" type="text/css"/>
> ...
> </html>
> 
> Paul
> 
> -- 
> Paul M. Foster
> 


I'm doing this on my own site, and it works like this:

The stylesheets are output in <a> tags, so that a user can click on one
to select a style, refreshing the page.

In the header include, I check first to see if a new style was sent in
the $_GET array, then the $_SESSION array, then finally to see if there
is a stylesheet entry in the $_COOKIES array. If none is found, a
default is assumed, and I write this value to both the $_SESSION and
$_COOKIES array. By checking them in the order above, it lets a user
pick a new one from a link, and will remember their choice throughout
their current session and any subsequent visits to the site.

As all the stylesheets are included in the pages with the correct <link>
tags anyway, anyone with a compatible browser (Firefox, Opera, etc) can
select the style from a drop menu directly in the browser, although it's
better to use the links, as the browser doesn't remember the choice from
page to page.

Thanks,
Ash
http://www.ashleysheridan.co.uk



--- End Message ---
--- Begin Message ---
On Sun, Feb 07, 2010 at 11:20:18PM -0500, David Mehler wrote:
> Hello,
> I'm trying to set up a web site. This site has multiple stylesheets,
> one default stylesheet that should be used if the other is not chosen.
> The second is a high contrast stylesheet and can be selected by user's
> who need it. I'm also thinking of adding two more for smaller and
> larger font selections. My issue is I want the high contrast sheet to
> be used on all subsequent pages and on subsequent visits to the site
> by user's who have selected it. I thought of using php with this and
> cookies. I'm using php5 and would appreciate any suggestions, googling
> has shown some examples, but none are working.


in CSS there is also the concept of 'alternate stylesheets' build in. A page can
basically specify as many stylesheets as it wants where one is default and all 
others are 'alternate'. The browser will then offer menu entries for the user 
to choose from. Ie in firefox you can choose the style from the menu at: View 
-> Page Style -> ...

Here's how it works in detail: 
http://www.w3.org/Style/Examples/007/alternatives (note that this site also has 
alternate styles available)

PHP could be used to define the default style sheet on a per user/application 
setting basis...

stephan



--- End Message ---
--- Begin Message ---
On Mon, 2010-02-08 at 11:18 +0100, Stephan Ebelt wrote:

> On Sun, Feb 07, 2010 at 11:20:18PM -0500, David Mehler wrote:
> > Hello,
> > I'm trying to set up a web site. This site has multiple stylesheets,
> > one default stylesheet that should be used if the other is not chosen.
> > The second is a high contrast stylesheet and can be selected by user's
> > who need it. I'm also thinking of adding two more for smaller and
> > larger font selections. My issue is I want the high contrast sheet to
> > be used on all subsequent pages and on subsequent visits to the site
> > by user's who have selected it. I thought of using php with this and
> > cookies. I'm using php5 and would appreciate any suggestions, googling
> > has shown some examples, but none are working.
> 
> 
> in CSS there is also the concept of 'alternate stylesheets' build in. A page 
> can
> basically specify as many stylesheets as it wants where one is default and 
> all others are 'alternate'. The browser will then offer menu entries for the 
> user to choose from. Ie in firefox you can choose the style from the menu at: 
> View -> Page Style -> ...
> 
> Here's how it works in detail: 
> http://www.w3.org/Style/Examples/007/alternatives (note that this site also 
> has alternate styles available)
> 
> PHP could be used to define the default style sheet on a per user/application 
> setting basis...
> 
> stephan
> 
> 
> 


The only problem relying only on this method is that not all browsers
are compatible with it, and of those that are, none remember the choice
a user makes from page to page, so they'd have to reselect it upon each
page visit

Thanks,
Ash
http://www.ashleysheridan.co.uk



--- End Message ---
--- Begin Message ---
TG wrote:
You could use PHP and cookies (session variables are only useful until the browser is closed, so it's not as persistant as it sounds like you may want).

Persistent sessions are possible.

The way I'm doing it in the CMS I am working on is via GET which saves selection in session.

I can't use a selector because I tailor the web page to the style sheet and some of them require different page design (IE search bar in aside opposed to header)

I don't use persistent sessions, but session is kept in cookie and you can configure it to be a persistent cookie if you want.
--- End Message ---
--- Begin Message ---


On 2/7/2010 11:20 PM, David Mehler wrote:
Hello,
I'm trying to set up a web site. This site has multiple stylesheets,
one default stylesheet that should be used if the other is not chosen.
The second is a high contrast stylesheet and can be selected by user's
who need it. I'm also thinking of adding two more for smaller and
larger font selections. My issue is I want the high contrast sheet to
be used on all subsequent pages and on subsequent visits to the site
by user's who have selected it. I thought of using php with this and
cookies. I'm using php5 and would appreciate any suggestions, googling
has shown some examples, but none are working.
Thanks.
Dave.

Dealing with style sheet caching by all the different browsers and the user's settings for them is the big problem.

I'd suggest this: Use the sessions buffer for simplicity. And, link your complete [all the selectors] default css file in the header.

Then, include ONLY the selectors needed to render the special selectors in the html's header style block. These selectors will override those in the css file.

Now, simply modify the selectors here when you return the page. Far as I know, all browsers honor revised styles when they are in the page html header.
<header> <style type="text/css">
<!--
special selectors go here
-->
</style>
</header>

--- End Message ---
--- Begin Message ---
At 11:20 PM -0500 2/7/10, David Mehler wrote:
Hello,
I'm trying to set up a web site. This site has multiple stylesheets,
one default stylesheet that should be used if the other is not chosen.
The second is a high contrast stylesheet and can be selected by user's
who need it. I'm also thinking of adding two more for smaller and
larger font selections. My issue is I want the high contrast sheet to
be used on all subsequent pages and on subsequent visits to the site
by user's who have selected it. I thought of using php with this and
cookies. I'm using php5 and would appreciate any suggestions, googling
has shown some examples, but none are working.
Thanks.
Dave.

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


Try this:

http://sperling.com/examples/styleswitch1/

As far as zooming text size, most browsers are capable of this. Just make your site zoom-cooperative, such as:

http://sperling.com/examples/zoom/

As far as making things high contrast, why not choose colors that are right the first time? Try this:

http://webbytedd.com/c/access-color/

As far as making all of this persistent, look to using Cookies.

Cheers,

tedd
--
-------
http://sperling.com  http://ancientstones.com  http://earthstones.com

--- End Message ---
--- Begin Message ---
On Mon, 2010-02-08 at 10:00 -0500, tedd wrote:

> At 11:20 PM -0500 2/7/10, David Mehler wrote:
> >Hello,
> >I'm trying to set up a web site. This site has multiple stylesheets,
> >one default stylesheet that should be used if the other is not chosen.
> >The second is a high contrast stylesheet and can be selected by user's
> >who need it. I'm also thinking of adding two more for smaller and
> >larger font selections. My issue is I want the high contrast sheet to
> >be used on all subsequent pages and on subsequent visits to the site
> >by user's who have selected it. I thought of using php with this and
> >cookies. I'm using php5 and would appreciate any suggestions, googling
> >has shown some examples, but none are working.
> >Thanks.
> >Dave.
> >
> >--
> >PHP General Mailing List (http://www.php.net/)
> >To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 
> Try this:
> 
> http://sperling.com/examples/styleswitch1/
> 
> As far as zooming text size, most browsers are capable of this. Just 
> make your site zoom-cooperative, such as:
> 
> http://sperling.com/examples/zoom/
> 
> As far as making things high contrast, why not choose colors that are 
> right the first time? Try this:
> 
> http://webbytedd.com/c/access-color/
> 
> As far as making all of this persistent, look to using Cookies.
> 
> Cheers,
> 
> tedd
> -- 
> -------
> http://sperling.com  http://ancientstones.com  http://earthstones.com
> 


There is a good reason for having different stylesheets that use
differing colour systems. For example, some people with learning
difficulties benefit from yellow text on blue backgrounds, as apparently
those colours together are better at capturing a users attention for
longer durations. This is often coupled with other layout changes such
as narrower width text blocks to aid readability.

Thanks,
Ash
http://www.ashleysheridan.co.uk



--- End Message ---
--- Begin Message ---
Ashley Sheridan wrote:



There is a good reason for having different stylesheets that use
differing colour systems. For example, some people with learning
difficulties benefit from yellow text on blue backgrounds, as apparently
those colours together are better at capturing a users attention for
longer durations. This is often coupled with other layout changes such
as narrower width text blocks to aid readability.

It's also not a bad idea to have a layout designed for small computer screens, 1024x is what most of my style sheets are designed for but one is designed for 800x.

There are still some people with small displays, and horizontal scrolling really sucks.
--- End Message ---
--- Begin Message ---
Hi Carlos

I looked at the documentation for hours but don't see any solution. I'm
uploading a sample file here. The full file contains around 100 properties
but the uploaded file has just one. I need to extract data from this file to
write to a MySQL database. I have no problem in doing this until it comes to
the <elements>-><element> tags. I only need 3 of these elements. I can
extract the data by iteration but that does not help me to get the three
specific <element> tags that I need because there are some tags that appear
for some properties and not for others so the order is different. Here is
the file:
http://old.nabble.com/file/p27496211/annnonces.xml annnonces.xml 
Thanks
Terry



-- 
View this message in context: 
http://old.nabble.com/simplexml---can-it-do-what-I-need--tp27481222p27496211.html
Sent from the PHP - General mailing list archive at Nabble.com.


--- End Message ---
--- Begin Message ---
On Sun, 2010-02-07 at 23:24 -0800, TerryA wrote:

> Hi Carlos
> 
> I looked at the documentation for hours but don't see any solution. I'm
> uploading a sample file here. The full file contains around 100 properties
> but the uploaded file has just one. I need to extract data from this file to
> write to a MySQL database. I have no problem in doing this until it comes to
> the <elements>-><element> tags. I only need 3 of these elements. I can
> extract the data by iteration but that does not help me to get the three
> specific <element> tags that I need because there are some tags that appear
> for some properties and not for others so the order is different. Here is
> the file:
> http://old.nabble.com/file/p27496211/annnonces.xml annnonces.xml 
> Thanks
> Terry
> 
> 
> 
> -- 
> View this message in context: 
> http://old.nabble.com/simplexml---can-it-do-what-I-need--tp27481222p27496211.html
> Sent from the PHP - General mailing list archive at Nabble.com.
> 
> 


As you iterate the <elements> tags, check their attributes with
getAttribute().

Thanks,
Ash
http://www.ashleysheridan.co.uk



--- End Message ---
--- Begin Message ---
Hi Guys

Thanks for all your input. This forum is great! I can get the attributes OK
but I can't code the checking routing correctly. This is what I have:

Many thanks again for your input. I tried this but it only gives me the data
for each element. I need to be able to access the attributes of the data in
order to select only those elements that I need. This is the code that I
have at present:

<?php
$file= 'annnonces.xml';
// load file
$xml = simplexml_load_file($file) or die ("Unable to load XML file!");
foreach ($xml->xpath('//lot') as $lot) {
    echo $lot->numero_lot, 'type ', $lot->type, $lot->identification, '<br
/>';
    echo 'Prix maxi: ', $lot->tarif_max, ' Prix mini: ', $lot->tarif_min,
'<br />';
    foreach( $lot->elements->element as $key => $data ){
            $result=((string) $data->attributes());
            if ($result='17') {
                  echo $data;
            }
    }
}
?>

But this just gives the data for every element. Any ideas on how to get just
the data for the element when the attribute is 17?

Terry
-- 
View this message in context: 
http://old.nabble.com/simplexml---can-it-do-what-I-need--tp27481222p27496987.html
Sent from the PHP - General mailing list archive at Nabble.com.


--- End Message ---
--- Begin Message ---
Got it! I corrected my syntax and this code now works as far as I can tell:

<?php
$file= 'annnonces.xml';
// load file
$xml = simplexml_load_file($file) or die ("Unable to load XML file!");
foreach ($xml->xpath('//lot') as $lot) {
    echo $lot->numero_lot, 'type ', $lot->type, $lot->identification, '<br
/>';
    echo 'Prix maxi: ', $lot->tarif_max, ' Prix mini: ', $lot->tarif_min,
'<br />';
        foreach( $lot->elements->element as $key => $data ){
                        $result=((string) $data->attributes());
                        if ($result == "1") {
                        echo "Nombre pièces: ", $data, '<br />';
                        }
                        if ($result == "3") {
                        echo "Surface: ", $data, "m2", '<br />';
                        }
                        if ($result == "7") {
                        echo "Nombre étoiles: ", $data, '<br />';
                                break;
                        }
        }
}
?>

Output is:
201type APPARTEMENT STUDIOTEE2 106
Prix maxi: 475 Prix mini: 475
Nombre pièces: 1
Surface: 27m2
Nombre étoiles: 3

Hooray and thanks to all of you guys.

Terry
-- 
View this message in context: 
http://old.nabble.com/simplexml---can-it-do-what-I-need--tp27481222p27500759.html
Sent from the PHP - General mailing list archive at Nabble.com.


--- End Message ---
--- Begin Message ---
It was a mistake while copying the code. I had '\n' only.



On Sun, 07 Feb 2010 21:31:55 +0530  wrote

>Phani Raju wrote:



> I am trying to open a blocking stream using fsockopen. I want to write and 
> read XML input/output from a server. After opening the steam I will send a 
> XML request to server using the stream. Once this request is sent, I want to 
> keep listening on the port indefinitely.



> 



> I tried using blocking stream for this with a huge timeout. But had no 
> success as it was not waiting for such a long period.



> 



> Code:



> $parser = xml_parser_create("UTF-8");



> if($stream = @fsockopen($host, $port, $errorno, $errorstr, $timeout)) {



> stream_set_blocking($stream, 1);



> stream_set_timeout($stream, TIMEOUT);



> fwrite($stream, $xml."n");







fwrite($stream, $xml."n") should probably be fwrite($stream, $xml."\n") ?




--- End Message ---
--- Begin Message ---
hello,
      Hi ryan, i am not sure i am getting you on what ya want , is this
something like what ya want, the code below which i wrote?

function get_value()
{
var el = document.form_name.elements.length;
for(var i =0 ; i<= el ; i++)
{
if(document.form_name.elements[i].type="checkbox")
{
var id = document.form_name.elements[i].getAttribute("id");
var name = document.form_name.elements[i].getAttribute("name");
var functions =
document.form_name.elements[i].getAttribute("onsomething");
var full_field = ("you can join all 3 ^^ values to make the full code
and pass that to php script via ajax , Other methods are welcome too ');

}
}
}  

Regards,
Gautam Bhatia

On Sat, 2010-02-06 at 07:41 -0800, Ryan S wrote: 
> Hey guys,
> 
> As many of you might know, i totally suck at regex..so would really 
> appreciate some help here.
> 
> Basically i have a html page with a lot of textboxes,radios,checkboxes etc 
> i need your help in the form of a regex so that when i give it the name and 
> value it gives me the entire code of that checkbox.
> for example here are 2 checkboxes:
> 
> <input type="checkbox" name="something" value="1" />
> 
> <input
> type="checkbox" name="something2" value="2" id="something"
> onClick="javascript_code_etc()" onSomething="lots of js cod here()"
> />
> 
> 
> 
> so if i want the second checkbox code i was thinking of something like this:
> 
> $the_name="something2";
> $the_value="2";
> $fetched=getCheckboxFromHTML($the_name,$the_value);
> 
> and then if successful the variable $fetched would contain
> <input
> type="checkbox" name="something2" value="2" id="something"
> onClick="javascript_code_etc()" onSomething="lots of js cod here()"
> />
> 
> the idea is that i would use the contents of $fetch to add
> some code before the end just before  the greater than symbol, and do a
> str_replace().
> 
> What do you think? Critique of my logic above too is welcome!
> 
> Thanks!
> Ryan
> 
> 
> 
>       
> 



--- End Message ---

Reply via email to