php-general Digest 8 Jul 2007 07:00:55 -0000 Issue 4891

2007-07-08 Thread php-general-digest-help

php-general Digest 8 Jul 2007 07:00:55 - Issue 4891

Topics (messages 258461 through 258465):

Re: About PHP CMS
258461 by: Nathan Nobbe
258462 by: Nathan Nobbe
258463 by: Nathan Nobbe
258464 by: Anton C. Swartz IV

About DOM function in PHP
258465 by: Kelvin Park

Administrivia:

To subscribe to the digest, e-mail:
[EMAIL PROTECTED]

To unsubscribe from the digest, e-mail:
[EMAIL PROTECTED]

To post to the list, e-mail:
[EMAIL PROTECTED]


--
---BeginMessage---

forgot to copy the list on this one, sorry

-- Forwarded message --
From: Nathan Nobbe [EMAIL PROTECTED]
Date: Jul 7, 2007 2:13 PM
Subject: Re: [PHP] About PHP CMS
To: Kelvin Park [EMAIL PROTECTED]


On 7/7/07, Kelvin Park [EMAIL PROTECTED] wrote:
Can XSLT be used to separate CSS/XHTML/PHP/AJAX completely?

yes

XSLT is used to map one set of XML to another set of XML, thats what the
transform is all about.
ive only been working with it for a while so im not that good yet, but what
i do is build up XML data in
PHP; that XML maps to points in an xsl file.  then i use the PHP XSLT
functions http://www.php.net/manual/en/ref.xslt.php to render XHTML
by combining the XML data and the xsl file.  the XHTML is what gets sent to
the browser via echo.
you can use tools in PHP like SimpleXML and DOM to build up an XML
document.  i can send you a sample
if youd like.

also, if you want to separate javascript from PHP and XHTML thats really a
different issue.  in order to do that
you need to link in javascript externally via the script tag instead of
using inline scripts.  you may want to
look at some frameworks like prototype http://www.prototypejs.org/,
scriptaculous http://script.aculo.us/ and jquery http://jquery.com/.
but that is another universe altogether.

-nathan


On 7/7/07, Kelvin Park  [EMAIL PROTECTED] wrote:


Can XSLT be used to separate CSS/XHTML/PHP/AJAX completely?
Do you use XSLT with XHTML on a same file?
It seems like XSLT is derived from XML.

On 7/7/07, Nathan Nobbe [EMAIL PROTECTED] wrote:

 to keep html separate from php you can also look at XSLT.
 ive heard good and bad things about smarty.

 -nathan

 On 7/6/07, Davi  [EMAIL PROTECTED]  wrote:
 
  Em Sexta 06 Julho 2007 21:24, Kelvin Park escreveu:
   Is it possible to have PHP code completely separate from the HTML
 page
  that
   needs to be completely dynamic? (That's how ASP.NET sort of works I
  think).
   If this is possible, HTML CODE, PHP CODE, AND THE CSS CODE can be
   completely separate, increasing the clarity of all the source code.
  
  Yes.
  Take a look at Smarty. :-)
 
  http://smarty.php.net
 
   My second question is:
   Is it more efficient to always code OOP PHP then just simple
 functions
  here
   and there?
 
  How big is your project?
  If you're talking about a personal visit counter, run away
 OOP.
  If you're talking about a really big project (And yes, CMS
 _is_ a
  big
  project), go ahead and use OOP.
 
  OOP is better to mantain... :-)
 
  HTH
 
  --
  Davi Vidal
  [EMAIL PROTECTED]
  [EMAIL PROTECTED]
  --
  Religion, ideology, resources, land,
  spite, love or just because...
  No matter how pathetic the reason,
  it's enough to start a war. 
  
  Por favor não faça top-posting, coloque a sua resposta abaixo desta
 linha.
  Please don't do top-posting, put your reply below the following line.
  
 
 



---End Message---
---BeginMessage---

kelvin,

here is the example:
catalog.php
?php
$doc = new DOMDocument();
$xsl = new XSLTProcessor();
$doc-load('catalog.xsl');
$xsl-importStyleSheet($doc);
$doc-load('catalog.xml');
echo $xsl-transformToXML($doc);
?

catalog.xml
?xml version=1.0 encoding=ISO-8859-1?
?xml-stylesheet type=text/xsl href=catalog.xsl?
catalog
cd
titleEmpire Burlesque/title
artistBob Dylan/artist
countryUSA/country
companyColumbia/company
price10.90/price
year1985/year
/cd
/catalog

