[PHP] Re: Anybody have any thoughts on Smarty?

2003-03-20 Thread David Eisenhart
Smarty is a fantastic tool.

One of it's really great features (compared with a couple of other
templating engines that I have looked at) is the inherent ability to include
logic (using smary syntax) in the templates. This'll sound a bit odd - after
all, a point of templates is to separate logic and presentation. However, it
is really handy to be able to include 'presentation logic' in the
presentation layer. For example, contained in a template a very simple eg
in pseudo terms:

if form validated then
show success message
else
show failure message

From your code you pass this template the form validated variable value and
it shows the appropriate message. Without the ability to do this (as in
other
templating engines) you find that your logic code becomes cluttered with
presentation issues. Hence Smarty facilitates a much cleaner separation of
logic and presentation.

However, this does mean that either your page designer has to get to grips
with introducing smarty code into his/her templates or you must add such
code to his/her templates. Though for the reason above (and others) it is
well
worth giving it a try.

David



Charles Kline [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Was reading this and it sounds really cool. I do work as a consultant
 to designers and thought this may be a good way to improve work flow? I
 have read mixed thoughts on this, but was wondering what this list
 thought? Anyone using it? Real world?

 http://www.zend.com/zend/tut/tutorial-cezar.php

 Thanks,
 Charles






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



[PHP] Re: PHP XML Reference

2003-03-14 Thread David Eisenhart
check out the book XML and PHP by Vikram Vaswani, News Riders; a well
written and concise treatment of xml and php.

David Eisenhart



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



[PHP] Re: Collating Values from database fields

2003-03-14 Thread David Eisenhart
Matt,

You are looking at least 2 separate select queries - one to retrieve the
player data on a tournament by tournament basis and a second query to
'calculate' the summary data. Now, you will be needing the GROUP BY clause
in the second query while drawing on at least the player and appearances
tables (check out GROUP BY in the MySQL (I assume you are using MySQL)
online manual.) Then simply print out the results of the respective select
queries.

David Eisenhart


Matt Macleod [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Hi,

 I'm building a site for my rugby club and I want to present players'
 data ie: number of appearances, points scored and so on.

 I have three tables in my database: a table of tournaments (date,
 location, opposition, etc), a table of players (name, contact details,
 position, etc) and a table of appearances (fixtureID, playerID, tries
 scored, penalties scored, cautions etc.

 When a player is selected from a drop-down list, their data will appear
 in a table by drawing from the 'appearances' table based on the player's
 ID thus:

 Player: Matt MacLeod
 -
 Tournament 1 / 19/01/2003 / 2 tries / 0 pens / 0 cautions
 Tournament 2 / 24/03/2003 / 4 tries / 3 pens / 1 caution
 Tournament 3 / 27/03/2003 / 0 tries / 3 pens / 0 cautions

 I then want to print the player's totals thus:

 3 tournaments / 6 tries / 6 pens / 1 caution

 This is where I get stuck. I know how to display the data on a
 tournament by tournament bais, and get PHP to build an additional table
 row for each appearance by the player, but I am unsure of how to add up
 the columns and print the totals at the end of the table.

 Any help would be greatly appreciated.
 Thanks,

 Matt








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



Re: [PHP] PHP/HTML table layout?

2003-03-13 Thread David Eisenhart
if you don't go for fixed widths, yet you want to ensure that the columns do
not go 'below' a certain value a neat trick is to create a row (or use an
existing row) and populate it with blank gifs - one in each column and each
one the 'minimum' desired width of its respective column.(with a height of,
say, 1 pixel)

David Eisenhart



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



[PHP] Re: PHP Books

2003-03-12 Thread David Eisenhart
I've invested quite heavily in php books, the 2 most useful by a long way
are:
1) Programming PHP, O'Reilly, Rasmus Lerdorf  Kevin Tatroe - a truly superb
book; its concise, well written and just seems to hit the mark. A must for
any aspiring php programmer!
2) PHP Functions, Essential Reference, New Riders; as it says on the tin -
its a php function reference. Ok, one can use the php manual and I even
believe that this book is online, but it doesn't beat, in my view, having
the thing on the desk next to you As well being convenient the functions are
particularly well explained with descent examples (from which I've borrowed
heavily towards my own code)

2 honourable mentions:
1) Web Database Applications with Php and MySQL, O'Reilly - some good
insights and a great coverage of sessions; however is a tad verbose and I am
not too hot on the case study presented throughout the book. Well worth
buying though.
2) Web Application Development with PHP 4.0; this is an interesting read
though is not so good if you are just starting out due to its advanced
nature; it also shows its age in places

Happy reading!!

David Eisenhart.









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



[PHP] Re: Message Board Question

2003-03-11 Thread David Eisenhart
This is a good article on pagination:
http://www.phpfreaks.com/tutorials/43/0.php

David Eisenhart

