[PHP] function for backing up mysql

2004-04-14 Thread Victor Spång Arthursson
Hi!

Wonder if anyone knows if there somewhere "out there" are any good 
functions that streams out data from mysql as a sql-file, like 
phpmyadmin does?

The best would be one which I told which database and which tables to 
dump, and which directly stared streaming the data…

Sincerely

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


RE: [PHP] function for backing up mysql

2004-04-14 Thread Hawkes, Richard
PhpMyAdmin (www.phpmyadmin.net) is a great MySQL admin tool, and utilises the MySQL 
backup functions.

Thanks
Richard

-Original Message-
From: Victor Spång Arthursson [mailto:[EMAIL PROTECTED]
Sent: 14 April 2004 08:52
To: [EMAIL PROTECTED]
Subject: [PHP] function for backing up mysql


Hi!

Wonder if anyone knows if there somewhere "out there" are any good 
functions that streams out data from mysql as a sql-file, like 
phpmyadmin does?

The best would be one which I told which database and which tables to 
dump, and which directly stared streaming the data…

Sincerely

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


==
This message is for the sole use of the intended recipient. If you received this 
message in error please delete it and notify us. If this message was misdirected, CSFB 
does not waive any confidentiality or privilege. CSFB retains and monitors electronic 
communications sent through its network. Instructions transmitted over this system are 
not binding on CSFB until they are confirmed by us. Message transmission is not 
guaranteed to be secure.
==

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



Re: [PHP] function for backing up mysql

2004-04-14 Thread Victor Spång Arthursson

2004-04-14 kl. 09.57 skrev Hawkes, Richard:
PhpMyAdmin (www.phpmyadmin.net) is a great MySQL admin tool, and 
utilises the MySQL backup functions.
Yes, and it is the same functionability I want. But I want a 
php-function to implement in various scripts I have, and since I 
probably aint the first to want this, I thought that there perhaps were 
some good scripts out there to use.

Sincerely

Victor

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


[PHP] Single HTML form post affecting multiple HTML frames/PHP scripts

2004-04-14 Thread Richard Lewis
I am writing a database front end in PHP for a record library.
 
My interface is divided into several HTML frames the first of which contains
an HTML select element listing all of the top-level records (CDs) and
several buttons to perform certain operations on the selected record (e.g.
delete, edit).
 
When the 'Edit' button is clicked the record's contents are displayed in
another frame so that it can be altered.
 
Each of these top-level records (CDs) has a number of 'sub-records' (tracks)
which I would like to be able to display in an HTML select element in a
third frame (as above).
 
Ideally, when the user clicks 'Edit' in the first frame with a CD selected,
not only should its details appear in the second frame, but also its tracks
(sub-records) should appear in the third frame.
 
So is there a way of making a single form post affect two scripts in
different HTML frames? Or a way of posting values from the second frame to
the third automatically (i.e. without the user clicking an HTML 'submit'
button)?
 
Cheers,
Richard

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



RE: [PHP] Single HTML form post affecting multiple HTML frames/PH P scripts

2004-04-14 Thread Hawkes, Richard
> So is there a way of making a single form post affect two scripts in
> different HTML frames? Or a way of posting values from the second frame to
> the third automatically (i.e. without the user clicking an HTML 'submit'
> button)?

Yes there is, and it's JavaScript! You'd need to get familiar with JS
functions to update various frames, and then start integrating that with PHP.

Alternatively, why not scrap frames and use CSS instead for an all-in-one
solution! I think most people here will agree that frames aren't very popular
these days!

==
This message is for the sole use of the intended recipient. If you received
this message in error please delete it and notify us. If this message was
misdirected, CSFB does not waive any confidentiality or privilege. CSFB
retains and monitors electronic communications sent through its network.
Instructions transmitted over this system are not binding on CSFB until they
are confirmed by us. Message transmission is not guaranteed to be secure.
==

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



Re: [PHP] function for backing up mysql

2004-04-14 Thread Burhan Khalid
Victor Spång Arthursson wrote:


2004-04-14 kl. 09.57 skrev Hawkes, Richard:

PhpMyAdmin (www.phpmyadmin.net) is a great MySQL admin tool, and 
utilises the MySQL backup functions.


Yes, and it is the same functionability I want. But I want a 
php-function to implement in various scripts I have, and since I 
probably aint the first to want this, I thought that there perhaps were 
some good scripts out there to use.
Just redirect the output from mysqldump.

mysqldump -u username -ppassword database > dump.sql

and then send that dump.sql file. Or, you can just read the output from 
the mysqldump command directly, using output buffering to make sure your 
script doesn't just stall (if its a big database).

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


Re: [PHP] Single HTML form post affecting multiple HTML frames/PHP scripts

2004-04-14 Thread Tom Rogers
Hi,

Wednesday, April 14, 2004, 6:57:53 PM, you wrote:
RL> I am writing a database front end in PHP for a record library.
 
RL> My interface is divided into several HTML frames the first of which contains
RL> an HTML select element listing all of the top-level records (CDs) and
RL> several buttons to perform certain operations on the selected record (e.g.
RL> delete, edit).
 
RL> When the 'Edit' button is clicked the record's contents are displayed in
RL> another frame so that it can be altered.
 
RL> Each of these top-level records (CDs) has a number of 'sub-records' (tracks)
RL> which I would like to be able to display in an HTML select element in a
RL> third frame (as above).
 
RL> Ideally, when the user clicks 'Edit' in the first frame with a CD selected,
RL> not only should its details appear in the second frame, but also its tracks
RL> (sub-records) should appear in the third frame.
 
RL> So is there a way of making a single form post affect two scripts in
RL> different HTML frames? Or a way of posting values from the second frame to
RL> the third automatically (i.e. without the user clicking an HTML 'submit'
RL> button)?
 
RL> Cheers,
RL> Richard


Post your details to the main page that defines the frames and get
that page to pass the new details on to the sub pages. that way all frames
will be regenerated after the post operation.

-- 
regards,
Tom

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



Re: [PHP] PHP time zone

2004-04-14 Thread David Robley
[EMAIL PROTECTED] (Tom Rogers) wrote in 
news:[EMAIL PROTECTED]:


> I have this in an auto_prepend file or you can put it before using any
> of the date() functions
> 
> putenv('TZ=Australia/Brisbane');
> 

But, but, that'll put the clock back 20 years and then add 30 minutes to 
Central Standard time :-)

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



Re: [PHP] function for backing up mysql

2004-04-14 Thread Victor Spång Arthursson
2004-04-14 kl. 11.26 skrev Burhan Khalid:

Just redirect the output from mysqldump.

mysqldump -u username -ppassword database > dump.sql

and then send that dump.sql file. Or, you can just read the output 
from the mysqldump command directly, using output buffering to make 
sure your script doesn't just stall (if its a big database).
But… the database is on a hotel to which I have no remote access to 
mysql… My client want to be able to click a link and get a "backup 
file" in return…

Is it possible to redirect the output from mysqldump using only php, 
and with no command line access?

Sincerely

Victor

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


Re: [PHP] Single HTML form post affecting multiple HTML frames/PHP scripts

2004-04-14 Thread Richard Lewis
Tom Rogers wrote:

> Hi,
> 
> Wednesday, April 14, 2004, 6:57:53 PM, you wrote:
> RL> So is there a way of making a single form post affect two scripts in
> RL> different HTML frames? Or a way of posting values from the second
> frame to RL> the third automatically (i.e. without the user clicking an
> HTML 'submit' RL> button)?
>  
> RL> Cheers,
> RL> Richard
> 
> 
> Post your details to the main page that defines the frames and get
> that page to pass the new details on to the sub pages. that way all frames
> will be regenerated after the post operation.
> 
OK, but the only way I can think to do this is by appending the details to
the URLs:



which will make them available with $_GET. All my coding so far has assumed
that data will be available in $_POST. Is there any way of passing data in
$_POST automatically?

R.

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



[PHP] Re: function for backing up mysql

2004-04-14 Thread Kim Steinhaug
Take a look at phpclasses.org
Last week there also came another class especially made for backups aswell
if I recall.

-- 
-- 
Kim Steinhaug
--
There are 10 types of people when it comes to binary numbers:
those who understand them, and those who don't.
--
www.steinhaug.com - www.easywebshop.no - www.webkitpro.com
--

"Victor spång arthursson" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
Hi!

Wonder if anyone knows if there somewhere "out there" are any good
functions that streams out data from mysql as a sql-file, like
phpmyadmin does?

The best would be one which I told which database and which tables to
dump, and which directly stared streaming the data…

Sincerely

Victor=

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



Re: [PHP] remote files handling

2004-04-14 Thread Marek Kilimajer
Red Wingate wrote:
http://de.php.net/filemtime

[quote]
As of PHP 5.0.0 this function can also be used with some URL wrappers. Refer 
to Appendix J for a listing of which wrappers support stat() family of 
functionality.
[/quote]

 -- red
As you likely don't have PHP5 installed, use fsockopen, filesystem 
functions to send and receive HEAD request, regexp to get Last-Modified 
header (http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.29) 
and strtotime to get unix timestamp.

Working example (I hope):

\n";
} else {
   $out = "HEAD /abc/Test.zip HTTP/1.1\r\n";
   $out .= "Host: www.abc.com\r\n";
   $out .= "Connection: Close\r\n\r\n";
   fwrite($fp, $out);
   while (!feof($fp)) {
   fgets($fp, 1024);
   if(ereg('^Last-Modified:\s+([^\r]+)', $m)) {
   echo strtotime($m[1]);
   break;
   }
   }
   fclose($fp);
}
?>
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] preg_match

2004-04-14 Thread Sorry Confidential
Hi,

I'm trying to parse a POstfix queue file to extract a few informations.  The
Postfix queue file is a binary file.