catalog.xsl
?xml version=1.0 encoding=ISO-8859-1?
xsl:stylesheet version=1.0
xmlns:xsl=http://www.w3.org/1999/XSL/Transform;
xsl:template match=/

html
body
h2My CD Collection/h2
table border=1
tr bgcolor=#9acd32
th align=leftTitle/th
th align=leftArtist/th
/tr
xsl:for-each select=catalog/cd
tr
tdxsl:value-of select=title //td
tdxsl:value-of select=artist //td
/tr
/xsl:for-each
/table
/body
/html
/xsl:template
/xsl:stylesheet


in this example the xml data is imported from a file rather than built in
memory.  also, i would like to mention that most browsers, ie, firefox and
opera namely can render the xhtml themselves given the xml and xsl files
which is something you may want to consider.

-nathan


On 7/6/07, Kelvin Park [EMAIL PROTECTED] wrote:


Is it possible to have PHP code completely separate from the HTML page
that
needs to be 

[PHP] About DOM function in PHP

2007-07-08 Thread Kelvin Park

I'm getting the following fatal error message:

*Fatal error*: Cannot instantiate non-existent class: domdocument in *
/home/hosting/infotechnow_com/htdocs/admin/inventory/catalog.php* on line *3
*
when running this code:

// Initialize new object for DOMDocument
$doc = new DOMDocument();

What's the problem?
**


[PHP] Re: About DOM function in PHP

2007-07-08 Thread M. Sokolewicz

Kelvin Park wrote:

I'm getting the following fatal error message:

*Fatal error*: Cannot instantiate non-existent class: domdocument in *
/home/hosting/infotechnow_com/htdocs/admin/inventory/catalog.php* on 
line *3

*
when running this code:

// Initialize new object for DOMDocument
$doc = new DOMDocument();

What's the problem?
**



You don't have the DOM extension installed (req. PHP5 in case you're not 
running that either)... seems pretty obvious to me :)


www.php.net/dom

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



Re: [PHP] About DOM function in PHP

2007-07-08 Thread Tijnema

On 7/8/07, Kelvin Park [EMAIL PROTECTED] wrote:

I'm getting the following fatal error message:

*Fatal error*: Cannot instantiate non-existent class: domdocument in *
/home/hosting/infotechnow_com/htdocs/admin/inventory/catalog.php* on line *3
*
when running this code:

// Initialize new object for DOMDocument
$doc = new DOMDocument();

What's the problem?
**


Which PHP version are you using?

from the manual[1]:
The DOM extension allows you to operate on XML documents through the
DOM API with PHP 5.

For PHP 4, use DOM XML. 

Tijnema

[1] http://www.php.net/manual/en/ref.dom.php

--
Vote for PHP Color Coding in Gmail! - http://gpcc.tijnema.info

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



[PHP] How would i construct a date from year/week?

2007-07-08 Thread Søren Neigaard

Hi wizards

Do any of you have a good solution for me here. I would like to  
browse between weeks, and then based on the week and year construct a  
full date on the monday of that week.


How on earth would I do this? How can I construct a date only given a  
year and a week number?


I hope you guys can help me here, as I have absolutely NO idea :)

Best regards
Søren

smime.p7s
Description: S/MIME cryptographic signature


RE: [PHP] How would i construct a date from year/week?

2007-07-08 Thread Chris Boget
 How on earth would I do this? How can I 
 construct a date only given a year and a 
 week number?
 I hope you guys can help me here, as I 
 have absolutely NO idea :)

// whatever week number you are working with; arbitrary value here
$weekNumber = 37; 

// seconds * minutes * hours;
$day = 60 * 60 * 24; 

// days in a week
$week = 7; 

// get the unix time for Jan 1 of this year
$firstDayOfThisYear = mktime( 0, 0, 0, 1, 1, date( 'Y' ));

// calculate the unix time for the date of the week number
$weekNumberDate = $firstDayOfYear + ( $weekNumber * day * week );

// This will put you X weeks out of the day that Jan 1 fell on.
// If Jan 1 was on a Thursday, this date should also be on a Thursday.
// Using date( 'N', $weekNumberDate ), you can find out how many days
// you need to subtract to get your Monday date
echo date( 'm/d/Y', $weekNumberDate );

thnx,
Chris

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



Re: [PHP] Where does PHP look for php.ini??

