php-general Digest 3 Jun 2005 12:39:03 -0000 Issue 3491
Topics (messages 216277 through 216308):
Re: Exporting to MS Word or Excel
216277 by: tg-php.gryffyndevelopment.com
Re: Delay?
216278 by: Danny Brow
216286 by: dan
216293 by: mayo
Re: What Works Works Validator
216279 by: JB
216281 by: JB
Mailing list delays
216280 by: Rasmus Lerdorf
216285 by: Sebastian
216287 by: Sebastian
216295 by: Danny Brow
Re: what is -- $this variable -> $this other variable -- means?
216282 by: JB
Re: sanitizing get vars
216283 by: Marek Kilimajer
Re: php forum and (almost certainly 0T) client editor
216284 by: JB
Re: Can't Get PHP to work
216288 by: JB
Re: Quick q, most prolly 0T
216289 by: Chris Shiflett
Site Design Strategy
216290 by: asinning
216307 by: Jack Jackson
Re: Unit testing ?
216291 by: Matthew Weier O'Phinney
Re: Best way to use other objects within classes?
216292 by: Matthew Weier O'Phinney
216297 by: Tom Rogers
Newbie - Request interface for PHP 5 website
216294 by: Info.Best-IT
216308 by: Greg Donald
Re: Japanese with UTF-8 and mysql
216296 by: Mark Sargent
216302 by: Peter Brodersen
what do you guys use for reporting?
216298 by: Angelo Zanetti
216299 by: Angelo Zanetti
216300 by: coding.digital-data.co.uk
Re: .INC files
216301 by: Peter Brodersen
Re: Accessing DLL from PHP
216303 by: Rory Browne
216304 by: Rory McKinley
216305 by: Shaw, Chris - Accenture
MESSAGE COULD NOT BE DELIVERED
216306 by: Returned mail
Administrivia:
To subscribe to the digest, e-mail:
[EMAIL PROTECTED]
To unsubscribe from the digest, e-mail:
[EMAIL PROTECTED]
To post to the list, e-mail:
php-general@lists.php.net
----------------------------------------------------------------------
--- Begin Message ---
To export it exactly as displayed (like when you print to a virtual printer to
generate a PDF) might be tricky, but you can definitely create Excel and I
believe Word files without even having Excel or Word installed. If you DO
have Excel or Word installed on your server, then you can always use a COM
connection to handle this.
First, maybe check out the Excel Writer PEAR package. Here's a link to a post
I made about it a while ago with instructions on how to install it:
http://marc.theaimsgroup.com/?l=php-general&m=111409575703230&w=2
Excel Writer uses another PEAR package called OLE which is used to generate
older format MS Office files in general. Both can be found at
http://pear.php.net
Also, try searching the archives, I know this question has been asked many
times (even recently) and I'm sure you'll find some good stuff in there.
PHP-General archives:
http://marc.theaimsgroup.com/?l=php-general
PHP-Windows archives:
http://marc.theaimsgroup.com/?l=php-windows
PHP-Databases archives (never know eh?):
http://marc.theaimsgroup.com/?l=php-db
And of course, the links to all these can be found on the PHP mailing lists
page:
http://www.php.net/mailing-lists.php
Good luck!
-TG
= = = Original message = = =
Hi!!!
Are there any chances that I could export a dynamic created web page into MS
Word or Excel?
I know this can be done with PDF!!
I'm using LAMP!!
-----------------------
Miguel Guirao Aguilera
Logistica R8 TELCEL
Tel. (999) 960.7994
Cel. 9931 600.0000
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
___________________________________________________________
Sent by ePrompter, the premier email notification software.
Free download at http://www.ePrompter.com.
--- End Message ---
--- Begin Message ---
On Thu, 2005-06-02 at 15:32 -0400, GamblerZG wrote:
> Sebastian wrote:
> > yea.. takes hours... sometimes 6+ or more.
> > i dont post that much to the list for this reason.. if it stays like
> > this i'll just unsubscribe.. its pointless... this is suppose to be
> > E-mail, not post office mail.
>
> I don't understand why everyone like these mailing lists so much.
> Web-forums more convenient.
>
Convenient for your maybe, I personally hate web forums.
signature.asc
Description: This is a digitally signed message part
--- End Message ---
--- Begin Message ---
Danny Brow wrote:
On Thu, 2005-06-02 at 15:32 -0400, GamblerZG wrote:
Sebastian wrote:
yea.. takes hours... sometimes 6+ or more.
i dont post that much to the list for this reason.. if it stays like
this i'll just unsubscribe.. its pointless... this is suppose to be
E-mail, not post office mail.
I don't understand why everyone like these mailing lists so much.
Web-forums more convenient.
Convenient for your maybe, I personally hate web forums.
(six hours later of course)
I agree.
Thanks
-dant
--- End Message ---
--- Begin Message ---
My average post takes 2+ hours.
mayo
-----Original Message-----
From: Chris W. Parker [mailto:[EMAIL PROTECTED]
Sent: Thursday, June 02, 2005 4:22 PM
To: Chris Boget; Jason Sweeney
Cc: php-general@lists.php.net
Subject: RE: [PHP] Delay?
Chris Boget <mailto:[EMAIL PROTECTED]>
on Thursday, June 02, 2005 12:16 PM said:
>>> Has anyone else noticed significant delays in messages getting
>>> posted? No, no delay on my end.
>
> At least 4hrs on my end...
Uhh.. I think he was joking... Take another read of his next sentence.
:)
Chris.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---
Simple, blank page with just content, thats the only true way,
Anyway why you wanna be backward compatible that far is beyond me cus
they handle HTML even worse so its a losing battle!,
use the CSS @import
rule for style sheets and older browsers will simply ignore the CSS, you
could then just give your page a basic look that older browsers could
handle well while overriding the HTML styling with CSS for newer browsers.
Also answer to your other question... try use PHP's built in validator
tool to auto replace any errors in your code.
Also table height, no other way I know sorry,
HTH
Richard Lynch wrote:
This is OT in that it's more about HTML than PHP, but solutions involving
PHP would be particularly welcome.
After playing with the W3C validator again for an hour or so...
The thing is, I really want to be backwards compatible with ancient
browsers. Like, REALLY ancient.
Like, say, going back as far as 3.0 browsers.
So, relying on CSS to do my layout is a non-option. It's just not there.
But I LIKE the idea of having HTML validated to catch tag imbalance, typos
in attributes, and maybe even layout problems in weird versions of
browsers (eg Netscape 4.7 or IE on the Mac).
I don't really want to be compatible with the W3C standards, however,
since the penalty is layout that just plain doesn't work in ancient
browsers.
For example, I simply can't validate with a 100% height table, but that's
the only way to get the layout I want on both ancient and current
browsers.
Does anybody know of a "What Works Works Validator" which checks for
maxiumum browser compatibility rather than the W3C standard?
Or even just some tools that check HTML tag balancing, and maybe
spell-check attributes. It has to be post-PHP URL-based on not IDE/editor
based, unless there's a PHP interpreter built into the editor to figure
out the HTML I'm spitting out...
Failing all that, does anybody know a non-CSS way to get a table to be
100% tall so I can get rid of this last error?
Or, perhaps, a way between JavaScript and PHP to calculate how much
white-space I need to make a spacer image to be the right height?
Or...
PS
Please let's not start a flame war about browser versions, browser makers,
standards-compliance, etc.
You can do whatever you want ; I just happen to believe that backwards
compatibility is more important than compliance with standards that aren't
even implemented correctly at this time.
So if your answer doesn't actually match my question, just hit "delete"
Thanks.
--- End Message ---
--- Begin Message ---
A small example, using the code below all older browser who cant
understand CSS will ignore it because its within a comment block...
<style type="text/css">
<!--
@import url("MyStyleSheet.css");
-->
</style>
--- End Message ---
--- Begin Message ---
We found a problem caused by a recent disk failure that wiped out a
named pipe qmail needed. I am hoping the mailing list delays should be
fixed now.
-Rasmus
--- End Message ---
--- Begin Message ---
Thanks.
*test*
Rasmus Lerdorf wrote:
We found a problem caused by a recent disk failure that wiped out a
named pipe qmail needed. I am hoping the mailing list delays should be
fixed now.
-Rasmus
--- End Message ---
--- Begin Message ---
wow, got that in 20 seconds.. can we go for a record? ;)
Sebastian wrote:
Thanks.
*test*
Rasmus Lerdorf wrote:
We found a problem caused by a recent disk failure that wiped out a
named pipe qmail needed. I am hoping the mailing list delays should be
fixed now.
-Rasmus
--- End Message ---
--- Begin Message ---
On Thu, 2005-06-02 at 17:15 -0700, Rasmus Lerdorf wrote:
> We found a problem caused by a recent disk failure that wiped out a
> named pipe qmail needed. I am hoping the mailing list delays should be
> fixed now.
>
> -Rasmus
>
test
signature.asc
Description: This is a digitally signed message part
--- End Message ---
--- Begin Message ---
http://php.net/manual/en/language.oop.php
--- End Message ---
--- Begin Message ---
Sebastian wrote:
what is a safe way to clean a post/get before echoing it.
example. input form, user enters some text, hits enter.
.. next page i echo what they entered.
right now i just run the variables passed by htmlentities() which
preseves any html. is that acceptable?
You might also want to use stripslashes() if magic_quotes_gpc is on, so
the data is not double escaped.
--- End Message ---
--- Begin Message ---
Hello, I can answer your second question...
Frames can be used to achieve the effect of two seperate windows, one
can refresh while the other stays as-is.
For a client editor...
Some javascript to add tags on the client side would be fairly simple to
create, just create some custom tags for display to clients then when
submitted use PHP's str_replace function to search for your custom tags
then replace with some HTML before it hits the forums,
James
Ryan A wrote:
Hey guys (and girl...as we have one on the list...(that i know of)),
Can anybody recommend a real bare bones forum that i can modify
or
a tutorial for creating a forum
or
URLs/Classes etc to help me create a simple forum?
I checked on google but I couldnt find any tutorials or code, went to
hot-scripts and saw a _c r a p l o a d_ of forums (for free and otherwise)
but I have a client who insists I build him a forum which must fall
_exactly_
to his specifications and work of our currently registered users database.
Worse scenario, I will dl a few of the forums from hotscrpts and go through
each of their code...but I would like to avoid that if anyone can give me a
better option.
2nd question
I will need a kind of "client editor" for when people write their messages
into the forum,
eg: make this bold and that italics and that centered and that with an image
and so on
I had actually seen a (dhtml, I think) form some time back where you could
preview your
message at the side as you made changes...somewhat like what google has for
their
ad-cents accounts where you can change the colors of your ad and immediatly
it shows the
changes at the side in a box.
I remember sometime back someone posting some WYSIWYG kind of editors which
loads
on the clients machine with just a textbox and the buttons to go bold,
italics,centered etc
unfortunatly looking into the archives i cant find it.
Thanks,
Ryan
--- End Message ---
--- Begin Message ---
You need to insert these two lines to your Apache httpd.conf
configuration file to set up the PHP module for Apache 2.0:
Example 6-6. PHP and Apache 2.0 as Module
# For PHP 5 do something like this:
LoadModule php5_module "c:/php/php5apache2.dll"
AddType application/x-httpd-php .php
# configure the path to php.ini
PHPIniDir "C:/php"
Subscriber wrote:
Hi,
I sure hope someone here can help me. I spent the entire day yesterday
and most of the evening setting up a webserver on my Windows 2000 Pro
system.
I've got PHP 5.04, MySQL 4.1.12, ActivePerl 5.8.6, Java Runtime
Environment, Tomcat 5.5.9, ZendOptimizer 2.5.10, MyODBC 3.5.11 and
phpMyAdmin 2.6.2 all installed.
From what I can tell, all is working well except PHP and phpMyAdmin.
I added PHP to my path like this:
C:\Perl\bin\;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;C:\php;C:\Apache2\bin;C:\mysql\bin;C:\php\dlls;C:\Program
Files\Common Files\Ulead Systems\MPEG;"C:\Program Files\Zone
Labs\ZoneAlarm\MailFrontier"
I've got a copy of php.ini in both my c:/php directory and in
c://winnt. I've listed my user directory as c:/apache/apache2/htdocs
and I've placed phpmyadmin in htdocs.
But when I try to view a php page I get an error or page cannot be
displayed. On a couple of occassions I viewed the raw php data in my
browser.
Also, when I try to add a php extension using "LoadModule" in my
httd.conf file I get an error loading Apache telling me that "the file
cannot be found" (but I've verified it exists - like php5apache.dll and
php5ts.dll).
Can someone please help me figure out where I'm screwing up at?
Thanks in advance!
Edited to say I'm getting Closer!!!
Now when I go to
[url=http://localhost/phpmyadmin]http://localhost/phpmyadmin[/url] I get
the following info:
cannot load mysqli extension;
please check PHP configuration
[u]Documentation[/u]
And the documentation says:
[b][1.20] I receive the error "cannot load MySQL extension, please check
PHP Configuration". [/b]To connect to a MySQL server, PHP needs a set of
MySQL functions called "MySQL extension". This extension may be part of
the PHP distribution (compiled-in), otherwise it needs to be loaded
dynamically. Its name is probably mysql.so or php_mysql.dll. phpMyAdmin
tried to load the extension but failed.
Usually, the problem is solved by installing a software package called
"PHP-MySQL" or something similar.
I have tried using both mysql and mysqli in config.inc.php (phpmyadmin
config file) and either way I get the same error message. And in
php.ini I have enabled the following extensions:
extension=php_mysql.dll
extension=php_mysqli.dll
--- End Message ---
--- Begin Message ---
Ryan A wrote:
Basically I am waiting for the client to pay me...till he does,
I am displaying the index page which is a under construction
page...but he also wants to play with the site so I need to
direct all calls to main.php...
You want to only show an under construction page, but you also want the
client to be able to use the application? I don't understand how these
conditions can coexist.
Can you clarify?
Chris
--
Chris Shiflett
Brain Bulb, The PHP Consultancy
http://brainbulb.com/
--- End Message ---
--- Begin Message ---
This is my first post to this group. I've been trying to figure this
out on my own, but I keep running into complications, so I've decided
to get some help. Much thanks for any help!
I've been writing php server application for a couple of years, but now
I'm turning my attention to re-building our company's aging website.
This is a big project and is going to require a solid foundation.
At the crux of this post is the following question: How do you develop
a very robust, dynamic web-site, but also allow non-technical people to
contribute? There must be an easier way.
Here are my working assumptions and my strategy. Please help me if I'm
thinking down the wrong path.
Assumptions:
1) Non-technical people in the company need to be able to build pages,
and they should be able to post their pages without bothering me. We
have a tech-support person who will be able to help them, but she has
zero programming knowledge and only a superficial understanding of
HTML.
2) Every page needs to reside within he "shell" of the web site. This
includes
header(the top-level menu)
left-side menu (a dynamic, context-specific menu)
content (this is what the non-technical people will produce)
footer (your standard fare text-based links)
3) I don't want to use frames, and I don't want to use Dreamweaver
templates.
Strategy: Currently, I am working on the following model:
There is a top-level index.php page. This is the target of EVERY
page on the site.
The page that gets loaded in depends on the parameters of
query-string. It's very simple, if the query string reads
"?target=products/gsp", then my php will look for a site-relative
document such as "products/gsp.htm" OR "products/gsp/index.hml". Then,
this document will get "included" as the content in my "shell".
Well, this works to a degree, but it requires that people use
"site-relative" paths for all of their graphics and links, which is
way, way to much to ask. After all, people are using WYSIWIG editors
such as Dreamweaver and even Word to build their pages. Typically,
site-relative paths don't work in these environments. They shouldn't
need to upload their document to preview it.
It also requires that they put their page within a 550 pixel wide
-td- tag. I'd love to drop that requirement.
So, now I considering the following: A parser that will convert any
content into "includable" form. Relative paths will be translated to
the site-root, etc. I'm a bit stuck here.
There's got to be a better way.
Thanks.
--- End Message ---
--- Begin Message ---
asinning wrote:
This is my first post to this group. I've been trying to figure this
out on my own, but I keep running into complications, so I've decided
to get some help. Much thanks for any help!
I've been writing php server application for a couple of years, but now
I'm turning my attention to re-building our company's aging website.
This is a big project and is going to require a solid foundation.
At the crux of this post is the following question: How do you develop
a very robust, dynamic web-site, but also allow non-technical people to
contribute? There must be an easier way.
Here are my working assumptions and my strategy. Please help me if I'm
thinking down the wrong path.
Assumptions:
1) Non-technical people in the company need to be able to build pages,
and they should be able to post their pages without bothering me. We
have a tech-support person who will be able to help them, but she has
zero programming knowledge and only a superficial understanding of
HTML.
2) Every page needs to reside within he "shell" of the web site. This
includes
header(the top-level menu)
left-side menu (a dynamic, context-specific menu)
content (this is what the non-technical people will produce)
footer (your standard fare text-based links)
3) I don't want to use frames, and I don't want to use Dreamweaver
templates.
Strategy: Currently, I am working on the following model:
There is a top-level index.php page. This is the target of EVERY
page on the site.
The page that gets loaded in depends on the parameters of
query-string. It's very simple, if the query string reads
"?target=products/gsp", then my php will look for a site-relative
document such as "products/gsp.htm" OR "products/gsp/index.hml". Then,
this document will get "included" as the content in my "shell".
Well, this works to a degree, but it requires that people use
"site-relative" paths for all of their graphics and links, which is
way, way to much to ask. After all, people are using WYSIWIG editors
such as Dreamweaver and even Word to build their pages. Typically,
site-relative paths don't work in these environments. They shouldn't
need to upload their document to preview it.
It also requires that they put their page within a 550 pixel wide
-td- tag. I'd love to drop that requirement.
So, now I considering the following: A parser that will convert any
content into "includable" form. Relative paths will be translated to
the site-root, etc. I'm a bit stuck here.
Maybe I've misunderstood but here's a thought:
I'm not sure what they're actually doing with these pages but it's
usually in my experience something like a headline, a block of text in
which you can allow certain HTML tags (you can use tidy within PHP) and
some images and some links. Is there more that these folks are doing?
Is there a reason to give them so much flexibility in design? Are these
home pages as in personal showcases or department-specific offerings?
You probably want to set up each user with their own directory or db
area so they can upload all their images through your control panel,
enter their text and have everything in one place for each user.
If you give users the opportunity to put in unlimited matched sets of
Headline, text block, image float right left or center (cna cation if
required) plus <strong>, <em> and a limited href capability 99% of
people will probably be happy. Make sure you rename all images they
upload to remove spaces, weird characters and duplicate names. You can
use a naming convention like user.image.x. or even md5(imagename).
So this way, each user gets a user directory in which all image links
are relative to that directory, all images are righ there and ties to
the user.
> It also requires that they put their page within a 550 pixel wide
> -td- tag. I'd love to drop that requirement.
AAARG. We use a wrapper in XHTML, putting everything in <div> tags so
that later, when we change the format, they're not stuck in a <td> as
you rightly worry about. Using <div> and CSS positioning increases
exponentially your flexibility both now and later. And requires fairly
modern browsers but according to our logs almost everyone has them. And
if they come in using lynx it'll still *work* in that they get all the
info in sensible order. Netscape 4 and IE 4 users are out of luck, but
then, they often are anyway in terms of support on the web (please let's
not devolve into a flame war over that statement).
HTH and makes sense.
--- End Message ---
--- Begin Message ---
* mbneto <[EMAIL PROTECTED]>:
> I am trying the phpunit2 for unit testing but the examples found in
> the documentation are few and do not address, for example, tests when
> database access is involved.
>
> Perhaps this belongs to a more general question (i.e strategies for
> unit testing) so any urls, docs would be great.
Jason Sweat covered this at php|Tropics, using SimpleTest as the unit
testing framework. I use phpt unit tests (developed for testing php
itself, and used by the PEAR project for regression tests). The
principles are the same regardless of framework, however.
The fundamental problem is: your code may depend on the results of a DB
operation -- it's primary purpose may even be to perform a DB operation.
While you can test the code, you still need to test whether or not your
code can successfully perform the DB operation as well. A common problem
I find is that I'm building SQL on the fly -- and that process may build
shoddy SQL. It may be building exactly what I designed it to do, but the
RDBMS will never be able to actually utilize the SQL I build. Tests can
help catch these issues.
Basically, when testing code that interacts with a database, you've got
two basic strategies: (1) test against the DB, or (2) use mock objects.
The latter is a tricky subject, as it assumes you're using a DB
abstraction layer, and because you then have to mimic how that
abstraction layer works. Basically, you end up doing a lot of code
simply to test.
Which brings us back to (1), test against the DB.
The way to do this is to have some code that sets up and tears down a
TEST database -- not the one with your live data. It should likely
create and populate any tables you need, and then be able to tear them
down again. The reason behind this is that you can then have a set of
consistent data to test against -- once you run tests, chances are
likely that you've altered the data. Each test you run should tear down
the DB and then recreate and/or repopulate it.
If you use the phpt unit tests, the place to do this is in your
setup.php.inc file. I then create a file with the raw SQL for
setting up and populating a test table, slurp it in with
file_get_contents, and pass it on to the DB from within a function in
that setup file. Then another function can truncate or delete all
records from the tables utilized.
The code within the test might then look like this:
<?php
include_once dirname(__FILE__) . '/setup.php.inc';
setupDb();
// do a test
teardownDb();
setupDb();
// do another test
teardownDb();
?>
That's kind of a long-winded answer to your question, but it's not
something you see a lot of information on. I hope that it helps.
--
Matthew Weier O'Phinney | WEBSITES:
Webmaster and IT Specialist | http://www.garden.org
National Gardening Association | http://www.kidsgardening.com
802-863-5251 x156 | http://nationalgardenmonth.org
mailto:[EMAIL PROTECTED] | http://vermontbotanical.org
--- End Message ---
--- Begin Message ---
* "Murray @ PlanetThoughtful" <[EMAIL PROTECTED]>:
<snip>
> (Note: my development environment is PHP 5.0.3, but the production
> environment is 4.3.10. This is my first project built with 5.x local and
> 4.1.x remote, so if anyone with more experience spots any fatal flaws
> where I'm using 5.x specific methods etc, I'd appreciate knowing about them)
<snip>
> <?
> $db =& connectMDB2(); // function that returns instantiated MDB2 object
>
> $comments = new displayComments(); // class that performs displaying
> of comments
> $comments->set_db($db); // passing the MDB2 object to the class
> $comments->doSomethingElse();
> ?>
>
> The displayComments() class might then look something like:
>
> class displayComments{
> private $db;
>
> public function set_db(&$db){
> $this->db =& $db;
> }
The above is the nut you need, and you're doing it right. As Greg
pointed out, you'll need to change that from 'private $db' to 'var $db'
as PHP4 doesn't have member visibility. However, you're correctly
passing by reference -- something required by PHP4 if you want to share
the same object amongst several classes. (In PHP5, objects are passed by
reference by default, and the above code will actually generate some
notices -- but since you're developing for PHP4, you can safely ignore
them).
--
Matthew Weier O'Phinney | WEBSITES:
Webmaster and IT Specialist | http://www.garden.org
National Gardening Association | http://www.kidsgardening.com
802-863-5251 x156 | http://nationalgardenmonth.org
mailto:[EMAIL PROTECTED] | http://vermontbotanical.org
--- End Message ---
--- Begin Message ---
Hi,
Friday, June 3, 2005, 5:16:19 AM, you wrote:
MP> Hi All,
MP> I'm using the MDB2 object to access my MySQL database. I have a number
MP> of classes that perform page-building activities that need db access,
MP> and I'm wondering what the best way to expose the MDB2 object to them is?
MP> (Note: my development environment is PHP 5.0.3, but the production
MP> environment is 4.3.10. This is my first project built with 5.x local and
MP> 4.1.x remote, so if anyone with more experience spots any fatal flaws
MP> where I'm using 5.x specific methods etc, I'd appreciate knowing about them)
MP> Currently, I'm instantiating the MDB2 class in my main page, then
MP> passing it as an object reference to each of the other classes that
MP> require it.
MP> A simple representation of my main page and a class would be:
MP> <?
MP> $db =& connectMDB2(); // function that returns instantiated MDB2 object
MP> $comments = new displayComments(); // class that performs displaying
MP> of comments
MP> $comments->set_db($db); // passing the MDB2 object to the class
MP> $comments->doSomethingElse();
?>>
MP> The displayComments() class might then look something like:
MP> class displayComments{
MP> private $db;
MP> public function set_db(&$db){
$this->>db =& $db;
MP> }
MP> public function doSomethingElse(){
MP> $sql = "SELECT something FROM sometable";
$rs = $this->>db->query($sql);
MP> while ($row = $rs->fetchRow(MDB2_FETCHMODE_OBJECT)){
echo $row->>something."<br />";
MP> }
$rs->>free();
MP> }
MP> }
MP> My main page calls on at least 8 or 9 such classes as it is being built,
MP> and I'm concerned that I may not be handling the MDB2 object in respect
MP> to them in the most efficient way possible. In a way, I guess this isn't
MP> specifically about the MDB2 package, but more about how to handle
MP> objects when they are required within classes.
MP> I'd very much appreciate any comments or advice anyone might be able to
MP> give.
MP> Much warmth,
MP> Murray
My solution to this problem was to write a class loader and to call it
whenever I needed a particular class. I give each instance a name and
the loader checks if an instance of that class, that name exists. If
it does it returns a reference directly, if not it loads the class
and then returns the reference. This way I don't have to worry about
passing references around. It is a little more complex than that as I
also check if the class was passed the same variables, if not it calls
the constructor again. Let me know if you want to try the code (only
tested on php4)
--
regards,
Tom
--- End Message ---
--- Begin Message ---
For PHP 4.x sites I used my index page to capture the HTTP request and use a
switch statement to call the content or task based on the $_GET and $_POST
arrays. That was very inefficient and the Switch case became totally
unmanageable along with the rest of the site.
I am re-designing the site using PHP5 and OO design patterns like Composite
and Builder as an example. I know these are basic patterns but its a start.
Anyway I am not sure how to capture the HTTP request and pass it to the
relevant objects. Is there a generic wayı developers process the request
to call the classes and generate the needed objects in PHP5?
Thanks for your help!
T
--- End Message ---
--- Begin Message ---
On 6/2/05, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>
> For PHP 4.x sites I used my index page to capture the HTTP request and use a
> switch statement to call the content or task based on the $_GET and $_POST
> arrays. That was very inefficient and the Switch case became totally
> unmanageable along with the rest of the site.
>
> I am re-designing the site using PHP5 and OO design patterns like Composite
> and Builder as an example. I know these are basic patterns but its a start.
> Anyway I am not sure how to capture the HTTP request and pass it to the
> relevant objects. Is there a generic Œway¹ developers process the request
> to call the classes and generate the needed objects in PHP5?
I'd use $_REQUEST if I were expecting to access both $_GET and $_POST
arrays frequently/equally.
__autoload() is pretty handy, keeps you from writing tons of include statements.
--
Greg Donald
Zend Certified Engineer
http://destiney.com/
--- End Message ---
--- Begin Message ---
Richard Davey wrote:
Hello Mark,
Thursday, June 2, 2005, 4:18:30 AM, you wrote:
MS> <?php
MS> session_start();
MS> include("database.php");
?>>
I would recommend setting UTF-8 as the Content-type via PHP itself:
header('Content-type: UTF-8') - do it as one of the first things when
you're ready to output the HTML.
Yes, have already tried it. No success.
MS> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
MS> "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
This may well be a cause of the problem - your HTML doesn't look like
it's XTHML Strict compatible at all, so browsers are going to
re-render it (IE into Quirks mode). I would remove the DocType for now
or fix the mark-up errors.
Can't c that as it, as static J renders fine.
MS> <?php
MS> if (isset($_REQUEST[product_id])) {
MS> $product_id = $_REQUEST[product_id];
See the previous reply about why this isn't safe, but also it should
be: $_REQUEST['product_id'] (note the quotes) to avoid PHP scanning
for constants.
Ok, will look into that stuff a little more, once I get J rendering
correctly.
MS> for ($i=0; $i<$num; $i++){
MS> echo "<tr align=\"center\"><td>PRODUCT
MS> NAME</td><td>".$rows['product_name']."</td><br><tr
From a code point of view this is correct. Let's check a few obvious
things: does PHP have the mb extension installed?
Yes, installed.
If so what is the
default character-set in php.ini?
Best regards,
Richard Davey
httpd.conf:
AddDefaultCharset utf-8
AddCharset ISO-8859-1 .iso8859-1 .latin1
AddCharset ISO-8859-2 .iso8859-2 .latin2 .cen
AddCharset ISO-8859-3 .iso8859-3 .latin3
AddCharset ISO-8859-4 .iso8859-4 .latin4
AddCharset ISO-8859-5 .iso8859-5 .latin5 .cyr .iso-ru
AddCharset ISO-8859-6 .iso8859-6 .latin6 .arb
AddCharset ISO-8859-7 .iso8859-7 .latin7 .grk
AddCharset ISO-8859-8 .iso8859-8 .latin8 .heb
AddCharset ISO-8859-9 .iso8859-9 .latin9 .trk
AddCharset ISO-2022-JP .iso2022-jp .jis
AddCharset ISO-2022-KR .iso2022-kr .kis
AddCharset ISO-2022-CN .iso2022-cn .cis
AddCharset Big5 .Big5 .big5
# For russian, more than one charset is used (depends on client, mostly):
AddCharset WINDOWS-1251 .cp-1251 .win-1251
AddCharset CP866 .cp866
AddCharset KOI8-r .koi8-r .koi8-ru
AddCharset KOI8-ru .koi8-uk .ua
AddCharset ISO-10646-UCS-2 .ucs2
AddCharset ISO-10646-UCS-4 .ucs4
AddCharset UTF-8 .utf8
php.ini:
output_handler = mb_output_handler
;; Set HTTP header charset
default_charset = UTF-8
[mbstring]
; language for internal character representation.
mbstring.language = Neutral
; internal/script encoding.
; Some encoding cannot work as internal encoding.
; (e.g. SJIS, BIG5, ISO-2022-*)
mbstring.internal_encoding = UTF-8
; http input encoding.
mbstring.http_input = auto
; http output encoding. mb_output_handler must be
; registered as output buffer to function
mbstring.http_output = UTF-8
; enable automatic encoding translation accoding to
; mbstring.internal_encoding setting. Input chars are
; converted to internal encoding by setting this to On.
; Note: Do _not_ use automatic encoding translation for
; portable libs/applications.
mbstring.encoding_translation = On
; automatic encoding detection order.
; auto means
mbstring.detect_order = auto
; substitute_character used when character cannot be converted
; one from another
mbstring.substitute_character = none
Cheers.
Mark Sargent.
--- End Message ---
--- Begin Message ---
On Thu, 2 Jun 2005 11:58:26 +0100, in php.general
[EMAIL PROTECTED] (Richard Davey) wrote:
>I would recommend setting UTF-8 as the Content-type via PHP itself:
>header('Content-type: UTF-8') - do it as one of the first things when
>you're ready to output the HTML.
UTF-8 is a charset, not a Content-type.
A quick test shows that the HTTP header output from Apache would
contain:
Content-Type: UTF-8
The correct way - if one wants utf-8 as charset - is:
header("Content-Type: index/html; charset=utf-8");
--
- Peter Brodersen
--- End Message ---
--- Begin Message ---
hi guys,
I sent an earlier post but no answers, so I just want you to list the
software you use to do reporting and then i can go through the answers
and see if any are applicable.
Also comment on the good and bad things/recommendations and ones you
would not recommend.
thanks in advance
--
Angelo Zanetti
Z Logic
www.zlogic.co.za
[c] +27 72 441 3355
[t] +27 21 469 1052
--- End Message ---
--- Begin Message ---
system reporting:
eg: sales per province/state
well any reporting, most systems use reporting im sure most of the
reporting is done using PHP.
[EMAIL PROTECTED] wrote:
>For reporting what?
>
>-------------
>hi guys,
>
>I sent an earlier post but no answers, so I just want you to list the
>software you use to do reporting and then i can go through the answers
>and see if any are applicable.
>Also comment on the good and bad things/recommendations and ones you
>would not recommend.
>
>thanks in advance
>
>
>
--- End Message ---
--- Begin Message ---
For reporting what?
-------------
hi guys,
I sent an earlier post but no answers, so I just want you to list the
software you use to do reporting and then i can go through the answers
and see if any are applicable.
Also comment on the good and bad things/recommendations and ones you
would not recommend.
thanks in advance
--
Angelo Zanetti
Z Logic
www.zlogic.co.za
[c] +27 72 441 3355
[t] +27 21 469 1052
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---
On Thu, 02 Jun 2005 00:44:12 -0400, in php.general [EMAIL PROTECTED]
(Chris Shiflett) wrote:
>3. The debate between storing includes outside of document root versus
>using a .php file extension, instructing Apache to process .inc files as
>PHP, instructing PHP to deny requests for .inc files, etc.
I agree regarding code on your own server/project.
I do believe that the situation is another when you are manager of
some project where your php code is being distributed to several
different systems beyond your control (think phpmyadmin, phpnuke, etc.
- maybe not the best examples regarding security record, though :-)
In that case, one could create some requirements regarding the
installation of the php application that some customers at web hosting
companies might not be able to follow (e.g. create a .htaccess denying
.inc-files, create folders outsite of webscope), or one could make a
trade-off between ease of installation and highed security. One way of
achieving this could be the sole use of .php-extensions (and code
constructed in a way that direct access would cause no harm).
I believe that there is reason to differ in these two cases for
practical reasons. In the latter case a lot of assumptions could cause
damage. Poorly implemented high security could be worse than moderate,
application based security.
--
- Peter Brodersen
--- End Message ---
--- Begin Message ---
On 6/2/05, Rory McKinley <[EMAIL PROTECTED]> wrote:
> Richard Davey wrote:
> <snip>
> > If the DLL has a COM interface then you can use PHP to talk to it, the
> > process is actually quite straight forward (depending on what the DLL
> > actually does of course).
> >
> > Best regards,
> >
> > Richard Davey
> <snip>
>
> Hi Richard
>
> Rory (the other one ;) ) also mentioned a COM interface - currently I am
> trying to find out if such a beast exists for the DLL, there is nothing
> in the documentation. I would be interested to know if there was an easy
> way to found out - still STFW though.
>
> Have downloaded ffi as per Rory's suggestion, from the attached
> documentation it looks as if it may be doable if the COM route doesn't
> pan out.
Just bare in mind, that I've never used ffi, and it's still alpha
code, and I'm not taking any blame it causes your dog to
explode.........
>
> Regards
>
> Rory
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
--- End Message ---
--- Begin Message ---
Rory Browne wrote:
<snip>
<snip>
> Just bare in mind, that I've never used ffi, and it's still alpha
> code, and I'm not taking any blame it causes your dog to
> explode.........
<snip>
That's ok, I am sure there is no chance...rover, rover,what's the matter
boy? (Sound of dog exploding)
Nooooooooooooooooooooooooooooooooooooooooo..... ;)
Don't worry I am only planning on using it to generate other data on a
dev box - so about the extreme worst that is going to happen is I have
to reload the dev box - and anyway, what's life without a bit of adventure?
Will let you know how it works out - only catch is I may have to dig
through my library to find the book on "C" that I never read ;) for some
of the syntax....
Rory (the other one)
--- End Message ---
--- Begin Message ---
If the ffi route doesn't work, just create a COM wrapper for the simple DLL,
then you can map any functions you need.
-----Original Message-----
From: Rory McKinley [mailto:[EMAIL PROTECTED]
Sent: 03 June 2005 11:17
To: php-general@lists.php.net
Cc: Rory Browne
Subject: Re: [PHP] Accessing DLL from PHP
*************************************
This e-mail has been received by the Revenue Internet e-mail service.
*************************************
Rory Browne wrote:
<snip>
<snip>
> Just bare in mind, that I've never used ffi, and it's still alpha
> code, and I'm not taking any blame it causes your dog to
> explode.........
<snip>
That's ok, I am sure there is no chance...rover, rover,what's the matter
boy? (Sound of dog exploding)
Nooooooooooooooooooooooooooooooooooooooooo..... ;)
Don't worry I am only planning on using it to generate other data on a
dev box - so about the extreme worst that is going to happen is I have
to reload the dev box - and anyway, what's life without a bit of adventure?
Will let you know how it works out - only catch is I may have to dig
through my library to find the book on "C" that I never read ;) for some
of the syntax....
Rory (the other one)
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
************************
This message has been delivered to the Internet by the Revenue Internet e-mail
service
*************************
--- End Message ---
--- Begin Message ---
ALERT!
This e-mail, in its original form, contained one or more attached files that
were infected with a virus, worm, or other type of security threat. This e-mail
was sent from a Road Runner IP address. As part of our continuing initiative to
stop the spread of malicious viruses, Road Runner scans all outbound e-mail
attachments. If a virus, worm, or other security threat is found, Road Runner
cleans or deletes the infected attachments as necessary, but continues to send
the original message content to the recipient. Further information on this
initiative can be found at http://help.rr.com/faqs/e_mgsp.html.
Please be advised that Road Runner does not contact the original sender of the
e-mail as part of the scanning process. Road Runner recommends that if the
sender is known to you, you contact them directly and advise them of their
issue. If you do not know the sender, we advise you to forward this message in
its entirety (including full headers) to the Road Runner Abuse Department, at
[EMAIL PROTECTED]
The original message was received at Fri, 3 Jun 2005 07:20:41 -0400
from 94.175.43.192
----- The following addresses had permanent fatal errors -----
php-general@lists.php.net
----- Transcript of session follows -----
... while talking to lists.php.net.:
554 5.0.0 Service unavailable; [199.254.74.96] blocked using bl.spamcop.net,
reason: Blocked
Session aborted, reason: lost connection
file attachment: document.zip
This e-mail in its original form contained one or more attached files that were
infected with the [EMAIL PROTECTED] virus or worm. They have been removed.
For more information on Road Runner's virus filtering initiative, visit our
Help & Member Services pages at http://help.rr.com, or the virus filtering
information page directly at http://help.rr.com/faqs/e_mgsp.html.
--- End Message ---