Conbud [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Hi, this is kind of a complex question, Im making a message board, now I
 dont want list, lets say, all 25 messages on the same page. I would like
 to have - previous 1 2 3 next - type of links and only list 5 messages
 per page and every time a user clicks the next, previous, or one of the
 page number links it will list the next 5 messages that havn't been
 listed yet. Could someone show me how to do this or at least point me in
 the correct direction ? The data is all stored in a MySQL database.

 Thanks,

 --
 Conbud [EMAIL PROTECTED]
 Graphic  Web Design Using Open Source Technology
 --




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



[PHP] Re: reversing attribute in array of objects

2003-03-11 Thread David Eisenhart
if I've understood you correctly how about something like:

$valArr = array();
for($i=0;$icount($objArr);$i++){
 array_push($valArr, $objArr[$i]-level);
}

$valArr = array_reverse($valArr);

for($i=0;$icount($objArr);$i++){
$objArr[$i]-level = $valArr[$i];
}

David Eisenhart


Neko [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 I have a bit of a good one for you guys:

 I have an array of objects which have an attribute $level (I use
 $obj-get/setLevel() to access it).

 Now, this array consists of these objects with $level in descending order,
 and the same $level int can be set to multiple objects (in order), eg:

 $objArr[0]-level = 5
 $objArr[1]-level = 5
 $objArr[2]-level = 4
 $objArr[3]-level = 3
 $objArr[4]-level = 2
 $objArr[5]-level = 2
 $objArr[6]-level = 2
 $objArr[7]-level = 1

 what I want to do is to reverse the $level attribute for the objects (not
 the objects themselves!!!) in the array by using the $level attribute, so
in
 this case I'd end up with:

 $objArr[0]-level = 1
 $objArr[1]-level = 2
 $objArr[2]-level = 2
 $objArr[3]-level = 2
 $objArr[4]-level = 3
 $objArr[5]-level = 4
 $objArr[6]-level = 5
 $objArr[7]-level = 5

 Any tips on this one?

 --
 cheers,
 neko





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



[PHP] Re: pagination help

2003-03-09 Thread David Eisenhart
This is a good article on pagination:
http://www.phpfreaks.com/tutorials/43/0.php

David Eisenhart


Denis L. Menezes [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
Hello friends.

My records on one page are bout 200. So I wish to paginate them and show
only about 20 records per page with the page numbers at the bottom of the
records table and also the previous and next links.
I mean, something line Google's searcg results page numbering system.

Can someone give me a link to some help files?

Thanks
Denis





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



[PHP] Re: Member function as error_handler

2003-03-09 Thread David Eisenhart
I'd recommend that you consider using the set_error_handler function.

This'll let you create and use your own custom error handler function (which
is fired for errors of the E_ERROR, E_WARNING and E_NOTICE type and also
those errors that you deliberately trigger using trigger_error()) - very
handy indeed!

Of course rather than doing this on every page place such code in a single
file and include this file (using the include construct or variation on
this) within all your site pages.

Hope this helps.

David Eisenhart



Nik Makepeace [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Query One: Can I use a member function of an object as an error_handler?

 I currently declare a function for error handling with every page, but I
 would like to put it in an object which lives in the session anyway. The
 problem is I can't seem to do it; when I try to set the error handler to
 a method, it defaults to PHP's usual methods. Is it me or PHP?

 MTIA,
 Nik
 --
 http://travelog.uberblog.com/








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



[PHP] Re: MySQL Query

2003-03-05 Thread David Eisenhart
If I understand your requirement correctly I would say that you are looking
in the wrong place to protect particular table fields from the user; the
user gets access to the underlying database only through your 'application'
pages (ie. your php pages) - it is your coding of these pages that
determines what the user can not and can not do in the underlying database
(ok, the database permissions also serve this kind of function, but as you
are talking about (dis)allowing editing of certain fields within particular
tables this will be determined by your 'application logic' as mentioned
above)

Hope this helps
David Eisenhart




Shaun [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Hi,

 Is there a way of updating a table so that I can add some sort of
identifier
 to each field, something as simple as x=1 will do. I want to be able to
 modify the table so I can set a variable for each column so I can tell
 whether I can let a user modify that field. If I modify the fieldname then
 the web application wont work. The purpose of this is to create a content
 management system that will allow me to set which fields are editable by
the
 user. I don't want to add another field to each table because I want the
 system to be as portable and pluggable into other web sites as possible.

 Any ideas would be greatly appreciated.

 Thanks





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



[PHP] Re: question about smarty

2003-03-04 Thread David Eisenhart
You just put the smarty files on the server like you would load up your php
files.

Note that a common gotcha is when safe mode is enabled on the server -
smarty will not ,by default, run in this case; the resolution is simple and
is explained in the smarty manual.

David Eisenhart


Sunfire [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 just wondering... does smarty have to be installed on the server where the
 web site or php scripts it makes are going to be ran... or do you just
make
 the stuff and put on the server like normal php files...




 ---
 Outgoing mail is certified Virus Free.
 Checked by AVG anti-virus system (http://www.grisoft.com).
 Version: 6.0.458 / Virus Database: 257 - Release Date: 2/24/2003








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



[PHP] Re: classes and functions in include files

2003-02-27 Thread David Eisenhart
yes (as has been said); the code in the included file adopts 'the scope in
the place at the point of the include statement'. Hence if you were to put
the the include statement in a function the vars in the included file would
have the scope of that function; included outside a function they'll have
global scope

David Eisenhart



Sunfire [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 just a fast question here.. and the lotic probably isnt to bright on my
part
 and i think i know the answer to this question too but just to make
sure...
 if you can include variables in an include file and use them outside that
 file (in the file that includes that file that is) then can you do the
same
 with classes and functions




 ---
 Outgoing mail is certified Virus Free.
 Checked by AVG anti-virus system (http://www.grisoft.com).
 Version: 6.0.458 / Virus Database: 257 - Release Date: 2/24/2003






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



Re: [PHP] Include files

2003-02-26 Thread David Eisenhart
if require is used to include the 'same file', say, twice that file will be
loaded twice. This can of course cause errors (such as resulting from the
redefinition of functions within this file). In contrast the require_once
construct will only load a file 'once' irrespective of the number of times
it is subsequently called to do so (thereby preventing such errors arising).

I would imagine (but am not certain) that there may be a slight speed
penalty in using require_once as opposed to require.

David


Jinky Otacan Cocalon [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 the problem was solved by creating an include file and using using
 require() method

 i was just wondering what are the advantages and disadvantages of using
 require_once() instead of require()?

 thanx =)




 John W. Holmes wrote:
 How do I include external library files in PHP???
 I would like to put the lines that are repeated in each php files, in
 
  a
 
 separate file.
 e.g.
 ?php
 $db_host = localhost;
 $db_port = 3306;
 $db_name = test;
 ...
 ?
 
 
  Just throw caution to the wind and try the include() function I'm
  not responsible for the consequences!!! Do not blame me if your file is
  included!!
 
  ---John W. Holmes...
 
  PHP Architect - A monthly magazine for PHP Professionals. Get your copy
  today. http://www.phparch.com/
 
 
 

 --

 Gravity can't be held responsible for people falling in love.




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



Re: [PHP] phpmyadmin duplication of sql

2003-02-25 Thread David Eisenhart
have you attempted to simply create the table and column using the sql text
box (ie not using the create table interface)? eg pasting and submitting
something like:

CREATE TABLE t2 (
  y varchar(5)
) TYPE=MyISAM;

(I appreciate this does not address the reason behind the actual problem you
are having but it should get the job done)

David





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



[PHP] Re: smarty vs. patTemplate vs. inclu

2003-02-21 Thread David Eisenhart
I have never used patTemplate but from my experience Smarty is both fast and
robust (I now would not consider building a site without it)

Even given your scenario I would recommend that you at least consider using
a templating engine. Smarty is very quick and easy to set up so just have a
play!

David


David Caplan [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 Hi,

 I'm designing a site with about 100 different pages. I'm debating whether
to
 use a template mechanism such as smarty or patTemplate vs just creating
 pages and including the body templates based on the url parameters. I
 realize you get a layer of abstraction using the template mechanisms, but
 with the scheme that I have in mind the users will only be editing the
pages
 that are marked body_foo.php. These body pages would be basically pure
html,
 so they can't really screw anything up in the php logic. They would be
 called off an index.php that has a bunch of includes, header.php,
body.php,
 footer.php etc, this page would be off limits to the user for editing.

 From what I understand, both smarty and patTemplate are popular and both
 have supporters and detractors, is one template significantly faster or
more
 stable than the other?

 If I just use includes, am I gonna run into problems, other than the loss
of
 elegance and some abstraction that a template system might offer. My site
 will have approx 100 pages, with a peak of 600,000 hits per day.

 thanks for your help,

 Dave










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




Re: [PHP] register_globals On

2003-02-17 Thread David Eisenhart
yeh, I'd strongly agree with Jonathan's view that quality of the code can
mitigate against the dangers of register_globals.

FYI, an interesting article on php vulnerabilities is at:
http://www.securereality.com.au/studyinscarlet.txt

David Eisenhart


Jonathan Pitcher [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 Sam,

 The register_globals can be dangerous to turn on but it really depends
 on the quality of code that the shopping cart was written.  See
 Examples below for explanation.


 Say you had a script that looked like this.


 ?PHP

 $Q = Select * from Stored CreditCards where User='$User';
 . Retrive info from DB
 . Charge Credit Card
 . Do Other Stuff.

 ?

 With register_globals = on the I could do the following to the URL and
 force the systsem to bill someone else.

 chargecredit.php?User=Joe

 Basically if register_globals = off protects you from that type of URL
 hacking.

 It just depends on how it is written and how thought out the shopping
 cart script is.

 Hope this helped.

 Jonathan Pitcher

 On Monday, February 17, 2003, at 07:09  AM, Sam wrote:

 
  I'm thinking of running a shopping cart package (osCommerce) that
  requires
  register_globals to be enabled. With all the warnings about security
  with
  register_globals enabled I'm worried.
 
  How dangerous is it?
 
 
  --
  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] Re: Login system using PHP/MySql

2003-02-14 Thread David Eisenhart
you could try the phplib libraries (which as well as authentication
implement other things such as database abstraction and templates) There is
some overhead involved in getting up to speed with phplib but there is a lot
of help out there (in the form of articles, email list etc..) I found phplib
very, very valuable to get me started on my first php application
(principally using it for the authentication) but have since preferred to
write my own authentication code. Going it alone with the authentication
does, as you allude to below, involve getting a good handle on sessions. To
this and other related ends I would thoroughly recommend the 2 books 'Web
Database Applications with PHP  MySQL' and 'Programming PHP' (both O'Reilly
titles). Of course a lot of info is out here on the web, but these books are
particularly well written, comprehensive and very handy sitting there on the
desk while you work. Sorry - not the quick fix solution you request but one
that'll help in the longer term.

David



Yc Nyon [EMAIL PROTECTED] wrote in message
01c2d434$f8be3c80$5340ba66@gis">news:01c2d434$f8be3c80$5340ba66@gis...
 Hi,

 I have looked at many examples session-based of login/password system to
 protect webpages but can't get it to work. Seems simple but... I have php
 and mysql installed in my windows server.

 If any kind soul can point me to a working (easy) setup of this task, i
 would be most grateful.

 Nyon


 ---
 Outgoing mail is certified Virus Free.
 Checked by AVG anti-virus system (http://www.grisoft.com).
 Version: 6.0.449 / Virus Database: 251 - Release Date: 27/01/2003




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




Re: [PHP] Templates

2003-02-14 Thread David Eisenhart
yeh, I'd totally agree with this. Smarty is fantastic

 The best one imho in PHP is Smarty.
 I'd rank it up there with Template::Toolkit. Take a look:

 http://smarty.php.net/





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




[PHP] Re: Why use XML?

2003-02-12 Thread David Eisenhart

 Just i am curious to know how do you
 feel while using Smarty template engine. Is it worth
 to use for seperating User interface and programming
 logic?
Most definately; I find the alternative to using a templates (ie embedding
php in html) to be messy even with smaller sites. Template engines, amongst
other things, allow one to write cleaner more modifiable code (both php and
HTML) as one does not obscure the other.
Of the template engines I have used, Smarty is the most sophisticated in
terms of features and is easiest to use - a winning combination!! (It also
comes with the very comprehensive manual and an active, well supported email
list)

 If
 you have more knowledge regarding XML+XSL then it
not a great deal a this stage, but they are clearly worth looking into.

- Original Message -
From: Hardik Doshi [EMAIL PROTECTED]
To: David Eisenhart [EMAIL PROTECTED]
Sent: Wednesday, February 12, 2003 1:00 AM
Subject: Re: [PHP] Re: Why use XML?


 Hi David,

 It's nice to read your comments. I will definately buy
 the book you suggested.

 It's good you are using Smarty template engine.
 Currently i am testing Smarty on development server
 and soon i will start using it for actual
 applications. Just i am curious to know how do you
 feel while using Smarty template engine. Is it worth
 to use for seperating User interface and programming
 logic? I am still looking for option like XML+XSL. If
 you have more knowledge regarding XML+XSL then it
 would be nice if you can give me detail idea.

 Thanks and waiting for your answer.

 Hardik Doshi

 --- David Eisenhart [EMAIL PROTECTED]
 wrote:
  big issues!! I'd recommend that you check out the
  book 'XML and PHP' by
  Vikram Vaswani, New Riders. Its well written and
  concise - should answer
  your queries and more.
 
  (BTW, like you I also use Smarty to separate
  application logic and
  presentation; for my purps and circumstances this is
  preferable to using xml
  stylesheets)
 
  David
 
 
 
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 


 __
 Do you Yahoo!?
 Yahoo! Shopping - Send Flowers for Valentine's Day
 http://shopping.yahoo.com







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




[PHP] Re: Why use XML?

2003-02-11 Thread David Eisenhart
big issues!! I'd recommend that you check out the book 'XML and PHP' by
Vikram Vaswani, New Riders. Its well written and concise - should answer
your queries and more.

(BTW, like you I also use Smarty to separate application logic and
presentation; for my purps and circumstances this is preferable to using xml
stylesheets)

David




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




Re: [PHP] Re: Static functions (java/php)

2003-02-10 Thread David Eisenhart
use the error_reporting function:
http://www.php.net/manual/en/function.error-reporting.php



Joshua Moore-Oliva [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 How would I go about setting the error reporting level?

 Josh.

 On February 9, 2003 06:38 pm, David Eisenhart wrote:
  yeh, I'd agree with this; on your second issue of variable definitions I
do
  find that being able set the error reporting level to show non critical
  errors (such as undefined variables) to be a reasonable, although non
  ideal, compromise; php's still a great language to work with most
respects
  though ...
 
  David Eisenhart
 
  Joshua Moore-Oliva [EMAIL PROTECTED] wrote in message
  [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 
   The only thing I do wish is that there was a way to force php into a
 
  typecast
 
   mode...  and possibly a setting to reqiure a definition for a
variable.
  
   Josh.




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




[PHP] Re: Static functions

2003-02-09 Thread David Eisenhart
yes, you can call a static method on a class by specifying the class name,
then 2 colons and finally the function name:

classname :: functionname([arg,.])

(of course properties can not be accessed by such methods)

David Eisenhart



Leo Spalteholz [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 Hi, I'm a bit of a newbie to PHP, I've done some stuff in Java/VB/C++
 but I'm having a few problems finding info on this issue.

 Does PHP support something like static functions in Java?

 for example in Java I can write:

 public class someClass {
 public static void someMethod() {}
 }

 and then in another file:

 import someClass;

 public class anotherClass {
 someClass.someMethod()
 }

 Is there some way to access methods of a class without creating an
 object in PHP?
 Right now I just include the file (not using a class) and then call
 the function but I would like to have it more seperate.

 Thanks,
 Leo











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




[PHP] Re: Static functions

2003-02-09 Thread David Eisenhart
you may find the following link interesting
http://www.tek271.com/articles/JavaOrPhp.html

David Eisenhart











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




Re: [PHP] Re: Static functions (java/php)

2003-02-09 Thread David Eisenhart
yeh, I'd agree with this; on your second issue of variable definitions I do
find that being able set the error reporting level to show non critical
errors (such as undefined variables) to be a reasonable, although non ideal,
compromise; php's still a great language to work with most respects though
...

David Eisenhart

Joshua Moore-Oliva [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 The only thing I do wish is that there was a way to force php into a
typecast
 mode...  and possibly a setting to reqiure a definition for a variable.

 Josh.



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




Re: [PHP] Re: Static functions (java/php)

2003-02-09 Thread David Eisenhart

Chris Hayes [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 At 23:09 9-2-2003, you wrote:
 you may find the following link interesting
 http://www.tek271.com/articles/JavaOrPhp.html
 
 David Eisenhart
 I cannot suppress the feeling that someone out there has a slight
prejudice
 in favour of Java!


'horses for courses' as they say; php is in my case the best fit for my
particular set of needs and circumstances (one big, big advantage being its
MySQL functions and also the ready accessibility of great template libraries
like Smarty)

david











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




Re: [PHP] Re: Static functions

2003-02-09 Thread David Eisenhart
pleasure Leo, happy php'ing !!


Leo Spalteholz [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 ah!  thank you very much.  Thats exactly what I was looking for.

 Leo

 On February 9, 2003 01:49 pm, David Eisenhart wrote:
  yes, you can call a static method on a class by specifying the
  class name, then 2 colons and finally the function name:
 
  classname :: functionname([arg,.])
 
  (of course properties can not be accessed by such methods)
 
  David Eisenhart
 
 
 
  Leo Spalteholz [EMAIL PROTECTED] wrote in message
  [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 
   Hi, I'm a bit of a newbie to PHP, I've done some stuff in
   Java/VB/C++ but I'm having a few problems finding info on this
   issue.
  
   Does PHP support something like static functions in Java?
  
   for example in Java I can write:
  
   public class someClass {
   public static void someMethod() {}
   }
  
   and then in another file:
  
   import someClass;
  
   public class anotherClass {
   someClass.someMethod()
   }
  
   Is there some way to access methods of a class without creating
   an object in PHP?
   Right now I just include the file (not using a class) and then
   call the function but I would like to have it more seperate.
  
   Thanks,
   Leo




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




[PHP] Re: 3 tier web development

2003-02-07 Thread David Eisenhart
You may be interested in the article: Using PHP to Develop Three-Tier
Architecture Applications
(http://www.zend.com/zend/tut/tutsweatpart1.php)

David Eisenhart.


Hardik Doshi [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 Hi Everyone,

 I am curious to know how one can develop 3-tier web
 based applications using PHP, MySQL. Here Database
 should be changed in future using database abstraction
 layer. Can anybody tell me in detail that how can i
 build 3 tier flexible web application?

 More questions on this thread:

 1. How one can seperate HTML and PHP (or any other
 programming code).  Is there anything in PHP so i can
 seperate Interface layer and programming logic layer?

 2. I know that we can use Database abstraction layer
 so in future it is really easy to change database as
 per need. Can any one tell me which database
 abstraction layer is the best for future applications.

 3. There is lots of talk about CMS today. Does anyone
 know about PHP based CMS (PHP-Nuke?? i dont know)?

 Currently i am making 2 tier systems (HTML+PHP,
 Database) I want to switch my applications to 3 tier
 (HTML, php and database). Please give me enough
 guidance.

 thanks

 Hardik

 __
 Do you Yahoo!?
 Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
 http://mailplus.yahoo.com



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




[PHP] Re: best oop book

2003-02-06 Thread David Eisenhart
I got a lot out of Web Application Development with PHP4, by Tobias
Ratshiller and Till Gerken, New Riders. Its not just about oop but covers
this aspect well and is generally a very well written intermediate to
advanced treatment of php.

Also to keep ahead of the game this is an interesting article The
Object-Oriented Evolution of PHP at
http://www.devx.com/webdev/Article/10007/0/page/1

David


Edward Peloke [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 Ok,

 I have seen a suggestion or two for oop books but I would like to buy one
so
 what is the best php object oriented book on the market...in everyone's
 opinion.  The Professional PHP4 XML book looks good for xml, so I hope to
 get that one, I have a php/mysql book, just want a good oop book now.

 I have read a few reviews on the professional php book by wrox but it
seems
 to need for oop stuff

 Thanks,
 Eddie




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




[PHP] Re: how to write clean code.

2003-02-03 Thread David Eisenhart
Another template engine you could consider is Smarty http://smarty.php.net/.
One can write very elegant code using such an templating system

david



 it is also good idea to separate html from the code, for instance by using
 some template engine.

 rush




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




[PHP] Re: Template tutorials?

2003-01-11 Thread David Eisenhart
Check out the Smarty tutorial links page from it's site resources section  -
http://smarty.php.net/resources.php?category=0

Also the Smarty manual is excellent - very comprehensive and well written. I
just about taught myself Smarty using this alone.

I think Smarty is the absolute biz when it comes to php template engines;
well worth giving a really good test run.

D.




Chad Day [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 I'm googling around for template tutorials and such after seeing a link to
 the Smarty template engine .. can anyone point me to any particularly good
 ones?  I've always been going with the 'one-file' approach .. which I
think
 it's time I changed.

 Thanks,
 Chad










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




[PHP] Re: Converting Excel Spreadsheet to MySQL table ...

2003-01-10 Thread David Eisenhart
as a 'one off' exercise I recently did something similar except the data was
from Access, but would work the same from an excel file:- saved as
a CSV file and then used phpMyAdmin to import the CSV file data into a MySQL
table (of course, didn't have to use phpMyAdmin for this but it did make the
import process very quick and straight forward)

D


Adam Ferguson [EMAIL PROTECTED] wrote in message
002001c2b86e$34514590$6601a8c0@FERG">news:002001c2b86e$34514590$6601a8c0@FERG...
Hello ...

I was wondering if anyone had a good resource or code sample for opening (
or accessing ) an excel spreadsheet using php.  I need to be able to convert
a spreadsheet of products and info to a table of products in a mysql
database.  Also ... I need to be able to perform this on a Linux machine.
Any help would be great.

Thanks guys!
Adam Ferguson






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




[PHP] Re: Medium to Large PHP Application Design

2003-01-10 Thread David Eisenhart
 I'm looking for online
 references, personal experience and opinion and even examples of open
 source code which you think demonstrate the above criteria on this one.

I have found the Smarty template engine (http://smarty.php.net/) to be a
most excellent tool for separating business logic and presentation.



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




Re: [PHP] Re: Databases vs. File Access

2003-01-09 Thread David Eisenhart
to add another cent to Timothy's contribution I agree, check out Smarty
(http://smarty.php.net/) for the templating.

D


Timothy Hitchens ) [EMAIL PROTECTED] wrote in message
000801c2b7ab$837eefa0$0500a8c0@bambino">news:000801c2b7ab$837eefa0$0500a8c0@bambino...
 My 2 cents would be use a database and templates then create cached
 static versions of
 the pages on the first request and then when you need to changes things
 it is just a
 simple change the template and you a whole new look without the issue of
 performance.

 Make that 5 cents worth!!




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




[PHP] Re: PHP vs. ASP

2003-01-06 Thread David Eisenhart
this is addressed in quite a few dedicated articles in php sites.

For me some of the big pros of PHP:
- the active community behind it
- associated open source products (such as phpMyAdmin and the Smarty
template engine)
- the ease and power behind coupling it with MySQL databases (ASP has of
course got lots of hooks into databases but I find this aspect of PHP to be
much cleaner and simpler)
- is natively hosted on a Unix type platform

D.








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




[PHP] Re: Inserting tab delimited textfiles into mysql

2002-12-19 Thread David Eisenhart
I recommend that you check out phpMyAdmin http://www.phpmyadmin.net/

David



Thomas Goeminne [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 I got a tab delimited file which looks like this:

 let us call it items.txt

 TypeCatalog NumberItem DescriptionSide BProducer
 12 AAA502 Afu Ra-DD Soundclash Mic Stance, Premeir,Curt Cazall
 12 AC725 Roc Raida/Wayne-O - Gong Show Burn That Ass Roc
 Raida

 I want to take all this info and insert it into my mysql dbase. The type
is
 in a table named categories. The rest should go into the table named
items.
 With also the id number off the categorie in it.

 I have been looking for info on how to do this but I can't find a decent
 article about it. First off I dump all the records which were already in
the
 dbase. And then it needs to get filled up with the new items.txt

 I would appreciate your help
 greets
 --
 Thomas Goeminne





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




[PHP] Re: Showing 10 record items per page...?

2002-12-17 Thread David Eisenhart
check out:
http://www.phpfreaks.com/tutorials/43/0.php

David Eisenhart



Föíö Öxî?êójînyóon [EMAIL PROTECTED] wrote in message
047d01c2a5ba$0b7bd480$c900640a@gandalf">news:047d01c2a5ba$0b7bd480$c900640a@gandalf...
I need to be able to show maybe 10 items that I query from a mysql
database on each page and I'm not really sure how I can do this.

If I have lets say 30 items that match the query, I would like the page
to display this at the bottom

Previous 10  page 1 2 3  Next 10 of 30


Can any one direct me in the right direction to make this possable?

Regards, David




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




[PHP] Re: PHP Editor Browser View? (Beginner Question)

2002-12-11 Thread David Eisenhart
If your local machine is running Windows you could also use Personal Web
Server or IIS (whichever comes with your Windows) for the web server (of
course you will also need a local copy of php, but this is very easy to set
up)

David Eisenhart




Ubergoober [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 You might consider downloading a package like foxserve
 (http://sourceforge.net/projects/foxserv) for your system. This is an
 apache/php bundle that will allow you to test your code from a local
 instance of php.


 Paul Lazare [EMAIL PROTECTED] wrote in message
 [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
  A Company Programmed my Homepage in PHP. Now I want to make simple
changes
  like changing some text. And I want to try it alone, so I got myselv
  PHPEdit.
 
  I copied the complete Homepage on my harddisc to work on it tiht PHP
Edit
  and everthing works fine.
 
  But how can I see the result of the changes (without uploading it the
  provider again)?
 
  I allready tried to click on new browser and it is opening an empty
  browser...
 
  sorry for the beginner question. Am I in the right newgroup for this
  question?
 
  greetings, paul
 
 





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




[PHP] Re: Help Please

2002-12-10 Thread David Eisenhart
I can think of a couple of ways to tackle this:

1) The purest way is to do with your database design - a typical order
processing database will contain a table for products, a table for
customers, a table for orders, a table for order lines and so on ... If this
is implemented correctly (ie the tables are correct) you should be able to
do an grouping and aggregate type query on the order line table that will
return the number of any particular product sold and from there you can
apply the correct price. You'll need to understand relational database
design to do this yourself (a v good topic to know if you're doing much in
the way of database backed sites anyway). The O'Reilly Book Web Database
Design with Php and MySQL uses a wine order processing application as a
running example throughout (although this appears to be principally about
using Php with MySQL rather than database design itself it may be worth
checking out)

2) More along the lines of your suggestion below you can use the MySQL '+'
operator .Every time you sell an item you can run an update query which goes
something like:-
UPDATE table_name SET num_of_items_sold_field= (num_of_items_sold_field + 1)
WHERE product_id_field = the_product_id
You can then use the value in 'num_of_items_sold_field' to determine product
price.


You may want to check out the MySQL list as the issue appears to be
principally a database rather than a php one.

If at all possible I would advocate the first approach - a properly designed
database will generally always pay divis in the long run.

Hope that this helps.
David Eisenhart


Spiderwebb [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 From: SpiderWebb [EMAIL PROTECTED]
 Subject: Help nedded
 Date: 09 December 2002 16:46

 I dont know if this is possible in PHP (Newbie) im working on a project
 where each product has 3 diffierent prices depending on the amount sold so
 say for example 1- 100 price A 101-299 price B and above 300 Price C.
What
 I need to be able to do is increment an mysql database field each time an
 item is sold then look at that field to decide which price variable to
write
 to the price field of the database. Could someone point me in the right
 direction where I could solve this or to someone who could

 Thanks in advance.
 Spiderwebb











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




[PHP] Re: Help on OOP

2002-12-09 Thread David Eisenhart
 if anyone can suggest the best tutorial on OBJECTS and CLASSES, I'll be
grateful.

for a very well written treatment (albeit no tutorials) of most things PHP
(including OOP) I'd recommend O'Reilly's book Programming PHP (by Rasmus
Lerdorf and Kevin Tatroe).

David Eisenhart







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




[PHP] Pear vs Phplib vs adodb

2002-12-03 Thread David Eisenhart
I'm looking to choose a set of library code principally for database
functions. So far checked out Pear, Phplib and adodb which all appear to be
well crafted and easy to use. Irrespective of differences in the actual
functions provided (which of course are well documented) can anyone briefly
compare and contrast them from experience working with 2 or more such
libraries in a production environment in terms of robustness and speed (I
appreciate that speed tests have put adodb top, then phplib and finally
Pear, but have people found such differences to be very noticeable and if so
under what specific circumstances?)

Cheers,
David Eisenhart




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




Re: Re[2]: [PHP] need advice on template engine

2002-12-03 Thread David Eisenhart
Hi,

Smarty is trully fantastic - relatively easy to learn and use and is very
powerful.

I used to use the phplib template engine which was also impressive but
Smarty is much more sophisticated.

Some great things about Smarty:-

- site pages can be cached (can save masses of time if the server is having
to re-create the same database backed pages)

- a well written, extensive and thorough manual (a must if you are to use
Smarty to its max)

- the Smarty 'presentation' code resides with the html and is consequently
separated from the php code . This may be said by some to be a bad thing as
the point of the such template engines is to separate the html from
programming code; however I have found that in the case of phplib templates
(and no doubt many other template engines) html was, by necessity,  finding
its way into the programming code and also the code to manage the generate
the templates could become quite bulky. Smarty is practically and
conceptually more elegant in that it separates 'all presentation related
code' (html and smarty constructs) and logic (ie. your php), what's more,
the actual lines of code that I have to write is reduced as a result.

Hope that this convinces you to give Smarty a go,

David Eisenhart


 http://smarty.php.net seems polular

 J


 on 04/12/02 12:40 AM, Alexander A. Savenkov ([EMAIL PROTECTED]) wrote:

  Hi PHP.
 
  Suggest me which template engine is more popular?
  I try select engine for me but I alredy become involved in that
  number different version
 
 
  Alexander A. Savenkov
  System Administrator
  mailto:[EMAIL PROTECTED]
  JSC Terminal GMB
  http://www.terminalgmb.ru
 

 Justin French
 
 http://Indent.com.au
 Web Development 
 Graphic Design
 


Alexander A. Savenkov [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 Hi Justin.


 JF http://smarty.php.net seems polular

 It seems to me too
 but i thick may be I can miss smthng important



  Alexander A. Savenkov
  System Administrator
  mailto:[EMAIL PROTECTED]
  JSC Terminal GMB
  http://www.terminalgmb.ru








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




[PHP] how to detect if the client's browser accepts cookies ?

2002-05-31 Thread David Eisenhart

Hi

I am writing a function to construct page links within my site; I want it to
append the session id to the URL's query string if the client does not
accept cookies (and ignore the session id if the client does accept
cookies).

How do I detect if the client browser accepts cookies?
Indeed, has anyone got such a function as described above?

Any help gratefully received.

David




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




[PHP] getting the 'client' date and time for use in PHP scripts ??

2002-04-08 Thread David Eisenhart

Hi

Does anyone know of a technique for obtaining the date and time of the
client's system?
(I can conceive of generating this with Java Script and passing it to pages
within the site, but it is important that this information is obtained by
the 'first' page that the user accesses.)

Any ideas gratefully received.

David




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




[PHP] Re: getting the 'client' date and time for use in PHP scripts ??

2002-04-08 Thread David Eisenhart

Julio Nobrega Trabalhando [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
   Still you can use Javascript. get it and reload the page appending the
 info on the url. Or write to a file and open with php.

   Or you could get what country the user is and calculate the time zones.

 --

 Julio Nobrega.

 Um dia eu chego lá:
 http://sourceforge.net/projects/toca

 Ajudei? Salvei? Que tal um presentinho?
 http://www.submarino.com.br/wishlistclient.asp?wlid=664176742884


 David Eisenhart [EMAIL PROTECTED] wrote in message
 [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
  Hi
 
  Does anyone know of a technique for obtaining the date and time of the
  client's system?
  (I can conceive of generating this with Java Script and passing it to
 pages
  within the site, but it is important that this information is obtained
by
  the 'first' page that the user accesses.)
 
  Any ideas gratefully received.
 
  David
 

Thanks Julio,

This sounds promising, but I'm afraid that I am quite new to php and
internet coding and am not sure how to implement your first 2 suggestions
... would you expand on these (the reloading and writing to file options)
just a little more ...

Cheers, David



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