2007-07-08 Thread Nathan Nobbe

On 7/6/07, Tijnema [EMAIL PROTECTED] wrote:
Completely missed it LOL, it looks for it in /usr/lib :S
Is that normal?


i beleive it depends on the OS/distribution.  on gentoo php.ini is located
at
/etc/php/apache2-php5
Here is a bit of output from phpinfo() on a gentoo box of mine [w/ no
changes to php.ini]

Configuration File (php.ini) Path /etc/php/apache2-php5
Loaded Configuration File /etc/php/apache2-php5/php.ini
Scan this dir for additional .ini files /etc/php/apache2-php5/ext-active
additional .ini files parsed /etc/php/apache2-php5/ext-active/http.ini,
/etc/php/apache2-php5/ext-active/mcve.ini,
/etc/php/apache2-php5/ext-active/memcache.ini

-nathan

On 7/6/07, Tijnema [EMAIL PROTECTED] wrote:


On 7/7/07, Stut [EMAIL PROTECTED] wrote:
 Tijnema wrote:
  I just noted that my php (CLI and Apache2 SAPI) doesn't read my
php.ini
  in /etc
  I have compiled php with --prefix=/usr, and my /usr/etc is symlinked
  to /etc, but it doesn't read the php.ini file..
  when I use the CLI with -c /etc it works fine :)

 php -i on the command line, or phpinfo() in a SAPI script will tell you
 where it expects to find it, as well as whether it did find it.

 -Stut

Completely missed it LOL, it looks for it in /usr/lib :S
Is that normal?

Tijnema


--
Vote for PHP Color Coding in Gmail! - http://gpcc.tijnema.info

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




Re: [PHP] Re: About DOM function in PHP

2007-07-08 Thread Nathan Nobbe

On 7/8/07, M. Sokolewicz [EMAIL PROTECTED] wrote:
You don't have the DOM extension installed (req. PHP5 in case you're not


There is no DOM extension it is part of the PHP5 core; this from the DOM
documantation http://www.php.net/manual/en/ref.dom.php in
the online handbook:

*Installation
There is no installation needed to use these functions; they are part of the
PHP core.*

This leads me to beleive OP is using PHP4.  Kelvin, create a phpinfo()
script to determine
if youre running PHP4 or PHP5.

-nathan


On 7/8/07, M. Sokolewicz [EMAIL PROTECTED] wrote:


Kelvin Park wrote:
 I'm getting the following fatal error message:

 *Fatal error*: Cannot instantiate non-existent class: domdocument in *
 /home/hosting/infotechnow_com/htdocs/admin/inventory/catalog.php* on
 line *3
 *
 when running this code:

 // Initialize new object for DOMDocument
 $doc = new DOMDocument();

 What's the problem?
 **


You don't have the DOM extension installed (req. PHP5 in case you're not
running that either)... seems pretty obvious to me :)

www.php.net/dom

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




Re: [PHP] Re: About DOM function in PHP

2007-07-08 Thread M. Sokolewicz

Actually, I'll have to correct you on that.

Everything in PHP is an extension, even the standard functions (which 
are part of the 'standard' extension). Some extensions are built-in 
while others are not (ie. standard, in PHP5, the DOM module is 
built-in). However, this does not mean they are also enabled! There are 
hosts which build php with --disable-dom, there are also hosts which 
build php with --disable-libxml thus disabling all xml-related 
functionality.


- Tul

Nathan Nobbe wrote:

On 7/8/07, M. Sokolewicz [EMAIL PROTECTED] wrote:
You don't have the DOM extension installed (req. PHP5 in case you're not


There is no DOM extension it is part of the PHP5 core; this from the DOM
documantation http://www.php.net/manual/en/ref.dom.php in
the online handbook:

*Installation
There is no installation needed to use these functions; they are part of 
the

PHP core.*

This leads me to beleive OP is using PHP4.  Kelvin, create a phpinfo()
script to determine
if youre running PHP4 or PHP5.

-nathan


On 7/8/07, M. Sokolewicz [EMAIL PROTECTED] wrote:


Kelvin Park wrote:
 I'm getting the following fatal error message:

 *Fatal error*: Cannot instantiate non-existent class: domdocument in *
 /home/hosting/infotechnow_com/htdocs/admin/inventory/catalog.php* on
 line *3
 *
 when running this code:

 // Initialize new object for DOMDocument
 $doc = new DOMDocument();

 What's the problem?
 **