Here is an extract of the file, not a line, just an extract:
N^WFrom: <[EMAIL PROTECTED]>N^[To: <[EMAIL PROTECTED]>N#Subject: Test 14
2004-04-13  15:13N%Date: Tue, 13 Apr 2004 15:13:35 -0400

$line is obtained with an fread

if (preg_match('/To:.<(.+)>/',$line,$match)){
  print "To= $match[1]";
}

I get:
To= <[EMAIL PROTECTED]>N#Subject: Test 14  2004-04-13  15:13N%Date: Tue, 13
Apr 2004 15:13:35 -0400

I was expecting:
To= [EMAIL PROTECTED]

Obviously, i'm missing a detail..

Regards

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



[PHP] preg_match

2004-04-14 Thread Sorry Confidential
Hi,

I'm trying to parse a Postfix queue file to extract a few informations.  The
Postfix queue file is a binary file.

Here is an extract of the file, not a line, just an extract:
N^WFrom: <[EMAIL PROTECTED]>N^[To: <[EMAIL PROTECTED]>N#Subject: Test 14
2004-04-13  15:13N%Date: Tue, 13 Apr 2004 15:13:35 -0400

$line is obtained with an fread

if (preg_match('/To:.<(.+)>/',$line,$match)){
  print "To= $match[1]";
}

I get:
To= <[EMAIL PROTECTED]>N#Subject: Test 14  2004-04-13  15:13N%Date: Tue, 13
Apr 2004 15:13:35 -0400

I was expecting:
To= [EMAIL PROTECTED]

Obviously, i'm missing a detail..

Regards


[PHP] preg_match

2004-04-14 Thread Sorry Confidential
Hi,

I'm trying to parse a POstfix queue file to extract a few informations.  The
Postfix queue file is a binary file.

Here is an extract of the file, not a line, just an extract:
N^WFrom: <[EMAIL PROTECTED]>N^[To: <[EMAIL PROTECTED]>N#Subject: Test 14
2004-04-13  15:13N%Date: Tue, 13 Apr 2004 15:13:35 -0400

$line is obtained with an fread

if (preg_match('/To:.<(.+)>/',$line,$match)){
  print "To= $match[1]";
}

I get:
To= <[EMAIL PROTECTED]>N#Subject: Test 14  2004-04-13  15:13N%Date: Tue, 13
Apr 2004 15:13:35 -0400

I was expecting:
To= [EMAIL PROTECTED]

Obviously, i'm missing a detail..

Regards

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



[PHP] PHP5 wont load into Apache

2004-04-14 Thread electroteque
Hi there I am running Apache 2 with PHP5 on solaris 9. I keep getting this
error when I am loaded into my console xmlCanonicPath: referenced symbol not
found , although apache boots up on startup without a hitch, is there a
paths problem ?

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



[PHP] Re: smarty

2004-04-14 Thread pete M
Moving our sites to smarty is the best thing we've done at our company...

I do the php/database coding (logic)
the html designer does the templates/css
and the graphic designer does his bit.
What's fantastic is that we never ever tread on each other files whilst 
working on a project, unlike dereamwaver/spagetti code previously

As an example, we recently did a little system for a factory to view the 
upcoming jobs on a production line. The interface worked well for 
the office and they wanted it on touch screens on the production line. 
Changing 3 templates and the style sheet did the job, we were actually a 
bit shocked ourselves at how easy it was. Client was too.

Thanks Smarty - me luv ya x ;-)

Pete



Angelo Zanetti wrote:

hi all has anyone used smarty before? what do you think of it? I think it's
pretty nice to seperate your script (code) from your design.
i would like to hear your comments and if you have any alternatives let me
know.
Angelo


Disclaimer 
This e-mail transmission contains confidential information,
which is the property of the sender.
The information in this e-mail or attachments thereto is 
intended for the attention and use only of the addressee. 
Should you have received this e-mail in error, please delete 
and destroy it and any attachments thereto immediately. 
Under no circumstances will the Cape Technikon or the sender 
of this e-mail be liable to any party for any direct, indirect, 
special or other consequential damages for any use of this e-mail.
For the detailed e-mail disclaimer please refer to 
http://www.ctech.ac.za/polic or call +27 (0)21 460 3911
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP] PHP5 wont load into Apache

2004-04-14 Thread electroteque
Here is the full details

bash-2.05# ldd libphp5.so
libmcrypt.so.4 =>/usr/local/lib/libmcrypt.so.4
libltdl.so.3 =>  /opt/csw/lib/libltdl.so.3
libiconv.so.2 => /usr/local/lib/libiconv.so.2
libpng.so.3 =>   /opt/csw/lib/libpng.so.3
libz.so =>   /usr/lib/libz.so
libjpeg.so.62 => /opt/csw/lib/libjpeg.so.62
libssl.so.0.9.7 =>   /opt/csw/lib/libssl.so.0.9.7
libcrypto.so.0.9.7 =>/opt/csw/lib/libcrypto.so.0.9.7
libresolv.so.2 =>/usr/lib/libresolv.so.2
libm.so.1 => /usr/lib/libm.so.1
libdl.so.1 =>/usr/lib/libdl.so.1
libnsl.so.1 =>   /usr/lib/libnsl.so.1
libsocket.so.1 =>/usr/lib/libsocket.so.1
libcurl.so.2 =>  /opt/csw/lib/libcurl.so.2
libmysqlclient.so.14 =>
/usr/local/mysql/lib/mysql/libmysqlclient.so.14
librt.so.1 =>/usr/lib/librt.so.1
libcrypt_i.so.1 =>   /usr/lib/libcrypt_i.so.1
libgen.so.1 =>   /usr/lib/libgen.so.1
libxml2.so.2 =>  /usr/lib/libxml2.so.2
libc.so.1 => /usr/lib/libc.so.1
libmp.so.2 =>/usr/lib/libmp.so.2
libaio.so.1 =>   /usr/lib/libaio.so.1
libmd5.so.1 =>   /usr/lib/libmd5.so.1
libpthread.so.1 =>   /usr/lib/libpthread.so.1
/usr/platform/SUNW,UltraAX-i2/lib/libc_psr.so.1
/usr/platform/SUNW,UltraAX-i2/lib/libmd5_psr.so.1
libthread.so.1 =>/usr/lib/libthread.so.1
bash-2.05# ls  /usr/lib/libxml2.so.2


./configure --with-apxs2=/usr/local/httpd/bin/apxs --without-mysql --with-my
sqli=/usr/local/mysql/bin/mysql_config --with-libxml-dir=/opt/csw  --with-zl
ib-dir=/opt/csw --with-curl=/opt/csw --with-kerberos=/opt/csw --enable-track
-vars --with-xml=/opt/csw --with-expat=/opt/csw   --with-jpeg-dir=/opt/csw  
--with-png-dir=/opt/csw --with-gd --enable-gd-native-ttf --enable-gd-imgstrt
tf --with-zlib=/opt/csw --with-mcrypt=/usr/local/ --with-openssl=/opt/csw --
enable-ftp --without-sqlite --with-expat=/opt/csw --with-iconv=/usr/local

I've asked libxml2 to be from /opt/csw so no idea where it got /usr/lib from

> -Original Message-
> From: electroteque [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, April 14, 2004 10:43 PM
> To: Php-General
> Subject: [PHP] PHP5 wont load into Apache
>
>
> Hi there I am running Apache 2 with PHP5 on solaris 9. I keep getting this
> error when I am loaded into my console xmlCanonicPath: referenced
> symbol not
> found , although apache boots up on startup without a hitch, is there a
> paths problem ?
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php

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



Re: [PHP] preg_match

2004-04-14 Thread John W. Holmes
From: "Sorry Confidential" <[EMAIL PROTECTED]>

> I'm trying to parse a Postfix queue file to extract a few informations.
The
> Postfix queue file is a binary file.
>
> Here is an extract of the file, not a line, just an extract:
> N^WFrom: <[EMAIL PROTECTED]>N^[To: <[EMAIL PROTECTED]>N#Subject: Test 14
> 2004-04-13  15:13N%Date: Tue, 13 Apr 2004 15:13:35 -0400
>
> $line is obtained with an fread
>
> if (preg_match('/To:.<(.+)>/',$line,$match)){
>   print "To= $match[1]";
> }
>
> I get:
> To= <[EMAIL PROTECTED]>N#Subject: Test 14  2004-04-13  15:13N%Date: Tue, 13
> Apr 2004 15:13:35 -0400
>
> I was expecting:
> To= [EMAIL PROTECTED]

Try preg_match('/To:.<([^>]+)>/',$line,$match)

Also, if you need to match more than one "to" at a time, look at
preg_match_all(). Depending on the size of the file, it may be more
efficient to read the entire file and match all of these at once.

---John Holmes...

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



Re: [PHP] function for backing up mysql

2004-04-14 Thread John W. Holmes
From: "Victor Spång Arthursson" <[EMAIL PROTECTED]>

> Wonder if anyone knows if there somewhere "out there" are any good
> functions that streams out data from mysql as a sql-file, like
> phpmyadmin does?
>
> The best would be one which I told which database and which tables to
> dump, and which directly stared streaming the data…

Look on phpclasses.org. I saw a class listed in their last email notice that
did what you're looking for. I'm sure there are a couple of options there.

The easy way to do it is to just make an exec() or system() call to
mysqldump (it comes with mysql). Just call the program and capture the
output. It's the easiest way.

---John Holmes...

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



Re: [PHP] Re: smarty

2004-04-14 Thread Chris de Vidal
pete M said:
> Moving our sites to smarty is the best thing we've done at our company...

Just a few weeks ago, I'd have agreed wit' yah, but now I see Smarty as
mostly (not always) redundant.  See my post where I learned that PHP makes
a great templating engine:
http://marc.theaimsgroup.com/?l=php-general&m=108145205519710&w=2

/dev/idal

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



Re: [PHP] Re: smarty

2004-04-14 Thread pete M
what about the modifiers

capitalize
count_characters
cat
count_paragraphs
count_sentences
count_words
date_format
default
escape
indent
lower
nl2br
regex_replace
replace
spacify
string_format
strip
strip_tags
truncate
upper
wordwrap
and the functions

capture
config_load
foreach,foreachelse
include
include_php
insert
if,elseif,else
ldelim,rdelim
literal
php
section,sectionelse
strip
and custom functions

assign
counter
cycle
debug
eval
fetch
html_checkboxes
html_image
html_options
html_radios
html_select_date
html_select_time
html_table
math
mailto
popup_init
popup
textformat
How would you code that lot and remember its ALL to do with presentation ?

pete

Chris De Vidal wrote:
pete M said:

Moving our sites to smarty is the best thing we've done at our company...


Just a few weeks ago, I'd have agreed wit' yah, but now I see Smarty as
mostly (not always) redundant.  See my post where I learned that PHP makes
a great templating engine:
http://marc.theaimsgroup.com/?l=php-general&m=108145205519710&w=2
/dev/idal
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] ereg-replace ... how to catch :'( [crying smiley] ???

2004-04-14 Thread -{ Rene Brehmer }-
I'm trying to do graphical smileys for my guestbook, but I've run into a 
problem with the crying smilies:

I need to replace :'( and :'-( ... or as they look in the post after being 
entered through htmlentities with ent_quotes on:

:'(
:'-(
this causes the entire message to disappear:

$text = ereg_replace(':'-?(','',$text);

only the format of the search part differs from my other smiley 
replacements, so obviously that's where the problem is ... afaik, neither 
&, # or ; have any meaning in regex, so I don't get what causes it ... I've 
tried escaping all of those chars, and it still causes $text to come back 
empty...

any ideas will be highly appreciated...

TIA

Rene
--
Rene Brehmer
aka Metalbunny
~ If you don't like what I have to say ... don't read it ~

http://metalbunny.net/
References, tools, and other useful stuff...
Check out the new Metalbunny forums @ http://forums.metalbunny.net/
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP] ereg-replace ... how to catch :'( [crying smiley] ???

2004-04-14 Thread Jay Blanchard
[snip]
:'(
:'-(

this causes the entire message to disappear:

$text = ereg_replace(':'-?(','',$text);
[/snip]

Have you tried any of the other regular expression functions available?

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



Re: [PHP] function for backing up mysql

2004-04-14 Thread Enrico Weigelt
* Victor Spång Arthursson <[EMAIL PROTECTED]> [2004-04-14 11:55:13 +0200]:


> But? the database is on a hotel to which I have no remote access to 
> mysql? My client want to be able to click a link and get a "backup 
> file" in return?
> 
> Is it possible to redirect the output from mysqldump using only php, 
> and with no command line access?

backtick operator ?


cu
-- 
-
 Enrico Weigelt==   metux IT services

  phone: +49 36207 519931 www:   http://www.metux.de/
  fax:   +49 36207 519932 email: [EMAIL PROTECTED]
  cellphone: +49 174 7066481
-
   -- DSL-Zugang ab 0 Euro. -- statische IP -- UUCP -- Hosting --
-

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



[PHP] Never mind ... stupid me :-/ {was Re: [PHP] ereg-replace ... how to catch :'( [crying smiley] ???}

2004-04-14 Thread -{ Rene Brehmer }-
Never mind y'all ... me stupid ...

obviously the ( has meaning, and needs to be escaped ... was starting to 
think it could only do 2 ereg's in 1 script *sigh*

Sorry for wasting time and bandwidth ... the function now looks like this 
and works :

function gfx_smiley($text) {
  $smiley_path = 'smiley';
  $text = eregi_replace(':-?D','',$text);
  $text = ereg_replace(':-?\?','',$text);
  $text = ereg_replace(':'-?\(','',$text);
  $text = ereg_replace(':-?\(','',$text);

  return $text;
}
At 15:43 14-04-2004, -{ Rene Brehmer }- wrote:
I'm trying to do graphical smileys for my guestbook, but I've run into a 
problem with the crying smilies:

I need to replace :'( and :'-( ... or as they look in the post after being 
entered through htmlentities with ent_quotes on:

:'(
:'-(
this causes the entire message to disappear:

$text = ereg_replace(':'-?(','',$text);

only the format of the search part differs from my other smiley 
replacements, so obviously that's where the problem is ... afaik, neither 
&, # or ; have any meaning in regex, so I don't get what causes it ... 
I've tried escaping all of those chars, and it still causes $text to come 
back empty...

any ideas will be highly appreciated...
--
Rene Brehmer
aka Metalbunny
~ If you don't like what I have to say ... don't read it ~

http://metalbunny.net/
References, tools, and other useful stuff...
Check out the new Metalbunny forums @ http://forums.metalbunny.net/
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Never mind ... stupid me :-/ {was Re: [PHP] ereg-replace ... how to catch :'( [crying smiley] ???}

2004-04-14 Thread Tom Rogers
Hi,

Thursday, April 15, 2004, 12:51:20 AM, you wrote:
RB> Never mind y'all ... me stupid ...

RB> obviously the ( has meaning, and needs to be escaped ... was starting to
RB> think it could only do 2 ereg's in 1 script *sigh*

RB> Sorry for wasting time and bandwidth ... the function now looks like this
RB> and works :


You might find this very useful :)

http://weitz.de/regex-coach/

Helps my old brain 

-- 
regards,
Tom

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



RE: [PHP] Re: Need help

2004-04-14 Thread Ford, Mike [LSS]
On 09 April 2004 16:39, Strogg wrote:

[snip original problem for which a fix has been posted]

>   $taxrate = 0.175;  //local tax rate in UK is 17.5%

You should note that UK VAT is always rounded *down*, so that this:

>   $totalamount = $totalamount * (1 + $taxrate);

should be something like:

$totalamount += round($totalamount*$taxrate-0.00499, 2);

or:

$totalamount += floor($totalamount*taxrate*100)/100;

Cheers!

Mike

-
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning & Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Beckett Park, LEEDS,  LS6 3QS,  United Kingdom
Email: [EMAIL PROTECTED]
Tel: +44 113 283 2600 extn 4730  Fax:  +44 113 283 3211 

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



RE: [PHP] Finding value in multi-dimensional array - Solved

2004-04-14 Thread Ford, Mike [LSS]
On 10 April 2004 02:21, Verdon Vaillancourt wrote:

> Hi,
> 
> Thanks much to Richard and Andy for the input :)  This one
> did the job...
> 
> if($_SESSION['OBJ_user']->modSettings['listings']['active'] == '1') {
> 
> I'm still not entirely sure I understand the syntax ;)

Well, by relating back to your print_r() and building up the syntax by stages, you can 
see that $_SESSION['OBJ_user'] is... 
 
> > > phpws_user Object

... an OBJECT (of class phpws_user), with a property of ($_SESSION['OBJ_user']->)...

> > > (
> > >   [modSettings] => Array

... modSettings ($_SESSION['OBJ_user']->modSettings) which is an ARRAY 
($_SESSION['OBJ_user']->modSettings[]), which has a subscript (or key) of...

> > >   (
> > >   [listings] => Array

... 'listings' ($_SESSION['OBJ_user']->modSettings['listings']), which is in turn an 
ARRAY ($_SESSION['OBJ_user']->modSettings['listings'][]), which has a subscript of...

> > >   (
> > >   [active] => 1

... 'active' ($_SESSION['OBJ_user']->modSettings['listings']['active']).  TaDa!

HTH.

Cheers!

Mike

-
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning & Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Beckett Park, LEEDS,  LS6 3QS,  United Kingdom
Email: [EMAIL PROTECTED]
Tel: +44 113 283 2600 extn 4730  Fax:  +44 113 283 3211 

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



RE: [PHP] Most bizarre date problem ever

2004-04-14 Thread Ford, Mike [LSS]
On 10 April 2004 16:11, Brian Dunning wrote:

> Check this out: I'm returning a list of the last 30 days, looping
> through i, subtracting it from $end_date where $end_date is 2004-04-10
> 00:00:00. I'm just trying to derive a timestamp $check_date for each
> iteration, like 1081321200. Here's the code within the loop:
> 
> $check_date = mktime(0, 0, 0, substr($end_date, 5, 2),
> substr($end_date, 8, 2) - $i, substr($end_date, 0, 4), -1);
> 
> Note that this works PERFECTLY for every date, and always has. Except
> for one particular day. When $end_date - $i is supposed to be
> April 4,
> the timestamp returned is -7262, which it thinks is 12/31/1969.

This looks like a Daylight Savings timeshift bug on your system (and there are more of 
those around than you can shake a stick at!).  Because of such problems, you should 
never use a time anywhere near the DST hour-change when you are calculating 
consecutive dates, and most especially not a time that could conceivably be shifted 
into the adjacent day (i.e. 00:00-00:59) -- always use something squarely in the 
middle of the day, such as midday:

   $check_date = mktime(12, 0, 0, substr($end_date, 5, 2), substr($end_date, 8, 2) - 
$i, substr($end_date, 0, 4), -1);

Cheers!

Mike

-
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning & Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Beckett Park, LEEDS,  LS6 3QS,  United Kingdom
Email: [EMAIL PROTECTED]
Tel: +44 113 283 2600 extn 4730  Fax:  +44 113 283 3211 

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



Re: [PHP] Re: smarty

2004-04-14 Thread Vicente Werner
El Wednesday 14 April 2004 13:33, Chris de Vidal escribió:
> pete M said:
> > Moving our sites to smarty is the best thing we've done at our company...
>
> Just a few weeks ago, I'd have agreed wit' yah, but now I see Smarty as
> mostly (not always) redundant.  See my post where I learned that PHP makes
> a great templating engine:
> http://marc.theaimsgroup.com/?l=php-general&m=108145205519710&w=2
Ugh that's not just fuckingly ugly, but a total doom to maintain over the time 
-two months without touching the code and you're absolutely lost- . It maybe 
faster, it maybe a bit simpler since you only have to learn one language, but 
it's a mental carnage to maintain a client site that way

I Agree with Pete, moving to smarty was the best we could've done.

-- 
__
Vicente Antonio Sánchez Werner ( [EMAIL PROTECTED] )
Fijo: +34-923185650 Movil: +34-66865
Director Depto Informática, Desarrollo y Seguridad Informática
Wap Comunicaciones S.L.
C/Guadalajara nº9-11
37003 Salamanca (España)
--

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



Re: [PHP] smarty

2004-04-14 Thread Chris de Vidal
pete M said:
> what about the modifiers

> How would you code that lot and remember its ALL to do with presentation ?

I mentioned this.  Take another look at my post:
http://marc.theaimsgroup.com/?l=php-general&m=108145205519710&w=2
"[By using only PHP], At worst [I lose] some of the nice
Smarty functions such as html_options (which might be easily replaced by
phpHTMLlib or another widget library)."

So there are alternatives to what Smarty offers, but I also said "I just
see them [template engines] as another tool."  It's a tool; use it where
it saves time, but it's not as if native PHP lacks most (if not all) of
what Smarty offers, which is what I originally thought because I'd learned
PHP by spaghetti coding.

I would never say that Smarty is completely redundant.  Use it where it
makes sense.  But now that my eyes have been opened I believe it's
_mostly_ redundant.  I believe it was written because so many people
aren't aware that native PHP is a *very* effective template engine.

/dev/idal

P.S. Have a look at the article I linked in my post:
http://www.phppatterns.com/index.php/article/articleview/4/1/1/

While I don't totally agree with everything he says (he says ALL
templating engines are bad), it was an eye-opener for me.

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



Re: [PHP] Most bizarre date problem ever

2004-04-14 Thread Brian Dunning
On Apr 14, 2004, at 7:25 AM, Ford, Mike [LSS] wrote:

Because of such problems, you should never use a time anywhere near 
the DST hour-change when you are calculating consecutive dates, and 
most especially not a time that could conceivably be shifted into the 
adjacent day (i.e. 00:00-00:59)
It was the only way I could figure out how to write SQL to find all 
orders that were from a particular day (orders have a datetime field on 
them) - so I'm searching for everything greater than or equal to 
00:00:00 and less than or equal to 23:59:59.

I'd rather use SQL that just looks at the date and ignores the time 
portion, if there's any way to do that.

- Brian

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


Re: [PHP] smarty

2004-04-14 Thread Chris de Vidal
Vicente Werner said:
> > http://marc.theaimsgroup.com/?l=php-general&m=108145205519710&w=2
> Ugh that's not just fuckingly ugly, but a total doom to maintain over the
> time -two months without touching the code and you're absolutely lost- .
> It maybe faster, it maybe a bit simpler since you only have to learn one
> language, but it's a mental carnage to maintain a client site that way

I don't understand... how is this:
==
$page = new Smarty();
$result = mysql_query ("SELECT * FROM users WHERE id = '".$_GET["id"]."');
$row_array = mysql_fetch_array ($result);
$page->assign("name",$row_array["name"]);
$page->assign("address", $row_array["address"]);
$page->assign("state",   $row_array["state"]);
$page->display("template.tpl");
---


Name: {$name}
Address: {$address}
State: {$state}
...
===


Better than this?
=
$result = mysql_query ("SELECT * FROM users WHERE id = '".$_GET["id"]."');
$row_array = mysql_fetch_array ($result);
$name= $row_array["name"];
$address = $row_array["address"];
$state   = $row_array["state"];
$include("template.tpl");
---


Name: 
Address: 
State: 
...
===

They both look about the same (well in the native PHP example I actually
wrote less code).

Perhaps you were looking at my spaghetti-code example, but take another
look, I posted 3 examples.

/dev/idal

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



Re: [PHP] Re: smarty

2004-04-14 Thread Justin French
On 14/04/2004, at 11:38 PM, pete M wrote:

How would you code that lot and remember its ALL to do with 
presentation ?
You must remember, Smarty is just a layer over PHP.  All the functions 
that you've listed exist in pure PHP code somewhere.  It would 
relatively easy to code equivalent templates in PHP.

Taking some random examples from your list:

{$yesterday|date_format:"%A, %B %e, %Y"}
becomes

{$articleTitle|lower}
becomes

{foreach from=$custid item=curr_id}
id: {$curr_id}
{/foreach}
becomes

id: 

... but there are all pretty easy.  How about a harder one like 
html_options?  Just write a quick function, and we're all good:

 'Joe Schmoe',
1002 => 'Jack Smith',
1003 => 'Jane Johnson',
1004 => 'Charlie Brown'
);
function html_options($options,$name,$selected='')
{
echo "\n";
foreach($options as $value => $label)
{
if($value == $selected) { $s=' selected'; } else { $s=''; }
echo "\t{$label}\n";
}
echo "\n";
}
?>

The point I'm trying to make here is that Smarty is just an interface 
to a bunch of PHP functions.  Anything you can do with smarty, we can 
do with PHP.  Whilst smarty provides us with some nice basic functions 
for the above tasks, it's nothing you can't do yourself.  A whole heap 
of the modifiers are straight PHP anyway, and the rest of them are 
quite simple to reproduce... in fact, I'm sure I have 90% of them 
tucked away in a library already.

Smarty serves a purpose, and has a market -- that's for sure.  But 
there's no magic here, it's just an interface to a bunch of PHP 
functions.

---
Justin French
http://indent.com.au
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re[2]: [PHP] smarty

2004-04-14 Thread Richard Davey
Hello Chris,

Wednesday, April 14, 2004, 3:35:05 PM, you wrote:

CdV> I don't understand... how is this:
[snip]
CdV> Better than this?
CdV> =
CdV> $result = mysql_query ("SELECT * FROM users WHERE id = '".$_GET["id"]."');
CdV> $row_array = mysql_fetch_array ($result);
CdV> $name= $row_array["name"];
CdV> $address = $row_array["address"];
CdV> $state   = $row_array["state"];
CdV> $include("template.tpl");
CdV> ---
CdV> 
CdV> 
CdV> Name: 
CdV> Address: 
CdV> State: 
CdV> ...
CdV> ===

Because you're injecting variables directly into your HTML, which some
of the time might be ok - but what if the $row_array doesn't contain
"name" ? You'll raise an Error Warning without first passing it
through some kind of test (or function).

You assume that the PHP short-tags are enabled () for
echoing variables and while most the time they are, you shouldn't bank
on it in code (incidentally, you don't need the trailing ; on the
short-tag echos).

Sure - these things can be fixed easily, but then that isn't the point
- if you think about it logically, anything Smarty can do, PHP can do
too (well, duh! :)

But what if you want to take your template and perform a bit more than
just mere variable substitution on it? How about highlighting all
words that match a search term, or applying logic to a display block
based on a user status?

Personally I don't use smarty*, but even I can see the benefits it
offers.

* only because I don't build web sites for clients, I build them for
one specific company and we have our own template system in-house.

-- 
Best regards,
 Richard Davey
 http://www.phpcommunity.org/wiki/296.html

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



Re: [PHP] Re: smarty

2004-04-14 Thread pete M
Think everyone is missing the point..
the whole point of smarty is to take the presentation code away from the 
logic

Smarty is a template engine for PHP. More specifically, it facilitates a 
manageable way to separate application logic and content from its 
presentation. This is best described in a situation where the 
application programmer and the template designer play different roles, 
or in most cases are not the same person. For example, let's say you are 
creating a web page that is displaying a newspaper article. The article 
headline, tagline, author and body are content elements, they contain no 
information about how they will be presented. They are passed into 
Smarty by the application, then the template designer edits the 
templates and uses a combination of HTML tags and template tags to 
format the presentation of these elements (HTML tables, background 
colors, font sizes, style sheets, etc.) One day the programmer needs to 
change the way the article content is retrieved (a change in application 
logic.) This change does not affect the template designer, the content 
will still arrive in the template exactly the same. Likewise, if the 
template designer wants to completely redesign the templates, this 
requires no changes to the application logic. Therefore, the programmer 
can make changes to the application logic without the need to 
restructure templates, and the template designer can make changes to 
templates without breaking application logic.

Vicente Werner wrote:
El Wednesday 14 April 2004 13:33, Chris de Vidal escribió:

pete M said:

Moving our sites to smarty is the best thing we've done at our company...
Just a few weeks ago, I'd have agreed wit' yah, but now I see Smarty as
mostly (not always) redundant.  See my post where I learned that PHP makes
a great templating engine:
http://marc.theaimsgroup.com/?l=php-general&m=108145205519710&w=2
Ugh that's not just fuckingly ugly, but a total doom to maintain over the time 
-two months without touching the code and you're absolutely lost- . It maybe 
faster, it maybe a bit simpler since you only have to learn one language, but 
it's a mental carnage to maintain a client site that way

I Agree with Pete, moving to smarty was the best we could've done.

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


Re: [PHP] Re: smarty

2004-04-14 Thread Kelly Hallman
Apr 14 at 9:33am, Chris de Vidal wrote:
> pete M said:
> > Moving our sites to smarty is the best thing we've done at our company.
> 
> Just a few weeks ago, I'd have agreed wit' yah, but now I see Smarty as
> mostly (not always) redundant. see my post where I learned that PHP 
> makes a great templating engine:
> http://marc.theaimsgroup.com/?l=php-general&m=108145205519710&w=2

If you just look at the basic operation of Smarty, by definition it's just 
a way to do exactly what everyone claims makes PHP a "templating engine".

You could just as easily use Smarty to render a template once, copy the
resulting cached .php file within your codebase, delete Smarty, and
include the .php file in lieu of rendering the template with Smarty. And?

If that's enough for the project at hand, then I am willing to bet Smarty 
wasn't being put to significant use anyway, and it's 50/50. I don't think 
that every piece of PHP code that builds page output should be done with 
Smarty. If you think it's redundant, please, avoid it like the plague!!

I still see this point as being insignificant. Worth noting, sure, but not
any major revelation. Being merely a tool, Smarty enables you to
accomplish much more, with much less effort. Plain and simple.

I don't recall anyone ever advancing the notion that Smarty turned PHP
into something more than it was before. By definition it is merely a layer 
that makes your life as a developer easier. A tool!

The amount of benefit derrived from a templating engine is proportional to
how complex your templating needs are. Please note! I'm not suggesting
that there is anything wrong with basic templates. As with any tool, the
cost/benefit of Smarty must be weighed against the situation at hand.

However, those of us who are seeing great benefit from the use of Smarty
are not mere ignoramouses, and I feel that the implication being made is
that we're not seeing what PHP can already do. This is false.

Speaking for myself at least, Smarty was never a crutch. I deliberately
sought out a templating solution to move beyond limitations I was bumping
up against using straight PHP in the way that is being described. Nothing 
I have seen so far has addressed a single one of these issues adequately.

Semantically, I take issue with the description of PHP as a templating
engine, in the same way Smarty is referred to as a templating engine.  
This is because Smarty is, in most senses, a superset (or wrapper) built
on top of PHP that offers many template-centric features that out of the
box PHP does not. You can make a template in PHP. This does not exactly
put it in the category of an "engine" anymore than it could be considered
a form engine, a database engine, or an all-purpose engine engine.

The reason this is such a contentious issue, I think, is because the point
being made--while correct, and note-worthy--is short-changing Smarty by
calling it redundant. I feel that one's use of Smarty may indeed be
redundant, that's easy to do. However, Smarty is not inherently redundant. 
Using Smarty redundantly does not make Smarty itself one bit redundant.

To make that claim, you're dropping a pretty heavy dis on a lot of people
who have invested a great deal of time, effort, and subsequently realized
great benefits from Smarty and it's templating brethren. Not to mention
all those who have devoted great effort in the development of these tools.

I'm seriously not trying to sound harsh here, but do you think that by
realizing you could structure your PHP code in such a way to mimic a basic
Smarty template, you've now single-handedly debunked the purpose for all
of this effort by so many avid PHP programmers? Seriously, now...!

No one should be under the illusion that you can't do it all with only
PHP. Smarty doesn't do anything you couldn't do yourself in PHP, it can't!  
That is irrelevant, because Smarty is a tool. You need the tool, or you
don't. That doesn't mean you always need it, but it certainly doesn't mean
that serves no purpose or can't be utilized to save a lot of work.

Many tools, if used properly, can save so much work that they enable you
to do things that you would never feasibly accomplish by working in tiny
pieces. This is why tools are developed. I feel like this exemplifies the
issue at hand. Even if you can code PHP all day long without fatigue, and
you are the most brilliant PHP coder the world has known, you'll basically
end up having written something similar to Smarty. Why?! Because you can?

So if we're trying to say that you don't need Smarty to make a simplistic
template, I think even the most diehard Smarty fanatic will agree. It just
sounds a lot like people who don't really see the power of Smarty, saying
that it's got no power and no benefit. That is highly debatable, and I'm
not convinced that many of these people truly grasp Smarty (even if they
have used it, or claim to like it for some purposes).

Unfortunately the end result is either you see it, or you don't. I would 

Re: [PHP] smarty

2004-04-14 Thread Chris de Vidal
Kelly Hallman said:
> I don't recall anyone ever advancing the notion that Smarty turned PHP
> into something more than it was before. By definition it is merely a layer
> that makes your life as a developer easier. A tool!

Yeah but in my ignorance that's what I thought, and I realized I probably
was not alone.

> However, those of us who are seeing great benefit from the use of Smarty
> are not mere ignoramouses, and I feel that the implication being made is
> that we're not seeing what PHP can already do. This is false.

OK but I was an ignoramous and I believe there *are* others out there like
myself.

> The reason this is such a contentious issue, I think, is because the point
> being made--while correct, and note-worthy--is short-changing Smarty by
> calling it redundant. I feel that one's use of Smarty may indeed be
> redundant, that's easy to do. However, Smarty is not inherently redundant.
> Using Smarty redundantly does not make Smarty itself one bit redundant.

I said it was mostly, not completely redundant.  In the case of the cool
built-in functions you've got some advantages.  But I believe those could
also be (perhaps more effectively) implimented with other libraries.  It's
just a tool.

> To make that claim, you're dropping a pretty heavy dis on a lot of people
> who have invested a great deal of time, effort, and subsequently realized
> great benefits from Smarty and it's templating brethren. Not to mention
> all those who have devoted great effort in the development of these tools.

I believe it and most templating engines were written because many people
didn't know they had an alternative.  I could be wrong; if so, it is a
"heavy dis."  Didn't mean it that way, so if I am wrong I humbly
apologize.

> I'm seriously not trying to sound harsh here, but do you think that by
> realizing you could structure your PHP code in such a way to mimic a basic
> Smarty template, you've now single-handedly debunked the purpose for all
> of this effort by so many avid PHP programmers? Seriously, now...!

Naww... I'd been using Smarty for several weeks now because I thought the
only alternative to spaghetti code was Smarty, but recently I realized
that it's not, and that simple example shows it.  I didn't realize I had
another alternative.

It's like this: "Does your mother know you're stupid?"  Either way you
answer, you're stupid.  If you don't realize you have another alternative
you're stuck.  I believe Smarty was written because people didn't realize
they had the other alternative.  If I am wrong, see above.

> Regardless of the merit of the point being made, I don't think that
> benefits anyone much. I'm sure when some guy came up with a metal knife,
> there was a dude there with a sharp rock saying, "but this works too!"
> Then the guy with the knife started using it to cut everything, while the
> rock required constant honing to remain sharp enough to do half the work.
> But the guy with the rock thought it was all he needed! I use a knife.

I see what you mean, but my point is PHP already *is* the knife: it
templates with about the same effort as Smarty.  At times less effort (in
which case I'd use native PHP), at times more (in which case I'd use
Smarty).

Anyway, thanks for the input.

/dev/idal

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



Re: [PHP] smarty

2004-04-14 Thread Chris de Vidal
pete M said:
> Think everyone is missing the point..
> the whole point of smarty is to take the presentation code away from the
> logic

No, I understood that point.  It's why I started using Smarty.  Take
another look at what I said:
http://marc.theaimsgroup.com/?l=php-general&m=108145205519710&w=2

/dev/idal

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



Re: [PHP] Re: smarty

2004-04-14 Thread Chris de Vidal
Justin French said:
> You must remember, Smarty is just a layer over PHP.  All the functions
> that you've listed exist in pure PHP code somewhere.  It would
> relatively easy to code equivalent templates in PHP.
>
> Taking some random examples from your list:


I believe Smarty users would say "Yeah but the Smarty functions are
already written," which is when I'd use Smarty.  There are countless
thousands of PHP libraries/classes that can also be added to save writing
functions from scratch.

My point is that the templating feature of Smarty is largely (but not
completely) redundant.

/dev/idal

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



Re: [PHP] Re: smarty

2004-04-14 Thread pete M
well said kelly !!!

> So if we're trying to say that you don't need Smarty to make a simplistic
> template, I think even the most diehard Smarty fanatic will agree. It 
just
> sounds a lot like people who don't really see the power of Smarty, saying
> that it's got no power and no benefit. That is highly debatable, and I'm
> not convinced that many of these people truly grasp Smarty (even if they
> have used it, or claim to like it for some purposes).

Pete

Kelly Hallman wrote:

Apr 14 at 9:33am, Chris de Vidal wrote:

pete M said:

Moving our sites to smarty is the best thing we've done at our company.
Just a few weeks ago, I'd have agreed wit' yah, but now I see Smarty as
mostly (not always) redundant. see my post where I learned that PHP 
makes a great templating engine:
http://marc.theaimsgroup.com/?l=php-general&m=108145205519710&w=2


If you just look at the basic operation of Smarty, by definition it's just 
a way to do exactly what everyone claims makes PHP a "templating engine".

You could just as easily use Smarty to render a template once, copy the
resulting cached .php file within your codebase, delete Smarty, and
include the .php file in lieu of rendering the template with Smarty. And?
If that's enough for the project at hand, then I am willing to bet Smarty 
wasn't being put to significant use anyway, and it's 50/50. I don't think 
that every piece of PHP code that builds page output should be done with 
Smarty. If you think it's redundant, please, avoid it like the plague!!

I still see this point as being insignificant. Worth noting, sure, but not
any major revelation. Being merely a tool, Smarty enables you to
accomplish much more, with much less effort. Plain and simple.
I don't recall anyone ever advancing the notion that Smarty turned PHP
into something more than it was before. By definition it is merely a layer 
that makes your life as a developer easier. A tool!

The amount of benefit derrived from a templating engine is proportional to
how complex your templating needs are. Please note! I'm not suggesting
that there is anything wrong with basic templates. As with any tool, the
cost/benefit of Smarty must be weighed against the situation at hand.
However, those of us who are seeing great benefit from the use of Smarty
are not mere ignoramouses, and I feel that the implication being made is
that we're not seeing what PHP can already do. This is false.
Speaking for myself at least, Smarty was never a crutch. I deliberately
sought out a templating solution to move beyond limitations I was bumping
up against using straight PHP in the way that is being described. Nothing 
I have seen so far has addressed a single one of these issues adequately.

Semantically, I take issue with the description of PHP as a templating
engine, in the same way Smarty is referred to as a templating engine.  
This is because Smarty is, in most senses, a superset (or wrapper) built
on top of PHP that offers many template-centric features that out of the
box PHP does not. You can make a template in PHP. This does not exactly
put it in the category of an "engine" anymore than it could be considered
a form engine, a database engine, or an all-purpose engine engine.

The reason this is such a contentious issue, I think, is because the point
being made--while correct, and note-worthy--is short-changing Smarty by
calling it redundant. I feel that one's use of Smarty may indeed be
redundant, that's easy to do. However, Smarty is not inherently redundant. 
Using Smarty redundantly does not make Smarty itself one bit redundant.

To make that claim, you're dropping a pretty heavy dis on a lot of people
who have invested a great deal of time, effort, and subsequently realized
great benefits from Smarty and it's templating brethren. Not to mention
all those who have devoted great effort in the development of these tools.
I'm seriously not trying to sound harsh here, but do you think that by
realizing you could structure your PHP code in such a way to mimic a basic
Smarty template, you've now single-handedly debunked the purpose for all
of this effort by so many avid PHP programmers? Seriously, now...!
No one should be under the illusion that you can't do it all with only
PHP. Smarty doesn't do anything you couldn't do yourself in PHP, it can't!  
That is irrelevant, because Smarty is a tool. You need the tool, or you
don't. That doesn't mean you always need it, but it certainly doesn't mean
that serves no purpose or can't be utilized to save a lot of work.

Many tools, if used properly, can save so much work that they enable you
to do things that you would never feasibly accomplish by working in tiny
pieces. This is why tools are developed. I feel like this exemplifies the
issue at hand. Even if you can code PHP all day long without fatigue, and
you are the most brilliant PHP coder the world has known, you'll basically
end up having written 

Re: [PHP] Re: smarty

2004-04-14 Thread pete M
Actually where it =really speeds thing up is the 
prototype/research/planning etc

We sit in front of a PC and mock up the forms/ pages/ nav bar etc.. That 
stuff then gets coded.

Doddle

Pete

Vicente Werner wrote:

El Wednesday 14 April 2004 13:33, Chris de Vidal escribió:

pete M said:

Moving our sites to smarty is the best thing we've done at our company...
Just a few weeks ago, I'd have agreed wit' yah, but now I see Smarty as
mostly (not always) redundant.  See my post where I learned that PHP makes
a great templating engine:
http://marc.theaimsgroup.com/?l=php-general&m=108145205519710&w=2
Ugh that's not just fuckingly ugly, but a total doom to maintain over the time 
-two months without touching the code and you're absolutely lost- . It maybe 
faster, it maybe a bit simpler since you only have to learn one language, but 
it's a mental carnage to maintain a client site that way

I Agree with Pete, moving to smarty was the best we could've done.

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


Re: [PHP] Re: smarty

2004-04-14 Thread John W. Holmes
From: "pete M" <[EMAIL PROTECTED]>

> Think everyone is missing the point..
> the whole point of smarty is to take the presentation code away from the
> logic

Correct. The point your missing is that PHP can be on both sides of the
equation. You can have PHP in your templates that only controls your
presentation and then have PHP on your backend that conducts your business
logic. Or, you can have Smarty on top of PHP to control you're presentation.
Personal preference, but don't confuse the process of separating
presentation from business logic as meaning you can't have any PHP code in
your presentation layer.

---John Holmes...

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



Re: [PHP] smarty

2004-04-14 Thread Chris de Vidal
Richard Davey said:
> CdV> I don't understand... how is this:
> [snip]
> CdV> Better than this?
> CdV> =
> CdV> $result = mysql_query ("SELECT * FROM users WHERE id =
> '".$_GET["id"]."');
> CdV> $row_array = mysql_fetch_array ($result);
> CdV> $name= $row_array["name"];
> CdV> $address = $row_array["address"];
> CdV> $state   = $row_array["state"];
> CdV> $include("template.tpl");
> CdV> ---
> CdV> 
> CdV> 
> CdV> Name: 
> CdV> Address: 
> CdV> State: 
> CdV> ...
> CdV> ===
>
> Because you're injecting variables directly into your HTML, which some
> of the time might be ok - but what if the $row_array doesn't contain
> "name" ? You'll raise an Error Warning without first passing it
> through some kind of test (or function).

A good point.  Alternatively I could write error handling myself or
include a library/class.  This is where, in my opinion, Smarty shines, but
is not significantly different than other libraries/classes.

> You assume that the PHP short-tags are enabled () for
> echoing variables and while most the time they are, you shouldn't bank
> on it in code (incidentally, you don't need the trailing ; on the
> short-tag echos).

I was waiting for someone to ding this :-)  I have been used to using
.

> Sure - these things can be fixed easily, but then that isn't the point
> - if you think about it logically, anything Smarty can do, PHP can do
> too (well, duh! :)
>
> But what if you want to take your template and perform a bit more than
> just mere variable substitution on it? How about highlighting all
> words that match a search term, or applying logic to a display block
> based on a user status?

Another good point.  But by writing it myself or including some other
library/class I could have the same functionality.  There again, Smarty is
a great library, and I'll use it when I need it.

> Personally I don't use smarty*, but even I can see the benefits it
> offers.

Me too.  It's likely I'll use it in the future.

/dev/idal

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



Re: [PHP] Re: smarty

2004-04-14 Thread Enrico Weigelt
* pete M <[EMAIL PROTECTED]> [2004-04-14 13:50:19 +0100]:

> Moving our sites to smarty is the best thing we've done at our company...
> 
> 
> I do the php/database coding (logic)
> the html designer does the templates/css
> and the graphic designer does his bit.

I really don't like smarty. The idea is simply not right. 

The problem is, that smarty itself (or its template-language) also
contains imperative process logic. In fact it is not an real template engine,
but instead an php dialect which helps a bit on website programming. 

Smarty still lets some major problems unsolved:

+ does not separate (imperative) code from layout. it still models 
  process logic
+ such non-trivial imperative code is not suited for non-programmer's 
  (perhaps graphical) editing tools.
+ the layouter has still so learn (a subset of) php and so also has 
  to be a programmer
+ offers no clear borderline between layout definitions and application code.
  you simply can't give a customer of your application service access to
  without imposing really serious security problems.
+ bound to the php-interpreter and cannot be used w/ other languages.
+ content rendering process cannot be separated from the application server.
  (still must happen in the same process)


Well, I personally prefer the patTemplate way. 
And if you wanna see my last two points solved, then my own branch 
(pTemplate) will offer good help.


cu
-- 
-
 Enrico Weigelt==   metux IT services

  phone: +49 36207 519931 www:   http://www.metux.de/
  fax:   +49 36207 519932 email: [EMAIL PROTECTED]
  cellphone: +49 174 7066481
-
   -- DSL-Zugang ab 0 Euro. -- statische IP -- UUCP -- Hosting --
-

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



Re: [PHP] Re: smarty

2004-04-14 Thread Chris de Vidal
pete M said:
> We sit in front of a PC and mock up the forms/ pages/ nav bar etc.. That
> stuff then gets coded.

I agree, and I'm saying you can also do that with native PHP.  I plan on
doing that with the next site I build.  Then if I see that it makes sense
to use Smarty I will, but you can mock up an entire site in Microsoft Word
and templatize it with normal PHP.  I believe we'll work even faster
because Smarty isn't "in the way."

/dev/idal

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



Re: Re[2]: [PHP] smarty

2004-04-14 Thread John W. Holmes
From: "Richard Davey" <[EMAIL PROTECTED]>

> Because you're injecting variables directly into your HTML, which some
> of the time might be ok - but what if the $row_array doesn't contain
> "name" ? You'll raise an Error Warning without first passing it
> through some kind of test (or function).

Only if you have error_reporting() set high. If you have a PHP templating
solution, you'd turn error_reporting() down when you included the PHP
templates so you didn't get a warning.

> You assume that the PHP short-tags are enabled () for
> echoing variables and while most the time they are, you shouldn't bank
> on it in code (incidentally, you don't need the trailing ; on the
> short-tag echos).

You're relying on web-server writable directories when you use Smarty. It's
all a trade-off.

>  But what if you want to take your template and perform a bit more than
> just mere variable substitution on it? How about highlighting all
> words that match a search term, or applying logic to a display block
> based on a user status?

You can do this with output buffering and PHP functions. Smarty just
provides you a different interface.


Paragraph Text


vs.

{section type="highlight"}
Paragraph Text
{/section}

Yeah, I know that's not quite the Smarty syntax, but you get the idea.
Smarty just provides an easy interface to a lot of these things. It's a
tool, like a lot of others have said. :)

---John Holmes...

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



Re: [PHP] smarty

2004-04-14 Thread Enrico Weigelt
* Chris de Vidal <[EMAIL PROTECTED]> [2004-04-14 10:30:53 -0400]:


> So there are alternatives to what Smarty offers, but I also said "I just
> see them [template engines] as another tool."  It's a tool; use it where

I can't agree here. 

Template engines (in the sense we're talking here - for separating 
presentation/layout from application logic in web-like application 
environments) should be much more than just a tool, they're better 
should be considered as a fundamental component in the whole environment,
as well as the application server, the frontend webserver (httpd),
database/storage or client.

The W3C tries to establish its own template engine - XSLT - (probably
the most powerful) in the web. Of course its a little bit too 
complicated and overdozed for many small applications and quite hard
to learn for non-programmers. So there're other, more simple, 
template engines out there, i.e. patTemplate/pTemplate.


cu
-- 
-
 Enrico Weigelt==   metux IT services

  phone: +49 36207 519931 www:   http://www.metux.de/
  fax:   +49 36207 519932 email: [EMAIL PROTECTED]
  cellphone: +49 174 7066481
-
   -- DSL-Zugang ab 0 Euro. -- statische IP -- UUCP -- Hosting --
-

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



Re: [PHP] Re: smarty

2004-04-14 Thread Enrico Weigelt
* Justin French <[EMAIL PROTECTED]> [2004-04-15 00:37:41 +1000]:


> You must remember, Smarty is just a layer over PHP.  All the functions 
> that you've listed exist in pure PHP code somewhere.  It would 
> relatively easy to code equivalent templates in PHP.
Yes, you're right.

But then it should not be called a template engine, but instead a special
php dialect.

> Taking some random examples from your list:
>   {foreach from=$custid item=curr_id}
>   id: {$curr_id}
>   {/foreach}
>   becomes
>   
>   id: 
>   

Well, in patTemplate this is much cleaner and easier to understand
for non-programmers.

template:


blah

id: {id}



code:

$tmpl->addVar ( 'list', 'id', array ( 1001, 1002, 1003, 1004 ) );
$tmpl->addVar ( 'list', 'name', array ( 'joe', 'jack', jane', 'charlie' ) );


cu
-- 
-
 Enrico Weigelt==   metux IT services

  phone: +49 36207 519931 www:   http://www.metux.de/
  fax:   +49 36207 519932 email: [EMAIL PROTECTED]
  cellphone: +49 174 7066481
-
   -- DSL-Zugang ab 0 Euro. -- statische IP -- UUCP -- Hosting --
-

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



Re: [PHP] Re: smarty

2004-04-14 Thread Tim Traver
Enrico,

Actually, you can use smarty in a way that solves those issues. Simply do 
not include the logic features of smarty in your templates. That way, the 
only thing included in the templates is html, and {$variables}.

Then your web designers don't need to learn anything.

The problem that you'll find with that, is that it means you will have to 
do more html work in your back end logic to produce the same results.

Yes, it is bound to php, and yes, it has to happen on the application 
server that gets the call, but if you're using php as your application 
processing, then why would you need it to be somewhere else.

Smarty is a tool. You can choose to use the tool however you wish. If you 
have designers that are basic programmers too, then it is very powerful. If 
not, then you just have to do more of the work.

Personally, I like Smarty very much, because I do both.

Its no different than say java servlets, or xml, or any number of other 
ways to do it...

Tim.

At 08:38 AM 4/14/2004, Enrico Weigelt wrote:
* pete M <[EMAIL PROTECTED]> [2004-04-14 13:50:19 +0100]:

> Moving our sites to smarty is the best thing we've done at our company...
>
>
> I do the php/database coding (logic)
> the html designer does the templates/css
> and the graphic designer does his bit.
I really don't like smarty. The idea is simply not right.

The problem is, that smarty itself (or its template-language) also
contains imperative process logic. In fact it is not an real template engine,
but instead an php dialect which helps a bit on website programming.
Smarty still lets some major problems unsolved:

+ does not separate (imperative) code from layout. it still models
  process logic
+ such non-trivial imperative code is not suited for non-programmer's
  (perhaps graphical) editing tools.
+ the layouter has still so learn (a subset of) php and so also has
  to be a programmer
+ offers no clear borderline between layout definitions and application code.
  you simply can't give a customer of your application service access to
  without imposing really serious security problems.
+ bound to the php-interpreter and cannot be used w/ other languages.
+ content rendering process cannot be separated from the application server.
  (still must happen in the same process)
Well, I personally prefer the patTemplate way.
And if you wanna see my last two points solved, then my own branch
(pTemplate) will offer good help.
cu
--
-
 Enrico Weigelt==   metux IT services
  phone: +49 36207 519931 www:   http://www.metux.de/
  fax:   +49 36207 519932 email: [EMAIL PROTECTED]
  cellphone: +49 174 7066481
-
   -- DSL-Zugang ab 0 Euro. -- statische IP -- UUCP -- Hosting --
-
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


SimpleNet's Back !
http://www.simplenet.com


Re: [PHP] smarty

2004-04-14 Thread Enrico Weigelt
* Chris de Vidal <[EMAIL PROTECTED]> [2004-04-14 11:33:56 -0400]:


> Naww... I'd been using Smarty for several weeks now because I thought the
> only alternative to spaghetti code was Smarty, but recently I realized
> that it's not, and that simple example shows it.  I didn't realize I had
> another alternative.

Well, you should probably try patTemplate :)


cu
-- 
-
 Enrico Weigelt==   metux IT services

  phone: +49 36207 519931 www:   http://www.metux.de/
  fax:   +49 36207 519932 email: [EMAIL PROTECTED]
  cellphone: +49 174 7066481
-
   -- DSL-Zugang ab 0 Euro. -- statische IP -- UUCP -- Hosting --
-

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



Re: [PHP] Re: smarty

2004-04-14 Thread Chris de Vidal
Enrico Weigelt said:
> I really don't like smarty. The idea is simply not right.

It's a good idea; in fact, PHP was originally supposed to be a templating
engine.  You can easily separate business and presentation logic in either
PHP or Smarty.

> + does not separate (imperative) code from layout. it still models
>   process logic

To a limited extent.

> + such non-trivial imperative code is not suited for non-programmer's
>   (perhaps graphical) editing tools.

My goal is to allow my Front Page (yuck, don't have a choice) developer to
mock up an entire site and then I'll plug in PHP or Smarty template code. 
Works well.  Or I can supply an extremely sparse HTML file with PHP/Smarty
template code in it and she can mock it up.

> + the layouter has still so learn (a subset of) php and so also has
>   to be a programmer

See above...

> + offers no clear borderline between layout definitions and application
> code.
>   you simply can't give a customer of your application service access to
>   without imposing really serious security problems.

A valid concern.

> + bound to the php-interpreter and cannot be used w/ other languages.
> + content rendering process cannot be separated from the application
> server.

Another valid concern.

Hey PHP/Smarty templates aren't for everyone.  No one said they were.  But
for my next project I believe I'll be using native PHP as a template
engine.

/dev/idal

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



Re: [PHP] smarty

2004-04-14 Thread Vicente Werner
mmm some points:

1st. Clarity. It's much more clear to me to take a look at a template and 
identify a subsituing variable when it's marked as something different like:
{$var} than the uglyness of  -and if you follo the recommended way: 


2nd. As other users pointed, error handling.

3th. Lack of temptation. If I start putting pure php code on my templates it 
wouldn't be long before half the application logic ends there, we'll know 
what's to code under tight schedules. Smarty by separating my presentation 
logic from my bussines logic helps me avoid spaghetti code.

Appart from the ton of small features that smarty gives you like caching, 
easyness to do popups, the variable modificators, etc..

-- 
__
Vicente Antonio Sánchez Werner ( [EMAIL PROTECTED] )
Fijo: +34-923185650 Movil: +34-66865
Director Depto Informática, Desarrollo y Seguridad Informática
Wap Comunicaciones S.L.
C/Guadalajara nº9-11
37003 Salamanca (España)
--

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



Re: [PHP] Re: smarty

2004-04-14 Thread Chris de Vidal
Peter Morgan said:
>>>We sit in front of a PC and mock up the forms/ pages/ nav bar etc.. That
>>>stuff then gets coded.
>>
>>I agree, and I'm saying you can also do that with native PHP.
>>I plan on doing that with the next site I build.  Then if I see that it
>>makes sense to use Smarty I will, but you can mock up an entire site in
>>Microsoft Word and templatize it with normal PHP.  I believe we'll work
>>even faster because Smarty isn't "in the way."
>
> what point are you actually trying to make..

That you can also *easily* use native PHP to mock up the forms/pages/nav
bar into an HTML file.  I'm trying to tell you that Smarty isn't the
_only_ way to do what you're proposing, as I thought just a few weeks ago.
 In fact, it's simple to use native PHP to do the same thing.

If you need to see an example to understand this, take a look at my post
with the three examples (PHP spaghetti code, Smarty template, PHP
template):
http://marc.theaimsgroup.com/?l=php-general&m=108145205519710&w=2

I thought Smarty was the ONLY way to separate business logic from
presentation, but I was wrong.  It's a great tool but it's not the
be-all-end-all I thought it was.

/dev/idal

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



Re: [PHP] Re: smarty

2004-04-14 Thread Enrico Weigelt
* Tim Traver <[EMAIL PROTECTED]> [2004-04-14 09:00:24 -0700]:


>Actually, you can use smarty in a way that solves those issues. 
Not without putting much code around smarty.

> Simply not include the logic features of smarty in your templates. 
But how can I really prevent the one who writes the templates from
using php code ? And THATs one of the biggest security problems for me.

We're offering application services to our customers. The users have 
full access to the templates, so they can make their changes themselves. 
But therefore its absoluteley necessary that they can't inject any php 
code and so compromise the application server.

Smarty simply cannot provide this.



> That way, the only thing included in the templates is html, and
>{$variables}.
>Then your web designers don't need to learn anything.

The designer has to learn coding if it gets a little bit more complex.
We've tested it with our designers: they've real difficulties in 
understanding imperative process logic (which is trivial for us coders).
Instead they can work very good with simple rule-systems, which just
say "snippet visble or invisible" or "this text for this condition".
A foreach-loop is for them much harder to understand, than simply 
a snipped is a list tail.


>The problem that you'll find with that, is that it means you will have
>to do more html work in your back end logic to produce the same
>results.
Eh ? Where ? 
We're talking about different approaches for templating, not templating
vs. hardcoded text.

We never hardcode output text into applications. Instead we let patTemplate
produce all text output, even for generting config files.


>Yes, it is bound to php, and yes, it has to happen on the application
>server that gets the call, but if you're using php as your application
>processing, then why would you need it to be somewhere else.

But such a quite simple and clearly definably job like text template 
processing does not necessarily have to be written in php, nor accessing
or relying on php-functions and syntax.

We're currently working on a patTemplate implementation in plain C, 
which will then either loaded as an php-extension or an apache filter.

cu
-- 
-
 Enrico Weigelt==   metux IT services

  phone: +49 36207 519931 www:   http://www.metux.de/
  fax:   +49 36207 519932 email: [EMAIL PROTECTED]
  cellphone: +49 174 7066481
-
   -- DSL-Zugang ab 0 Euro. -- statische IP -- UUCP -- Hosting --
-

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



Re: [PHP] smarty

2004-04-14 Thread Chris de Vidal
Vicente Werner said:
> mmm some points:
>
> 1st. Clarity. It's much more clear to me to take a look at a template and
> identify a subsituing variable when it's marked as something different
> like:
> {$var} than the uglyness of  -and if you follo the recommended
> way:
> 

Tomay-toe, toh-mah-toe.

> 2nd. As other users pointed, error handling.

Possibly.  I could also custom-build it or add it with other
libraries/classes.  Smarty has it built-in, making Smarty a great choice.

> 3th. Lack of temptation. If I start putting pure php code on my templates
> it wouldn't be long before half the application logic ends there, we'll
> know what's to code under tight schedules. Smarty by separating my
> presentation logic from my bussines logic helps me avoid spaghetti code.

You must be disciplined in any case.  Smarty has loops and custom
functions and can even include real PHP.  You just have to be disciplined.

> Appart from the ton of small features that smarty gives you like caching,
> easyness to do popups, the variable modificators, etc..

Caching/popups/variable modifications can be easily added with native PHP
functions (that perhaps people aren't aware of) or with external
libraries/classes.  Smarty has them all "under one roof," making it an
excellent choice -- when it's needed.

My point is that it isn't always needed, as I thought it was.  I'm sure
others believe it's their only choice.

/dev/idal

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



Re: [PHP] Re: smarty

2004-04-14 Thread Enrico Weigelt
* Chris de Vidal <[EMAIL PROTECTED]> [2004-04-14 12:11:31 -0400]:


> Hey PHP/Smarty templates aren't for everyone.  No one said they were.  But
> for my next project I believe I'll be using native PHP as a template
> engine.

Well, I'm a little bit "unpolite" against smarty, since it seems 
that people tend to see it as "the best" (tm) and ignore other,
probably better solutions. (its the same thing w/ mysql or mailman)

One situation when I hit to the roof happened, when those folks,
where I've learned patTemplate from (content-builder) loudly talked
about switching to smarty. I know many folks (layouter's/designers)
which use content-builder because it uses _patTemplate_, since 
they understand pattemplate much better than other's like smarty.


cu
-- 
-
 Enrico Weigelt==   metux IT services

  phone: +49 36207 519931 www:   http://www.metux.de/
  fax:   +49 36207 519932 email: [EMAIL PROTECTED]
  cellphone: +49 174 7066481
-
   -- DSL-Zugang ab 0 Euro. -- statische IP -- UUCP -- Hosting --
-

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



Re: [PHP] Re: smarty

2004-04-14 Thread pete M
>> + bound to the php-interpreter and cannot be used w/ other languages.

this point is completely invalid... Haame me any other templating system 
that can be used across diffeerent languages ??

+ content rendering process cannot be separated from the application
> server.
ITS NOT AN APPLICATION SERVER
>> I really don't like smarty. The idea is simply not right.
>
DONT use smarty then. Its your choice. However there are thousands of 
users out there who THINK its RIGHT.

pete

Chris De Vidal wrote:
Enrico Weigelt said:

I really don't like smarty. The idea is simply not right.


It's a good idea; in fact, PHP was originally supposed to be a templating
engine.  You can easily separate business and presentation logic in either
PHP or Smarty.

+ does not separate (imperative) code from layout. it still models
 process logic


To a limited extent.


+ such non-trivial imperative code is not suited for non-programmer's
 (perhaps graphical) editing tools.


My goal is to allow my Front Page (yuck, don't have a choice) developer to
mock up an entire site and then I'll plug in PHP or Smarty template code. 
Works well.  Or I can supply an extremely sparse HTML file with PHP/Smarty
template code in it and she can mock it up.


+ the layouter has still so learn (a subset of) php and so also has
 to be a programmer


See above...


+ offers no clear borderline between layout definitions and application
code.
 you simply can't give a customer of your application service access to
 without imposing really serious security problems.


A valid concern.


+ bound to the php-interpreter and cannot be used w/ other languages.
+ content rendering process cannot be separated from the application
server.


Another valid concern.

Hey PHP/Smarty templates aren't for everyone.  No one said they were.  But
for my next project I believe I'll be using native PHP as a template
engine.
/dev/idal
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Re: smarty

2004-04-14 Thread Chris de Vidal
Enrico Weigelt said:
> Well, I'm a little bit "unpolite" against smarty, since it seems
> that people tend to see it as "the best" (tm) and ignore other,
> probably better solutions. (its the same thing w/ mysql or mailman)

I'm "unpolite" against Smarty because I used to think PHP couldn't
*easily* do most of* what Smarty can and that's simply not true.

* By that I mean, as I have been stating, there are cases when Smarty just
plain makes sense to use, even as a templating engine, and there are cases
when I can template with native PHP with about the same effort as with
Smarty.

/dev/idal

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



[PHP] Session confusion again :( - Thanks!

2004-04-14 Thread BOOT
Any help with this would be appreciated. the p and v lnames are posted from
a form. In the form, the user seperates last names with a "/". What I can't
understand is why Test1 shows as nothing, while Test2 shows the value I
wanted. Thanks a lot!


$p_lnames= explode("/", $p_lnames);


$_SESSION['element_countp'] = count($p_lnames);


echo "TEST 1".$element_countp;


$element_countp = $_SESSION['element_countp'];


echo "TEST 2".$element_countp;

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



RE: [PHP] Session confusion again :( - Thanks!

2004-04-14 Thread Chris W. Parker
BOOT 
on Wednesday, April 14, 2004 9:40 AM said:

> What I can't understand is why Test1 shows as nothing, while
> Test2 shows the value I wanted. Thanks a lot!

[snip]

> $_SESSION['element_countp'] = count($p_lnames);
> echo "TEST 1".$element_countp;
> 
> $element_countp = $_SESSION['element_countp'];
> echo "TEST 2".$element_countp;

because in test 1 $element_countp has not been assigned anything yet.

$_SESSION['element_countp'] and $element_countp are *not* the same
variable (it appears that you think they are).

in test 2 you assign the value of $_SESSION['element_countp'] to
$element_countp so that's why test 2 works.


hth,
chris.

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



RE: [PHP] Session confusion again :( - Thanks!

2004-04-14 Thread Ford, Mike [LSS]
On 14 April 2004 17:40, BOOT wrote:

> Any help with this would be appreciated. the p and v lnames are
> posted from a form. In the form, the user seperates last names with a
> "/". What I can't understand is why Test1 shows as nothing, while
> Test2 shows the value I wanted. Thanks a lot!
> 
> 
> $p_lnames= explode("/", $p_lnames);
> 
> 
> $_SESSION['element_countp'] = count($p_lnames);
> 
> 
> echo "TEST 1".$element_countp;

Because here, you haven't assigned anything to $element_countp -- you've
only assigned it to $_SESSION['element_countp'].  (With register_globals
Off, the two are not the same.)  If you turned your error_reporting level up
to E_ALL, you'd probably get a warning at this point saying that
$element_countp is undefined.

> 
> 
> $element_countp = $_SESSION['element_countp'];
> 
> 
> echo "TEST 2".$element_countp;

Now you've assigned a value to $register_countp, so you get it output.

Cheers!

Mike

-
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning & Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Beckett Park, LEEDS,  LS6 3QS,  United Kingdom
Email: [EMAIL PROTECTED]
Tel: +44 113 283 2600 extn 4730  Fax:  +44 113 283 3211 

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



RE: [PHP] Session confusion again :( - Thanks!

2004-04-14 Thread Paul Fine
Thanks guys but I have register globals ON so once the session variable is
defined I should be able to address it without specifying $_SESSION ?

-Original Message-
From: Chris W. Parker [mailto:[EMAIL PROTECTED] 
Sent: April 14, 2004 11:48 AM
To: BOOT; [EMAIL PROTECTED]
Subject: RE: [PHP] Session confusion again :( - Thanks!

BOOT 
on Wednesday, April 14, 2004 9:40 AM said:

> What I can't understand is why Test1 shows as nothing, while
> Test2 shows the value I wanted. Thanks a lot!

[snip]

> $_SESSION['element_countp'] = count($p_lnames);
> echo "TEST 1".$element_countp;
> 
> $element_countp = $_SESSION['element_countp'];
> echo "TEST 2".$element_countp;

because in test 1 $element_countp has not been assigned anything yet.

$_SESSION['element_countp'] and $element_countp are *not* the same
variable (it appears that you think they are).

in test 2 you assign the value of $_SESSION['element_countp'] to
$element_countp so that's why test 2 works.


hth,
chris.

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



[PHP] quickie survey

2004-04-14 Thread Dennis Gearon
I am doing a site where some of the pages will show various hours of 
some businesses.

To make life easier for searching for open businesses PER DAY, I have 
pretty much decided to make an arbitrary dat-to-day boundary, instead of 
the usual midnight boundary. Some businesses that this applies to are 
bars, restaurants, dances, and even the hours of regular blue collar 
jobs for factories that have 24/7 operation.

My survey is, what hour would you pick if you were to do that? Examples 
might be any time after midnight (none before). I could make each 
listing have it's own variable day-to-day boundary, but I'd prefer to 
have one site wide boundary.
   1AM through 6AM for examples. Even hours.

   Send me your vote, and I will summarize it and post it to the list. 
This might be useful information for design work by others on this site. 
I've heard a lot of other php coders working on similar projects.

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


Re: Re[2]: [PHP] smarty

2004-04-14 Thread Enrico Weigelt
* John W. Holmes <[EMAIL PROTECTED]> [2004-04-14 11:57:00 -0400]:


> You're relying on web-server writable directories when you use Smarty. 
> It's all a trade-off.

This gets problematic in multi-user environments. You cant use mod_php
anylonger, instead you have to switch to slow cgi+suexec.

Okay, w/ metuxmpm this problem goes away - each vhost can get its 
own uid - but its not 100% stable yet (some rarely situations w/
recoursive requests seem to make MT problems)

> >  But what if you want to take your template and perform a bit more than
> > just mere variable substitution on it? How about highlighting all
> > words that match a search term, or applying logic to a display block
> > based on a user status?
> 
> You can do this with output buffering and PHP functions. Smarty just
> provides you a different interface.

Output Buffering is a bad hack.

The original branch of content-builder's base template system used this,
but I've completely removed this - now there's exactly one print call
at the very end of the page processing. If there have to be snippets
rendered separately, it goes directly into variables or the template-engine's
internal buffers (required when template processing run in a different
process or host)


cu
-- 
-
 Enrico Weigelt==   metux IT services

  phone: +49 36207 519931 www:   http://www.metux.de/
  fax:   +49 36207 519932 email: [EMAIL PROTECTED]
  cellphone: +49 174 7066481
-
   -- DSL-Zugang ab 0 Euro. -- statische IP -- UUCP -- Hosting --
-

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



[PHP] Mail Functions on File

2004-04-14 Thread Daryl Meese
Hello all,

Is it possible to use the imap functions on a file instead of opening a mail box via 
imap_open?

I have create virtual users and am having a large amount of difficulty getting 
authentication to work.  Since they will be checking their email through our software, 
and have already authenticated to use it, I would like to just open the file then use 
the imap_* functions to process it.

TIA,

Daryl Meese

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

Re: [PHP] smarty

2004-04-14 Thread Curt Zirzow

:0
* ^Subject: Re: smarty 
/dev/null

Curt
-- 
"I used to think I was indecisive, but now I'm not so sure."

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



Re[4]: [PHP] smarty

2004-04-14 Thread Richard Davey
Hello John,

Wednesday, April 14, 2004, 4:57:00 PM, you wrote:

JWH> Only if you have error_reporting() set high. If you have a PHP templating
JWH> solution, you'd turn error_reporting() down when you included the PHP
JWH> templates so you didn't get a warning.

John I'm shocked - of all people I would expect you to be an advocate
of coding something that even E_ALL won't complain about.

JWH> You can do this with output buffering and PHP functions. Smarty just
JWH> provides you a different interface.

Isn't that the whole point of it? :) besides it's not just a different
interface - if you make a mistake you have a chance that smarty will
catch this and deal with it nicely for you. A "pure" PHP "engine"
(sic) will not, you get a function name wrong and the site will brake.

Sure.. you can code around it.. but then if you keep playing that
card, soon enough you've written your own Smarty replacement, which is
somewhat ironic, no?

-- 
Best regards,
 Richard Davey
 http://www.phpcommunity.org/wiki/296.html

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



Re: [PHP] smarty

2004-04-14 Thread pete M
Curt Zirzow wrote:
:0
* ^Subject: Re: smarty 
/dev/null

Curt


agreed

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


[PHP] php and mysql help

2004-04-14 Thread webmaster
Hello i need help with mysql_create_db i found the solution once but cant remember 
what it was if someone could tell me the proper way to create a database with php and 
mysql i would be greatly thankfull.
Thank you.


Re: [PHP] php and mysql help

2004-04-14 Thread Curt Zirzow
* Thus wrote webmaster ([EMAIL PROTECTED]):
> Hello i need help with mysql_create_db i found the solution once but cant remember 
> what it was if someone could tell me the proper way to create a database with php 
> and mysql i would be greatly thankfull.

You just need to issue a create database statement passed to
mysql_query()

mysql_create_db() is depricated and isn't available in php that is
compiled with the mysql4 client libraries.


Curt
-- 
"I used to think I was indecisive, but now I'm not so sure."

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



RE: [PHP] php and mysql help

2004-04-14 Thread Jay Blanchard
[snip]
Hello i need help with mysql_create_db i found the solution once but
cant remember what it was if someone could tell me the proper way to
create a database with php and mysql i would be greatly thankfull.
Thank you.
[/snip]

http://www.php.net/mysql_create_db
You're welcome.

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



[PHP] setcookie statements are giving me error

2004-04-14 Thread Ryan Schefke
 

I'm trying to set multiple cookies and getting the error below. I removed
all of the white spaces and extra lines before and after my ,
so, that shouldn't be an issue. I get the error for each cookie and it
echoes back as "...cookie not set" like I coded. 

This is the code chunk I'm trying to run, which is called using "require
("setcookie.php");" from my main script. There aren't any extra spaces in my
main script because I can replace the require line with "header ('Location:
http://www.anything.com');" and it will redirect successfully without any
cannot modify header errors, which tells me there's nothing wrong with my
main script. Am I doing something wrong with cookies here? 

"Warning: Cannot modify header information - headers already sent by."

 

 setcookie ("acctActive_ck", "$daysRemaining"); //set cookie for active
account, will terminate when browser window closes
 if (setcookie("acctActive_ck")) { echo "active cookie set"; } else { echo
"active cookie not set";}
 setcookie ("login_ck", "$lo"); //set cookie for active account, will
terminate when browser window closes
 if (setcookie("login_ck")) { echo "login cookie set"; } else { echo "login
cookie not set";}
 setcookie ("password_ck", "$pw"); //set cookie for password, will terminate
when browser window closes
 if (setcookie("password_ck")) { echo "pw cookie set"; } else { echo "pw
cookie not set";}

 

 

Thanks a million,

Ryan



RE: [PHP] Session confusion again :( - Thanks!

2004-04-14 Thread Dennis Gearon
"'Chris W. Parker'" <[EMAIL PROTECTED]> elucidated:

Thanks guys but I have register globals ON so once the session variable is
defined I should be able to address it without specifying $_SESSION ?


WHERE do you have it on? Most sites now have it turned off for VERY valid security reasons. If you are turning it on in your prepend file - Sorry, too late.

The only two places to turn it back on, to my knowledge, is in your ini file for the site, or your .htaccess file as a directive. Only those two places are before the GPC processing.

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


[PHP] WIERD list behavior

2004-04-14 Thread Dennis Gearon
When I make a posting to this list, I get an email like below:
---
Subject: Thank you
From: "Advance Credit Suisse Bank" <[EMAIL PROTECTED]>
Date: Wed, 14 Apr 2004 12:03:35 -0700
To: Dennis Gearon <[EMAIL PROTECTED]>
ADVANCE CREDIT SUISSE BANK 

Address: BÃrsenstrasse 15   

P. O. Box CH - 8022 Zurich

Tel: +41 76 5319587 

Fax: + 41 795314-CSB 

Telegram: + 812 400 SNA DCS





Thank you !!
---
FULL VERSION w/ HEADERS
---
From - Wed Apr 14 12:02:43 2004
X-UIDL: <[EMAIL PROTECTED]>
X-Mozilla-Status: 0001
X-Mozilla-Status2: 
X-POP3-Rcpt: [EMAIL PROTECTED]
Return-Path: <[EMAIL PROTECTED]>
Received: from host79.ipowerweb.com (host79.ipowerweb.com [66.235.200.179])
by phaze.fireserve.net (8.12.10/linuxconf) with ESMTP id i3EJ3ccj003363
for <[EMAIL PROTECTED]>; Wed, 14 Apr 2004 12:03:38 -0700
Received: from advance- by host79.ipowerweb.com with local (Exim 4.20)
id 1BDpfb-0004qD-JK
for [EMAIL PROTECTED]; Wed, 14 Apr 2004 12:03:35 -0700
To: Dennis Gearon <[EMAIL PROTECTED]>
X-Autorespond: RE: [PHP] Session confusion again :( - Thanks!
X-Loop: Dennis Gearon <[EMAIL PROTECTED]>
From: "Advance Credit Suisse Bank" <[EMAIL PROTECTED]>
Content-type: text/plain; charset=us-ascii
Subject: SPAM Thank you
Message-Id: <[EMAIL PROTECTED]>
Date: Wed, 14 Apr 2004 12:03:35 -0700
X-AntiAbuse: This header was added to track abuse, please include it with any abuse 
report
X-AntiAbuse: Primary Hostname - host79.ipowerweb.com
X-AntiAbuse: Original Domain - fireserve.net
X-AntiAbuse: Originator/Caller UID/GID - [34460 34460] / [47 12]
X-AntiAbuse: Sender Address Domain - host79.ipowerweb.com
X-MailScanner: Found to be clean
X-MailScanner-SpamCheck: spam, SpamAssassin (score=7.4, required 6, BAYES_99,
RCVD_IN_BNBL)
X-MailScanner-SpamScore: sss
ADVANCE CREDIT SUISSE BANK 

Address: BÃrsenstrasse 15   

P. O. Box CH - 8022 Zurich

Tel: +41 76 5319587 

Fax: + 41 795314-CSB 

Telegram: + 812 400 SNA DCS





Thank you !!

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


Re: [PHP] Session confusion again :( - Thanks!

2004-04-14 Thread BOOT
Yes in php.ini. I never bothered turning off as (a) I did not take the time
to understand the implications and (b) my project is only for internal
network use anyway.

So I went and turned them off. Now of course my pages don't work properly. I
guess I have to go through all my code and address the variables properly
ie. $_POST and $_SESSION?

Thanks!



"Dennis Gearon" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> "'Chris W. Parker'" <[EMAIL PROTECTED]> elucidated:
>
> >Thanks guys but I have register globals ON so once the session variable
is
> >defined I should be able to address it without specifying $_SESSION ?
>
>
> WHERE do you have it on? Most sites now have it turned off for VERY valid
security reasons. If you are turning it on in your prepend file - Sorry, too
late.
>
> The only two places to turn it back on, to my knowledge, is in your ini
file for the site, or your .htaccess file as a directive. Only those two
places are before the GPC processing.

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



[PHP] Junk characters in e-mail

2004-04-14 Thread Anders Norrbring

Hi!
First of all, I have no idea if my problem is php or Postfix related, thus the 
cross-post.

Every e-mail sent out from my server by a php script ends with a string of junk 
characters, they're not the same from different scripts and of course not to be found 
anywhere in the code.

Example:

Thank you!
4 ^m NÉ*Nj j yuÉ8=j{*Ì


As of what I know, every file, including the html and php files are UTF-8 encoded to 
be able to cope with Swedish characters, but the Swedish characters haven't been 
present in the e-mails I've tested with so far.

Any ideas?

Thanks,
Anders Norrbring

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



Re: [PHP] setcookie statements are giving me error

2004-04-14 Thread Curt Zirzow
* Thus wrote Ryan Schefke ([EMAIL PROTECTED]):
> 
> cannot modify header errors, which tells me there's nothing wrong with my
> main script. Am I doing something wrong with cookies here? 
> 
> "Warning: Cannot modify header information - headers already sent by."

You're missing the most important part of the message, like at
exactly what line the output started.
 
> 
>  setcookie ("acctActive_ck", "$daysRemaining"); //set cookie for active
> account, will terminate when browser window closes
>  if (setcookie("acctActive_ck")) { echo "active cookie set"; } else { echo
> "active cookie not set";}

No other cookie can be set after this line. Headers are sent once
you echo something.


Curt
-- 
"I used to think I was indecisive, but now I'm not so sure."

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



RE: [PHP] Junk characters in e-mail

2004-04-14 Thread Jay Blanchard
[snip]
First of all, I have no idea if my problem is php or Postfix related, thus the 
cross-post.

Every e-mail sent out from my server by a php script ends with a string of junk 
characters, they're not the same from different scripts and of course not to be found 
anywhere in the code.

Example:

Thank you!
4 ^m NÉ*Nj j yuÉ8=j{*Ì


As of what I know, every file, including the html and php files are UTF-8 encoded to 
be able to cope with Swedish characters, but the Swedish characters haven't been 
present in the e-mails I've tested with so far.

Any ideas?
[/snip]

It's probably somewhere in your code. Having not seen the code though, I cannot answer 
this conclusively and may be wrong.


RE: [PHP] Session confusion again :( - Thanks!

2004-04-14 Thread Chris W. Parker
BOOT 
on Wednesday, April 14, 2004 12:17 PM said:

> So I went and turned them off. Now of course my pages don't work
> properly. I guess I have to go through all my code and address the
> variables properly ie. $_POST and $_SESSION?

no.

just assign them at the beginning of your file.

CURRENT FILE:


WHAT I THINK YOU WOULD CHANGE IT TO:


WHAT YOU SHOULD DO INSTEAD:


of course. don't forget to validate your incoming data.


hth,
chris.  

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



Re: [PHP] Session confusion again :( - Thanks!

2004-04-14 Thread BOOT
But if I want to use $username accross many pages then I will have to make
it a session variable and call it as such on each page like
"$_SESSION['username']"

Thanks again!



"Chris W. Parker" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
BOOT 
on Wednesday, April 14, 2004 12:17 PM said:

> So I went and turned them off. Now of course my pages don't work
> properly. I guess I have to go through all my code and address the
> variables properly ie. $_POST and $_SESSION?

no.

just assign them at the beginning of your file.

CURRENT FILE:


WHAT I THINK YOU WOULD CHANGE IT TO:


WHAT YOU SHOULD DO INSTEAD:


of course. don't forget to validate your incoming data.


hth,
chris.

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



RE: [PHP] Junk characters in e-mail

2004-04-14 Thread Anders Norrbring
> [snip]
> First of all, I have no idea if my problem is php or Postfix related, thus
> the cross-post.
> 
> Every e-mail sent out from my server by a php script ends with a string of
> junk characters, they're not the same from different scripts and of course
> not to be found anywhere in the code.
> 
> Example:
> 
> Thank you!
> 4 ^m NÉ*Nj j yuÉ8=j{*Ì
> 
> 
> As of what I know, every file, including the html and php files are UTF-8
> encoded to be able to cope with Swedish characters, but the Swedish
> characters haven't been present in the e-mails I've tested with so far.
> 
> Any ideas?
> [/snip]
> 
> It's probably somewhere in your code. Having not seen the code though, I
> cannot answer this conclusively and may be wrong.


Would that mean the scripts running or the php code itself?  If you're helped by it, I 
can send you the php scripts, they're very small.

Anders.

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



RE: [PHP] Session confusion again :( - Thanks!

2004-04-14 Thread Chris W. Parker
BOOT 
on Wednesday, April 14, 2004 12:37 PM said:

> But if I want to use $username accross many pages then I will have to
> make it a session variable and call it as such on each page like
> "$_SESSION['username']"

correct.



c.

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



RE: [PHP] WIERD list behavior

2004-04-14 Thread Chris W. Parker
Dennis Gearon 
on Wednesday, April 14, 2004 12:08 PM said:

> When I make a posting to this list, I get an email like below:

just ignore it.

this list seems to be plagued with illegitimate auto-replys. but i guess
that's sort of an oxymoron isn't it?



chris.

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



RE: [PHP] setcookie statements are giving me error

2004-04-14 Thread Ryan Schefke
Curt,

Thanks.  That was the issue.  Am I allowed to redirect directly below the
setcookie functions using "header ('Location"

Thanks,
Ryan
==

-Original Message-
From: Curt Zirzow [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, April 14, 2004 3:29 PM
To: [EMAIL PROTECTED]
Subject: Re: [PHP] setcookie statements are giving me error

* Thus wrote Ryan Schefke ([EMAIL PROTECTED]):
> 
> cannot modify header errors, which tells me there's nothing wrong with my
> main script. Am I doing something wrong with cookies here? 
> 
> "Warning: Cannot modify header information - headers already sent by."

You're missing the most important part of the message, like at
exactly what line the output started.
 
> 
>  setcookie ("acctActive_ck", "$daysRemaining"); //set cookie for active
> account, will terminate when browser window closes
>  if (setcookie("acctActive_ck")) { echo "active cookie set"; } else { echo
> "active cookie not set";}

No other cookie can be set after this line. Headers are sent once
you echo something.


Curt
-- 
"I used to think I was indecisive, but now I'm not so sure."

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

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



[PHP] patTemplate

2004-04-14 Thread Enrico Weigelt

BTW: is there anyone (beside me) who uses patTemplate ?


cu
-- 
-
 Enrico Weigelt==   metux IT services

  phone: +49 36207 519931 www:   http://www.metux.de/
  fax:   +49 36207 519932 email: [EMAIL PROTECTED]
  cellphone: +49 174 7066481
-
   -- DSL-Zugang ab 0 Euro. -- statische IP -- UUCP -- Hosting --
-

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



[PHP] unexpected $ in ... WTF?

2004-04-14 Thread Brian V Bonini
Parse error: parse error, unexpected $ in /foo/bar/foo.php4 on line 150

146: 
147: 

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



Re: [PHP] unexpected $ in ... WTF?

2004-04-14 Thread John Nichel
Brian V Bonini wrote:
Parse error: parse error, unexpected $ in /foo/bar/foo.php4 on line 150

146: 
147: 
Your error is going to be somewhere above that in the script.  Forgot a 
semi-colon, closing bracket/brace/etc, etc.

--
***
*  _  __   __  __   _  * John  Nichel *
* | |/ /___ __ \ \/ /__ _ _| |__ ___  __ ___ _ __  * 716.856.9675 *
* | ' http://www.KegWorks.com[EMAIL PROTECTED] * 14203 - 1321 *
***
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Re: Command line include path?

2004-04-14 Thread Justin Patrin
Mike Zornek wrote:

I'm getting started with PEAR's DB_DataObject and am trying to follow along
with the tutorial:
http://pear.php.net/manual/en/package.database.db-dataobject.intro-purpose.p
hp
It tells me to create the ini file (which I did) and then run
createTables.php from the command line to generate my class files. I'm
trying to run it and am running into an include issue:
zorn$ php -f createTables.php
/Library/WebServer/Websites/ASMP/config/DB_DataObject.ini
Warning: main(DB/DataObject/Generator.php): failed to open stream: No such
file or directory in /usr/local/php/lib/php/DB/DataObject/createTables.php
on line 22
Fatal error: main(): Failed opening required 'DB/DataObject/Generator.php'
(include_path='.:/usr/lib/php') in
/usr/local/php/lib/php/DB/DataObject/createTables.php on line 22
-- Does the command line have it's own include path. Based on my phpinfo()
mine is: .:/usr/local/php/lib/php
~ Mike
-
Mike Zornek
Web Designer, Media Developer, Programmer and Geek
Personal site: 
New Project: 
THe CLI version of PHP generally does have a different php.ini. Try 
doing "locate php.ini" and seeing if you find another one. Or, you can 
try: "locate php | grep ini" in case it's named php-cli.ini (for instance).

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


Re: [PHP] unexpected $ in ... WTF?

2004-04-14 Thread Daniel Clark
What about line 148 the "{" ... supposed to be there?


> Brian V Bonini wrote:
>> Parse error: parse error, unexpected $ in /foo/bar/foo.php4 on line 150
>>
>> 146: 
>> 147: > 148: }
>> 149: include "foobar.inc.php4";
>> 150: ?>

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



Re: [PHP] unexpected $ in ... WTF?

2004-04-14 Thread John W. Holmes
From: "Brian V Bonini" <[EMAIL PROTECTED]>

> Parse error: parse error, unexpected $ in /foo/bar/foo.php4 on line 150
> 
> 146: 
> 147:  148: }
> 149: include "foobar.inc.php4";
> 150: ?>

You missed a closing bracket or quote somewhere.

---John Holmes...

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



Re: [PHP] unexpected $ in ... WTF?

2004-04-14 Thread Curt Zirzow
* Thus wrote Brian V Bonini ([EMAIL PROTECTED]):
> Parse error: parse error, unexpected $ in /foo/bar/foo.php4 on line 150

You're missing a } somewhere.



Curt
-- 
"I used to think I was indecisive, but now I'm not so sure."

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



Re: [PHP] patTemplate

2004-04-14 Thread Adrian Madrid
Enrico Weigelt wrote:

BTW: is there anyone (beside me) who uses patTemplate ?

cu
 

I'm not currenlty using pattemplate but I would like to test it. What's 
the status? Looking at the website it shows 2.5 as unstable and CVS 
looks like is a full rewrite. Should I test 2.4, 2.5 or 3.0 (CVS)?

Thanks in advance,



--
Adrian Madrid
http://www.hyperxmedia.com
HyperX Media
45 West 9000 South, Unit 2
Sandy, UT 84020
Office: 801.566.0670

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

Re: [PHP] Never mind ... stupid me :-/ {was Re: [PHP] ereg-replace ... how to catch :'( [crying smiley] ???}

2004-04-14 Thread -{ Rene Brehmer }-
At 15:02 14-04-2004, Tom Rogers wrote:
Hi,

Thursday, April 15, 2004, 12:51:20 AM, you wrote:
RB> Never mind y'all ... me stupid ...
RB> obviously the ( has meaning, and needs to be escaped ... was starting to
RB> think it could only do 2 ereg's in 1 script *sigh*
RB> Sorry for wasting time and bandwidth ... the function now looks like this
RB> and works :
You might find this very useful :)

http://weitz.de/regex-coach/

Helps my old brain 
Hmm ... that looks like it only does Perl-based regex ???  Thing is the 
programs I normally do regex in either use Posix based or Unix (Cshell) 
based (mostly used at the latter, cuz that's what Forte Agent uses for its 
filters) ... how big a difference is there from the posix based to the perl 
based anyway ??? ... the samples in the manual ain't the same for 
preg_replace() and ereg_replace(), so it's a bit hard to get a quick 
glimpse of how big the difference really is ... (or for the _match() ones 
for that matter)...

But thx ... looks useful :)

Rene

--
Rene Brehmer
aka Metalbunny
~ If you don't like what I have to say ... don't read it ~

http://metalbunny.net/
References, tools, and other useful stuff...
Check out the new Metalbunny forums @ http://forums.metalbunny.net/
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Re: php and mysql help

2004-04-14 Thread Eric Bolikowski

"Webmaster" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
Hello i need help with mysql_create_db i found the solution once but cant
remember what it was if someone could tell me the proper way to create a
database with php and mysql i would be greatly thankfull.
Thank you.



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



[PHP] Looking for good Mail List Manager

2004-04-14 Thread James Marcinek
Can any of you guys recommend a good Mail List
Manager? I see several on sourceforge but would like
to hear from people that have some experience with
these...

Thanks,

James




__
Do you Yahoo!?
Yahoo! Tax Center - File online by April 15th
http://taxes.yahoo.com/filing.html

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



Re: [PHP] Looking for good Mail List Manager

2004-04-14 Thread Joshua D. Drake
Mailman

James Marcinek wrote:

Can any of you guys recommend a good Mail List
Manager? I see several on sourceforge but would like
to hear from people that have some experience with
these...
Thanks,

James



__
Do you Yahoo!?
Yahoo! Tax Center - File online by April 15th
http://taxes.yahoo.com/filing.html
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Re: Looking for good Mail List Manager

2004-04-14 Thread Justin Patrin
James Marcinek wrote:

Can any of you guys recommend a good Mail List
Manager? I see several on sourceforge but would like
to hear from people that have some experience with
these...
Thanks,

James



__
Do you Yahoo!?
Yahoo! Tax Center - File online by April 15th
http://taxes.yahoo.com/filing.html
ezmlm

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


[PHP] PHP and Oracle RAC

2004-04-14 Thread Kevin O'Brien
Has anyone succesfully got PHP and Oracle Real Application Cluster (RAC) working 
together?
 
-=Kevin=-


-
Do you Yahoo!?
Yahoo! Tax Center - File online by April 15th

  1   2   >