You don't have the DOM extension installed (req. PHP5 in case you're not
running that either)... seems pretty obvious to me :)

www.php.net/dom

--


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



Re: [PHP] Re: About DOM function in PHP

2007-07-08 Thread Nathan Nobbe

My appologies M.
looking through the output of phpinfo() on a PHP5 install i have found a
line which says

dom
  DOM/XML  enabled

which would allude to an ability to disable it.  also, i was looking at the
XSL extension and discovered

Installation
PHP 5 includes the XSL extension by default and can be enabled by adding the
argument --with-xsl[=DIR] to your configure line. DIR is the libxslt
installation directory.

so the XSL extension seems to work differently
than XML extension.  both extensions are availble with the PHP5 core
but where DOM is enabled by default XSL must be explicitly enabled.
is there a portion of the documentation that you are aware of that clearly
explains this?  enabling and disabling core extensions..

thanks,

-nathan


On 7/8/07, M. Sokolewicz [EMAIL PROTECTED] wrote:


Actually, I'll have to correct you on that.

Everything in PHP is an extension, even the standard functions (which
are part of the 'standard' extension). Some extensions are built-in
while others are not (ie. standard, in PHP5, the DOM module is
built-in). However, this does not mean they are also enabled! There are
hosts which build php with --disable-dom, there are also hosts which
build php with --disable-libxml thus disabling all xml-related
functionality.

- Tul

Nathan Nobbe wrote:
 On 7/8/07, M. Sokolewicz [EMAIL PROTECTED] wrote:
 You don't have the DOM extension installed (req. PHP5 in case you're
not

 There is no DOM extension it is part of the PHP5 core; this from the DOM
 documantation http://www.php.net/manual/en/ref.dom.php in
 the online handbook:

 *Installation
 There is no installation needed to use these functions; they are part of
 the
 PHP core.*

 This leads me to beleive OP is using PHP4.  Kelvin, create a phpinfo()
 script to determine
 if youre running PHP4 or PHP5.

 -nathan


 On 7/8/07, M. Sokolewicz [EMAIL PROTECTED] wrote:

 Kelvin Park wrote:
  I'm getting the following fatal error message:
 
  *Fatal error*: Cannot instantiate non-existent class: domdocument in
*
  /home/hosting/infotechnow_com/htdocs/admin/inventory/catalog.php* on
  line *3
  *
  when running this code:
 
  // Initialize new object for DOMDocument
  $doc = new DOMDocument();
 
  What's the problem?
  **
 

 You don't have the DOM extension installed (req. PHP5 in case you're
not
 running that either)... seems pretty obvious to me :)

 www.php.net/dom

 --





Re: [PHP] Where does PHP look for php.ini??

2007-07-08 Thread Mario Guenterberg
On Sat, Jul 07, 2007 at 02:08:21AM +0200, Tijnema wrote:
  Hi,
 
  I just noted that my php (CLI and Apache2 SAPI) doesn't read my php.ini in 
  /etc
  I have compiled php with --prefix=/usr, and my /usr/etc is symlinked
  to /etc, but it doesn't read the php.ini file..
  when I use the CLI with -c /etc it works fine :)
 
Hi...

you can use the configure parameter --with-config-file-path.

Greetings
Mario
-- 
 -
| havelsoft.com - Ihr Service Partner für Open Source |
| Tel:  033876-21 966 |
| Notruf: 0173-277 33 60  |
| http://www.havelsoft.com|
| |
| Inhaber: Mario Günterberg   |
| Mützlitzer Strasse 19   |
| 14715 Märkisch Luch |
 -


pgpxq2gntGTLy.pgp
Description: PGP signature


Re: [PHP] About PHP CMS

2007-07-08 Thread tedd

At 8:24 PM -0400 7/7/07, Nathan Nobbe wrote:

kelvin,

here is the example:
catalog.php
?php
$doc = new DOMDocument();
$xsl = new XSLTProcessor();
$doc-load('catalog.xsl');
$xsl-importStyleSheet($doc);
$doc-load('catalog.xml');
echo $xsl-transformToXML($doc);
?

catalog.xml
?xml version=1.0 encoding=ISO-8859-1?
?xml-stylesheet type=text/xsl href=catalog.xsl?
catalog
cd
titleEmpire Burlesque/title
artistBob Dylan/artist
countryUSA/country
companyColumbia/company
price10.90/price
year1985/year
/cd
/catalog

catalog.xsl
?xml version=1.0 encoding=ISO-8859-1?
xsl:stylesheet version=1.0
xmlns:xsl=http://www.w3.org/1999/XSL/Transform;
xsl:template match=/

html
body
h2My CD Collection/h2
table border=1
tr bgcolor=#9acd32
th align=leftTitle/th
th align=leftArtist/th
/tr
xsl:for-each select=catalog/cd
tr
tdxsl:value-of select=title //td
tdxsl:value-of select=artist //td
/tr
/xsl:for-each
/table
/body
/html
/xsl:template
/xsl:stylesheet


in this example the xml data is imported from a file rather than built in
memory.  also, i would like to mention that most browsers, ie, firefox and
opera namely can render the xhtml themselves given the xml and xsl files
which is something you may want to consider.

-nathan



Nice example.

Now, get it to validate and remove the styling attributes.

Cheers,

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

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



[PHP] Anyone recommend a great phpmysql knowledge base?

2007-07-08 Thread Graham Anderson
Does anyone have a positive experience with an 'out of the box'  
Knowledge Base system (hopefully open-source)  that easily allows  
developers to easily share/post/publish/document their code?


I know this question is a a bit general, but I figure a lot of you  
guys are on such a system at work. Hopefully, there are some good/ 
flexible solutions out there that will prevent me from reinventing  
the wheel.


Many thanks in advance :)

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



[PHP] Re: Anyone recommend a great phpmysql knowledge base?

2007-07-08 Thread Al

Search  http://sourceforge.net/softwaremap/index.php There are dozens.

Graham Anderson wrote:
Does anyone have a positive experience with an 'out of the box' 
Knowledge Base system (hopefully open-source)  that easily allows 
developers to easily share/post/publish/document their code?


I know this question is a a bit general, but I figure a lot of you guys 
are on such a system at work. Hopefully, there are some good/flexible 
solutions out there that will prevent me from reinventing the wheel.


Many thanks in advance :)


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



[PHP] triming utf8 (?) a string

2007-07-08 Thread Rick Pasotto
I'm using the PEAR Crypt_Blowfish module. When I decrypt the encrypted
string the result is the original plus some '\ufffd' bytes. How can I
get rid of those extra bytes? I've tried both trim($x,'\ufffd') and
trim($x,utf8_decode('\ufffd')).

-- 
Economics is extremely useful as a form of employment for economists.
-- John Kenneth Galbraith
Rick Pasotto[EMAIL PROTECTED]http://www.niof.net

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



Re: [PHP] triming utf8 (?) a string

2007-07-08 Thread Jim Lucas

Rick Pasotto wrote:

I'm using the PEAR Crypt_Blowfish module. When I decrypt the encrypted
string the result is the original plus some '\ufffd' bytes. How can I
get rid of those extra bytes? I've tried both trim($x,'\ufffd') and
trim($x,utf8_decode('\ufffd')).


trim() is meant to remove chars from the beginning and ending of a string.

http://us2.php.net/str_replace is meant to remove a set of chars from a 
string. Anywhere within the string.



--
Jim Lucas

   Some men are born to greatness, some achieve greatness,
   and some have greatness thrust upon them.

Twelfth Night, Act II, Scene V
by William Shakespeare

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



Re: [PHP] Calendar booking form in PHP/MySQL

2007-07-08 Thread Zareef Ahmed

Hi Murphy,
I think till now you got the idea why you did't got replies for query.
Please do a simple google search and you will find something. using
sourceforge is also good idea.

People are here to solve and discuss the programming problems of each
others, NOT to do work for each other  :)

Zareef Ahmed

On 7/3/07, Timothy Murphy [EMAIL PROTECTED] wrote:


I'm looking for a PHP/MySQL calendar booking form,
which I am sure must have been done a million times.

This will show a calendar on the web mirroring a MySQL table.
Each entry in the MySQL table will show two dates, Start and End.
The dates between these should be shown in red on the calendar.

Any pointers or scipts or suggestions gratefully received.

--
Timothy Murphy
e-mail (80k only): tim /at/ birdsnest.maths.tcd.ie
tel: +353-86-2336090, +353-1-2842366
s-mail: School of Mathematics, Trinity College, Dublin 2, Ireland

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





--
Thanks and Regards
Zareef Ahmed
===
PHP Developer India http://www.zareef.net