php-general Digest 3 Jun 2005 12:39:03 -0000 Issue 3491
php-general Digest 3 Jun 2005 12:39:03 - 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 -- ---BeginMessage--- 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-generalm=111409575703230w=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. -- 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--- ---BeginMessage--- 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--- ---BeginMessage--- 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--- ---BeginMessage--- My average post takes 2+ hours. mayo -Original
Re: [PHP] Best way to use other objects within classes?
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 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] what do you guys use for reporting?
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
Re: [PHP] what do you guys use for reporting?
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 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] what do you guys use for reporting?
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 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] .INC files
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 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: Re[2]: [PHP] Japanese with UTF-8 and mysql
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 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Accessing DLL from PHP
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 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Accessing DLL from PHP
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) No. ;) 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
RE: [PHP] Accessing DLL from PHP
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) No. ;) 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 * -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] MESSAGE COULD NOT BE DELIVERED
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. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Site Design Strategy
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. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Newbie - Request interface for PHP 5 website
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/
Re: [PHP] what do you guys use for reporting?
On 6/3/05, Angelo Zanetti [EMAIL PROTECTED] wrote: I just want you to list the software you use to do reporting PHP, Perl, MySQL, PostgreSQL. Also comment on the good and bad things/recommendations and ones you would not recommend. Perl = Practical Extraction and `Reporting` Language. It's really good for making report files in most any format you want. -- Greg Donald Zend Certified Engineer http://destiney.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Site Design Strategy
On 6/2/05, asinning [EMAIL PROTECTED] wrote: 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. Use a framework like MVC. Your PHP code would be seperate from your design templates. Smarty is a heavy-weight for templating. I use eval() for most of my own hobby project templating. 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. Sounds like a CMS. I use this web based HTML editor when I need to let designers play in my projects: http://www.htmlarea.com/ 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. You might look into Apache's mod_rewrite to help clean those URLs up. Search engines love nice clean URLs if that sort of thing matters to you. -- Greg Donald Zend Certified Engineer http://destiney.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Site Design Strategy
what you are looking for is a CMS system something like www.plone.org also there is an rich text HTML area which you can use on your site, check this out: http://www.solmetra.com/en/disp.php/en_products/en_spaw/en_spaw_intro it might help hope it does. Angelo Greg Donald wrote: On 6/2/05, asinning [EMAIL PROTECTED] wrote: 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. Use a framework like MVC. Your PHP code would be seperate from your design templates. Smarty is a heavy-weight for templating. I use eval() for most of my own hobby project templating. 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. Sounds like a CMS. I use this web based HTML editor when I need to let designers play in my projects: http://www.htmlarea.com/ 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. You might look into Apache's mod_rewrite to help clean those URLs up. Search engines love nice clean URLs if that sort of thing matters to you.
Re: [PHP] How to find random records in a subset?
Try using a temporary table. It should be pretty fast. You'd do something like 1. Select from table1 according to search criteria 2. Insert data from #1 into temp_table1 3. Random selection from temp_table1 kgt Brian Dunning wrote: I am using a routine to find 50 random records in a large MySQL database (about a million records) where I generate a list of 50 random unique ID's, and then use MySQL's in command to find them. I can't use order by rand() due to its performance hit. But I have to take it one more step: I want to first limit my found set to those matching a different search criteria, and then find 50 of those. Anyone? Can this be done all within MySQL, or is it going to require some humongo PHP arrays? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How to find random records in a subset?
Brian Dunning wrote: I am using a routine to find 50 random records in a large MySQL database (about a million records) where I generate a list of 50 random unique ID's, why can't you use the where condition in the above query? and then use MySQL's in command to find them. I can't use order by rand() due to its performance hit. But I have to take it one more step: I want to first limit my found set to those matching a different search criteria, and then find 50 of those. Anyone? Can this be done all within MySQL, or is it going to require some humongo PHP arrays? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How to find random records in a subset?
On Jun 3, 2005, at 6:48 AM, Marek Kilimajer wrote: Brian Dunning wrote: I am using a routine to find 50 random records in a large MySQL database (about a million records) where I generate a list of 50 random unique ID's, why can't you use the where condition in the above query? Because I wouldn't get all 50 records that I need - I'd only get the few out of the 50 that happened to be in the needed subset. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Site Design Strategy
On 6/3/05, Angelo Zanetti [EMAIL PROTECTED] wrote: what you are looking for is a CMS system something like www.plone.org also there is an rich text HTML area which you can use on your site, check this out: http://www.solmetra.com/en/disp.php/en_products/en_spaw/en_spaw_intro it might help hope it does. There's no need to reply to me directly since I'm on the list. Besides that I'm not the requester. Try using a threaded email client, it is a mailing list after all. -- Greg Donald Zend Certified Engineer http://destiney.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] What are these weird variables??
I'm using a class that I downloaded, and to access the database it uses variable names in all caps, like this: if(!defined(MAGPIE_DBUSER)) define(MAGPIE_DBUSER, brian); ... $dbuser = MAGPIE_DBUSER; ... $dbh = mysql_connect($dbhost,$dbuser,$dbpass); And it works fine. But I already have my database parameters configured in some existing variables, so I tried to simplify all of the above and access it like this (these variables are my existing ones): $dbh = mysql_connect($db_host,$db_user,$db_pass); And it no longer works, says it can't connect to the database. What's the deal with those variables in all caps, and why won't mine work? The above class is inside a defined function, are my variables not valid inside that function? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] What are these weird variables??
[snip] I'm using a class that I downloaded, and to access the database it uses variable names in all caps, like this: if(!defined(MAGPIE_DBUSER)) define(MAGPIE_DBUSER, brian); ... $dbuser = MAGPIE_DBUSER; ... $dbh = mysql_connect($dbhost,$dbuser,$dbpass); And it works fine. But I already have my database parameters configured in some existing variables, so I tried to simplify all of the above and access it like this (these variables are my existing ones): $dbh = mysql_connect($db_host,$db_user,$db_pass); And it no longer works, says it can't connect to the database. What's the deal with those variables in all caps, and why won't mine work? The above class is inside a defined function, are my variables not valid inside that function? [/snip] http://www.php.net/constants -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Check class definition
You can use defined() to check to see if a constant has been defined. You can use function_exists() to see if a function has been defined. But what can you use to check to see if a class has been defined? thnx, Chris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] What are these weird variables??
On 6/3/05, Brian Dunning [EMAIL PROTECTED] wrote: I'm using a class that I downloaded, and to access the database it uses variable names in all caps, like this: those are constants: it's like a variable, except once you define it, it stays set at that value and you can't change it. And it no longer works, says it can't connect to the database. What's the deal with those variables in all caps, and why won't mine work? The above class is inside a defined function, are my variables not valid inside that function? well, if you have variables in the body of your script, and you want to use those same variables, you should declare them global in your function. http://us3.php.net/variables.scope hope that helps drew -- dc .. drewcore.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] What are these weird variables??
Brian Dunning wrote: I'm using a class that I downloaded, and to access the database it uses variable names in all caps, like this: if(!defined(MAGPIE_DBUSER)) define(MAGPIE_DBUSER, brian); ... $dbuser = MAGPIE_DBUSER; ... $dbh = mysql_connect($dbhost,$dbuser,$dbpass); And it works fine. But I already have my database parameters configured in some existing variables, so I tried to simplify all of the above and access it like this (these variables are my existing ones): $dbh = mysql_connect($db_host,$db_user,$db_pass); And it no longer works, says it can't connect to the database. What's the deal with those variables in all caps, and why won't mine work? The above class is inside a defined function, are my variables not valid inside that function? http://us4.php.net/constants -- John C. Nichel ÜberGeek KegWorks.com 716.856.9675 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How to find random records in a subset?
Brian Dunning wrote: On Jun 3, 2005, at 6:48 AM, Marek Kilimajer wrote: Brian Dunning wrote: I am using a routine to find 50 random records in a large MySQL database (about a million records) where I generate a list of 50 random unique ID's, why can't you use the where condition in the above query? Because I wouldn't get all 50 records that I need - I'd only get the few out of the 50 that happened to be in the needed subset. I don't think you get me or I don't get you. Currently you are doing: 1. select id from table order by rand() limit 50 2. select * from table where id in($random_set) right? I meant why not use the where condition in the first query. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Site Design Strategy
On 6/3/05, Greg Donald [EMAIL PROTECTED] wrote: On 6/3/05, Angelo Zanetti [EMAIL PROTECTED] wrote: what you are looking for is a CMS system something like www.plone.org also there is an rich text HTML area which you can use on your site, check this out: http://www.solmetra.com/en/disp.php/en_products/en_spaw/en_spaw_intro it might help hope it does. There's no need to reply to me directly since I'm on the list. FYI that happens automaticly when you reply to all, which a lot of people do for mailing lists. Besides that I'm not the requester. Try using a threaded email client, it is a mailing list after all. I'm not sure what Angelo uses but gmail is threaded, and the same thing happens with my mail client. -- Greg Donald Zend Certified Engineer http://destiney.com/ -- 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] Site Design Strategy
On 6/3/05, Rory Browne [EMAIL PROTECTED] wrote: There's no need to reply to me directly since I'm on the list. FYI that happens automaticly when you reply to all, which a lot of people do for mailing lists. I hit 'reply to all' as well, then I remove everything but [EMAIL PROTECTED] It's not that hard, really. I'm not sure what Angelo uses but gmail is threaded, and the same thing happens with my mail client. Threaded -- as in not replying directly to a person who didn't ask the question. I replied with answers/opinions to the original poster but then you replied to me as if I were the one asking the question. Just a matter of paying attention to what's going on I guess. A threaded email client helps in that regard is why I suggested it. Do what you want, I dunno why I even made any suggestions. -- Greg Donald Zend Certified Engineer http://destiney.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Site Design Strategy
threaded in terms of the posts being shown in a tree view kinda way... so if I reply to your post in a threaded mail cleint it will be shown under your post/reply/message where as if I replied to the origional it will be seen on the same level as the others who replied to the origional post for the first time. hope im making sense. its just a hierarchical way of showing threads. by the way i'm using thunderbird! Greg Donald wrote: On 6/3/05, Rory Browne [EMAIL PROTECTED] wrote: There's no need to reply to me directly since I'm on the list. FYI that happens automaticly when you reply to all, which a lot of people do for mailing lists. I hit 'reply to all' as well, then I remove everything but [EMAIL PROTECTED] It's not that hard, really. I'm not sure what Angelo uses but gmail is threaded, and the same thing happens with my mail client. Threaded -- as in not replying directly to a person who didn't ask the question. I replied with answers/opinions to the original poster but then you replied to me as if I were the one asking the question. Just a matter of paying attention to what's going on I guess. A threaded email client helps in that regard is why I suggested it. Do what you want, I dunno why I even made any suggestions.
Re: [PHP] Site Design Strategy
threaded in terms of the posts being shown in a tree view kinda way... so if I reply to your post in a threaded mail cleint it will be shown under your post/reply/message where as if I replied to the origional it will be seen on the same level as the others who replied to the origional post for the first time. hope im making sense. its just a hierarchical way of showing threads. by the way i'm using thunderbird! Also some mailing lists are setup so that when you reply all it will send the message to the people who posted the message previously. I suppose this is to help with message filtering etc... but other mailing lists if you reply all it will just sent the message to the mailing list address. Greg Donald wrote: On 6/3/05, Rory Browne [EMAIL PROTECTED] wrote: There's no need to reply to me directly since I'm on the list. FYI that happens automaticly when you reply to all, which a lot of people do for mailing lists. I hit 'reply to all' as well, then I remove everything but [EMAIL PROTECTED] It's not that hard, really. I'm not sure what Angelo uses but gmail is threaded, and the same thing happens with my mail client. Threaded -- as in not replying directly to a person who didn't ask the question. I replied with answers/opinions to the original poster but then you replied to me as if I were the one asking the question. Just a matter of paying attention to what's going on I guess. A threaded email client helps in that regard is why I suggested it. Do what you want, I dunno why I even made any suggestions.
[PHP] Re: Check class definition
* Chris Boget [EMAIL PROTECTED]: You can use defined() to check to see if a constant has been defined. You can use function_exists() to see if a function has been defined. But what can you use to check to see if a class has been defined? class_exists() -- 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 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Check class definition
You can use defined() to check to see if a constant has been defined. You can use function_exists() to see if a function has been defined. But what can you use to check to see if a class has been defined? class_exists() I found that after it dawned on me to search for the phrase exists in the documentation. I wonder why that function isn't referenced in the function_exists() documentation page at the bottom where like functions are listed...? thnx, Chris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Returned mail: Data format error
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 included as attachment file attachment: message.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. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] what do you guys use for reporting?
system reporting: eg: sales per province/state well any reporting, most systems use reporting im sure most of the reporting is done using PHP. I haven't used either, but mabye these... OpenRPT: The First Fully Cross-Platform SQL Report Writer http://www.openrpt.com/ DataVision Home http://datavision.sourceforge.net/ [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 -- 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: Best way to use other objects within classes?
Matthew Weier O'Phinney wrote: * 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 If you're developing with PHP5, but the production environment is PHP4 then at the top of each script you probably want to add: ?php ini_set('zend.ze1_compatibility_mode', 1); ? This way you will have objects default to pass by value instead of by reference and you don't end up deploying to production server with some really hard-to-find dereferencing problems. -- Teach a man to fish... NEW? | http://www.catb.org/~esr/faqs/smart-questions.html STFA | http://marc.theaimsgroup.com/?l=php-generalw=2 STFM | http://php.net/manual/en/index.php STFW | http://www.google.com/search?q=php LAZY | http://mycroft.mozdev.org/download.html?name=PHPsubmitform=Find+search+plugins -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Newbie - Request interface for PHP 5 website
Greg Donald wrote: 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. I agree with Greg. Although I would add that if you are using GET / POST arguments to determine which pages to include then you minimally want to filter to be sure they don't try to read sensitive files (/etc/passwd, My Documents, and the like). And since I'm paranoid I might also want to escapeshellarg() the $_REQUEST variable you're using. -- Teach a man to fish... NEW? | http://www.catb.org/~esr/faqs/smart-questions.html STFA | http://marc.theaimsgroup.com/?l=php-generalw=2 STFM | http://php.net/manual/en/index.php STFW | http://www.google.com/search?q=php LAZY | http://mycroft.mozdev.org/download.html?name=PHPsubmitform=Find+search+plugins -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Re: Best way to use other objects within classes?
If you're developing with PHP5, but the production environment is PHP4 then at the top of each script you probably want to add: ?php ini_set('zend.ze1_compatibility_mode', 1); ? This way you will have objects default to pass by value instead of by reference and you don't end up deploying to production server with some really hard-to-find dereferencing problems. Hi Jason, Not a bad tip, thank you! However, I've been, to the best of my knowledge, explicit in passing by reference in my code wherever I've needed to access objects within classes etc. Many thanks, Murray -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Best way to use other objects within classes?
Then you're a better coder than me, but then again who isn't. :) It's just that in general I try to make things as strict / difficult as possible to code during development so that I will catch as many errors as possible before hand. But then again I use error_reporting(E_ALL). -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Quick q, most prolly 0T
On 6/2/05, Ryan A [EMAIL PROTECTED] wrote: Hi Chris, Thanks for replying I noticed a site that is using php, but he is has shortened the url so that the filename was not shown.. eg: somesite.com/?a=1 How did they do that? It's called a directory index. Examples include index.html and index.php. You configure this with the DirectoryIndex directive in httpd.conf. I did see the directory index in the httpd.conf file, but let me explain a bit more about what I am trying to do. 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...but i dont want to show the client that he is going to main.php so I wanted to use it like this clientssite.com/?do=blah Personally I reckon you should just enable the page. Once it is already online, particularly if he has visitors, then it going offline will be more expensive for him, than if it were never online. Having that said, you could simply password protect it and give him the password, or else require that any unauthorised IP's view the under_construction page, whilst, an authorised IP will view the correct page. This could be a simple if ($_SERVER['REMOTE_ADDR'] != 'whatever'){ die(This page is under construction); Thanks, Ryan -- No virus found in this outgoing message. Checked by AVG Anti-Virus. Version: 7.0.322 / Virus Database: 267.4.0 - Release Date: 6/1/2005 -- 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: Exporting to MS Word or Excel
Miguel Guirao wrote: 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!! If you're using LAMP then you're probably out of luck. The only possibility I can think of would be to check out the MONO or WINE projects and see if you can access the COM interfaces for MS Office through one of those. I've never actually done this, but it's worth a look. -- Teach a man to fish... NEW? | http://www.catb.org/~esr/faqs/smart-questions.html STFA | http://marc.theaimsgroup.com/?l=php-generalw=2 STFM | http://php.net/manual/en/index.php STFW | http://www.google.com/search?q=php LAZY | http://mycroft.mozdev.org/download.html?name=PHPsubmitform=Find+search+plugins -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Delay?
What's keeping you. There are no official PHP forums. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Delay?
GamblerZG wrote: What's keeping you. There are no official PHP forums. [EMAIL PROTECTED] jnichel]$ whois officialphpforums.com [Querying whois.internic.net] [whois.internic.net] Whois Server Version 1.3 Domain names in the .com and .net domains can now be registered with many different competing registrars. Go to http://www.internic.net for detailed information. No match for domain OFFICIALPHPFORUMS.COM. There you go. You can register the domain and start the official php forums. -- John C. Nichel ÜberGeek KegWorks.com 716.856.9675 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Delay?
On 6/3/05, GamblerZG [EMAIL PROTECTED] wrote: What's keeping you. There are no official PHP forums. So start one. Lots of free forum scripts out there. Domain names are like $8.95 or something, and hosting can be had for free if you look around, or for cheap if you don't. Besides the PHP manual, this list is the best PHP resource there is. There are some smart and experienced people here who go beyond the casual interest of visiting a web forum. Here your questions are put in front of them no matter. Rasmus himself even answers questions. Using x for free then complaining that it's not y benefits no one. -- Greg Donald Zend Certified Engineer http://destiney.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] htmlArea - a 'client editor'
Ryan A: Do you mean htmlArea? http://www.dynarch.com/projects/htmlarea/ .. we used htmlArea in one of our projects and were quite happy with the simple user interface. It had a couple of bugs ... but maybe the newer release has squashed these? Check with the developer. Rob. http://www.globalissa.com _ Ryan A wrote: Hey guys (and girl...as we have one on the list...(that i know of)), snip 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 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How to find random records in a subset?
On Thu, June 2, 2005 4:31 pm, Brian Dunning said: I am using a routine to find 50 random records in a large MySQL database (about a million records) where I generate a list of 50 random unique ID's, and then use MySQL's in command to find them. I can't use order by rand() due to its performance hit. But I have to take it one more step: I want to first limit my found set to those matching a different search criteria, and then find 50 of those. If your search criteria is on an indexed field, you may find that the order by rand() is much much much less of a problem once you winnow your record set down to the search criteria. Or, more precisely, if your search parameters get you a small result set, the order by rand() will be fast because that is done AFTER the smaller result set is determined. If your search parameters get you a HUGE set, order by rand() not so fast. Anyone? Can this be done all within MySQL, or is it going to require some humongo PHP arrays? How do you generate a list of 50 random unique IDs in the first place? How to you guarantee that all those IDs are in the database? What if a record gets deleted? I suppose *ONE* option to try would be to just get the full result set, and then use PHP's mt_rand() to skip forward/backward a random number of records, using something like: //untested code $count = mysql_num_rows($result); $ids = array(); while (count($ids) 50 count($ids) $count){ $random = mt_rand(0, $count - 1); mysql_data_seek($result, $random); $id = $result['id']; //Note use of $id as key, so duplicates are ignored. $ids[$id] = $id; } This will perform MISERABLY when your number of records is closer to 50. It would be okay only if all searches result in tons and tons of records. One does have to wonder: If the user has put in multiple search criteria, why order randomly? Why not put best matches first? -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Quick q, most prolly 0T
On Wed, June 1, 2005 8:42 pm, Ryan A said: On 6/2/2005 5:17:47 AM, Richard Lynch ([EMAIL PROTECTED]) wrote: URL re-writing can do that -- It ends up using his 'index' file (or whatever) but you don't see it in the URL. Thanks for replying. But if I want to copy his exact way of doing things...instead of index file I would like to use main.phphow would i do that? Change your httpd.conf to use main.php as an index file. Open up httpd.conf, search for index.htm, and tack on main.php at the end of that list of filenames. Now your main.php is an index file, and if there is no OTHER filename from that list in the directory, main.php will get used. The list is in order, so you could put main.php first to be 100% certain yourmain.php wins the race but then if somebody else has index.htm and main.php, you just screwed up their site... The reason I dont think its url rewriting is the rest of the files have all their values eg: somesite.com/?blah=blah somesite.com/?something=somethingdo=1 somesite.com/?page=introflash=no -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] autocomplete a field
Hi, I am new to php and I would like to find out if there's some kind of a function that would autocomplete the word/value when the user is trying to fill out a field in a form. Thank you. Olga -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] autocomplete a field
[snip] Hi, I am new to php and I would like to find out if there's some kind of a function that would autocomplete the word/value when the user is trying to fill out a field in a form. Thank you. [/snip] Since PHP is server side it will not do this. Look into JavaScript. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] autocomplete a field
Olga Urban wrote: Hi, I am new to php and I would like to find out if there's some kind of a function that would autocomplete the word/value when the user is trying to fill out a field in a form. Thank you. Olga That is a client side scripting issue... try javascript... HTH, Mikey -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] autocomplete a field
Hi, I am new to php and I would like to find out if there's some kind of a function that would autocomplete the word/value when the user is trying to fill out a field in a form. Thank you. PHP is server side, not client side, where the form is. You would need to use javascript for that. JM -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] autocomplete a field
Hi, I am new to php and I would like to find out if there's some kind of a function that would autocomplete the word/value when the user is trying to fill out a field in a form. Thank you. This is a JavaScript issue, but that said... http://www.pjkh.com/wiki/field_completion Toot! Toot! ;-) I'm sure there are others as well. If you need it to be more dynamic, try here: http://developer.apple.com/internet/webcontent/xmlhttpreq.html http://jpspan.sourceforge.net/wiki/doku.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] autocomplete a field
Hi Philip! congrats on being new to PHP... you'll find that PHP is very robust 'Server Side Scripting Language'... you'll probably want to subscribe to the javascript mailing list for your javascript questions... the people here want you to keep the questions on this mailing list restricted to PHP.. also, the subscribers here would appreciate it if you search the mailing list first, check the PHP manual and Google before you post your question... it just keeps the repetative questions to a minumum... But, I would like to help you out... So, here is a couple of things to look at... while most of these are pretty advance, they'll show you a nice combination of javascript and PHP that will give you an auto complete feature... since you didn't give any details about what info you want to auto complete (ie users database... search terms) I will just post to general info for you so you can see how other people are accomplishing this (1) You may want to do some reading about application architecture.. Google uses an architecture similar to the one described in the article below.. the architecture is called AJAX, XMLHttpRequest... or what ever you want to call it... but there is some good examples here http://www.adaptivepath.com/publications/essays/archives/000385.php (2) this is a great tutorial using PHP and Javascript which references a dictionary http://www.developertutorials.com/tutorials/php/google-suggest-with-php-050525/page1.html http://www.peej.co.uk/articles/rich-user-experience.html Good luck Have fun! Joe On 6/3/05, Philip Hallstrom [EMAIL PROTECTED] wrote: Hi, I am new to php and I would like to find out if there's some kind of a function that would autocomplete the word/value when the user is trying to fill out a field in a form. Thank you. This is a JavaScript issue, but that said... http://www.pjkh.com/wiki/field_completion Toot! Toot! ;-) I'm sure there are others as well. If you need it to be more dynamic, try here: http://developer.apple.com/internet/webcontent/xmlhttpreq.html http://jpspan.sourceforge.net/wiki/doku.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Joe Harman - Do not go where the path may lead, go instead where there is no path and leave a trail. - Ralph Waldo Emerson -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Check class definition
Chris Boget wrote: You can use defined() to check to see if a constant has been defined. You can use function_exists() to see if a function has been defined. But what can you use to check to see if a class has been defined? class_exists() // and $is = class_exists($er, false); // suppress _autoload() call. php5 I found that after it dawned on me to search for the phrase exists in the documentation. I wonder why that function isn't referenced in the function_exists() documentation page at the bottom where like functions are listed...? thnx, Chris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How to find random records in a subset?
Richard Lynch [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] How do you generate a list of 50 random unique IDs in the first place? By using the SQL function to create those randoms How to you guarantee that all those IDs are in the database? No need for that. When you do 'order by rand()' SQL understand that you are adding an extra, unnamed column which contains the value of the function rand(). Since rand() is, of course, random, the records are ordered in arbitrary ways. Then you take the first 50 or whatever of those randomly sorted records. The problem is that to do so, it will have to read sequentially all of the table to assign each record a random number, and then sort those. It works for short tables, it is a killer for big ones. Once upon a time, on a table with an autoincrement field, I first fetched the minimum and maximum current value of that autoincrement field. Then I did individual one-record selects (limit 1) with the key equal or greater to a set of randoms created within those minimum and maximum value. Since two randoms could produce the same record, I checked the key of each resulting record against an array which had the primary keys as key. When the count() of that array reached the number of records I wanted, I was done. This was for a very little subset of a really large table and in those circumstances it was faster than the other way. satyam What if a record gets deleted? I suppose *ONE* option to try would be to just get the full result set, and then use PHP's mt_rand() to skip forward/backward a random number of records, using something like: //untested code $count = mysql_num_rows($result); $ids = array(); while (count($ids) 50 count($ids) $count){ $random = mt_rand(0, $count - 1); mysql_data_seek($result, $random); $id = $result['id']; //Note use of $id as key, so duplicates are ignored. $ids[$id] = $id; } This will perform MISERABLY when your number of records is closer to 50. It would be okay only if all searches result in tons and tons of records. One does have to wonder: If the user has put in multiple search criteria, why order randomly? Why not put best matches first? -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Site Design Strategy
Here is what I use: The articles (non-technical user supplied content is stored in a database e.g. mySQL with a table named something like article_content). The table has columns such as CREATE TABLE article_content ( id int(11) NOT NULL auto_increment, page_name varchar(35) NOT NULL default '', side char(1) NOT NULL default '', position int(2) NOT NULL default '0', title varchar(35) NOT NULL default '', leader_length int(11) NOT NULL default '0', creation_time datetime NOT NULL default '-00-00 00:00:00', last_edit datetime NOT NULL default '-00-00 00:00:00', editor int(11) NOT NULL default '0', content longtext NOT NULL, PRIMARY KEY (id) ) TYPE=MyISAM; Each user is assigned a security level in a user database that grants them access (table name something like 'editors') Each article has an hidden (no decoration) editor's link at the end of the article. It could be the last word, the final punctuation, or a graphic. When you click the editor's link the user is challenged against the user name and password in the database and appropriate data stuffed into sessions. Once authentication is complete the article content is delivered for editing via a JavaScript CMS such as xinha or tinymce. Upon completion of editing, the content is stuffed back into the database. The template for all the website is as follows: require('/home/pathtofile/phplib/class.articles.php'); require('/home/pathtofile/pieces/header.txt'); require('/home/pathtofile/pieces/column1.txt'); require('/home/pathtofile/pieces/column2.txt'); get_article(L); require('/home/pathtofile/pieces/column3.txt'); get_article(R); require('/home/pathtofile/pieces/footer.txt'); The function get_article() pulls the content from the database for the referring page (e.g index.html) where the page_name matches the referrer and the side matches L or R. I use position to rank the articles on the page. A page with lower position (e.g. 1) gets displayed first and then any 2 articles, then 3, etc. I use the 0 as a 'non published' indicator which allows an editor to work on an article and then hide it until the right time or to repost a recurring article at certain times.. Works wonderfully well and elevates my perceived status to that of near genius! Here is a link to see it in action or at least to see the finished content. The entire web site is maintained by non-technical volunteers and they have populated hundreds of articles on dozen of pages. : http://www.southshorechurch.com/index.htl?php_gen If you need more info or functions to make this work, let me know. Hope this helps, Mark Cain . - Original Message - From: asinning [EMAIL PROTECTED] To: php-general@lists.php.net Sent: Thursday, June 02, 2005 9:56 PM Subject: [PHP] Site Design Strategy 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
Re: [PHP] htmlArea - a 'client editor'
htmlArea afaik only works on MSIE 5+. It doesn't work on Mozilla/Firefox/etc. On 6/3/05, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Ryan A: Do you mean htmlArea? http://www.dynarch.com/projects/htmlarea/ .. we used htmlArea in one of our projects and were quite happy with the simple user interface. It had a couple of bugs ... but maybe the newer release has squashed these? Check with the developer. Rob. http://www.globalissa.com _ Ryan A wrote: Hey guys (and girl...as we have one on the list...(that i know of)), snip 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 -- 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: what do you guys use for reporting?
To do Html reports, like for all dynamic Html pages, I use a Template Engine. The one I use is the one I develop and maintain. It's TinyButStrong, mature and works with WYSIWYG templates. Reports are easy with a Template Engine. --- Skrol29 www.tinybutstrong.com --- Angelo Zanetti [EMAIL PROTECTED] a écrit dans le message de news: [EMAIL PROTECTED] 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 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] need help with php/xml/template !!!
hi... i'm playing around with trying to get a better understanding of an app (www.sitellite.org) it uses templates, which appear to have php/xml/html and i'm trying to understand it a little better. is there someone i can talk to who has a few minutes that might be willing to walk me through this. i'm in the bay area of cali, if you're close i'd even do lunch!! if you're not, talking via phone would probably be enough to get me started! thanks -bruce [EMAIL PROTECTED] ps: sample code - !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN DTD/xhtml1-transitional.dtd xt:tpl version=1.0xt:doctype root=html access=public name=-//W3C//DTD XHTML 1.0 Transitional//EN uri=http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd; / html head title xt:content=php: intl_get ('SCM Example Site') . ' - ' . object.titleSCM Example Site - Page Name/title link rel=stylesheet type=text/css href=/inc/html/default/site.css xt:attributes=href string: ${site/prefix}/inc/html/default/site.css / /head bodya name=top /a table tr td id=banner colspan=3 img src=/inc/html/default/pix/logo.gif alt= border=0 xt:attributes=src string: ${site/prefix}/inc/html/default/pix/logo.gif / /td /tr tr xt:condition=php: object.id ne 'index' td id=breadcrumb colspan=3 valign=middle xt:box name=sitellite/nav/breadcrumb caption=You are hereYou are here: Home / Products / SuperDuper2000/xt:box /td /tr tr td id=leftcontent xt:box name=sitellite/sidebar position=left / /td td id=centercontent xt:box name=cms/buttons / h1 xt:content=title xt:condition=php: not empty (object.title)Page Title/h1 div id=toc xt:condition=php: not empty (object.toc) h2xt:intlTable of Contents/xt:intl/h2 ul xt:replace=toc lia href=#Fake inner link 1/a/li lia href=#Fake inner link 2/a/li /ul /div p xt:replace=body centercontent- /p p align=righta href=#top[ xt:intltop/xt:intl ]/a/p /td td id=rightcontent xt:box name=sitellite/sidebar position=right / /td /tr tr td id=footer colspan=3 table border=0 width=100% tr td xt:intlCopyright/xt:intl ch:copy / span xt:replace=php: date ('Y')2003/span Simian Systems Inc.br / xt:intlAll Rights Reserved./xt:intl /td td align=right a href=http://www.sitellite.org/; target=_blankxt:intlPowered by Sitellite CMS/xt:intl/a /td /tr /table /td /tr /table /body /html /xt:tpl -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Help with some OOP
Hello all, Ive been working with PHP for my websites for a few months, just attempted to build my own class, after reading all this stuff about automated robots and XSS attacks etc decided to step up security a bit, my result is an attempt to create a class for using the token method within web forms, not even sure whether its the real thing but my work is below, some advice on whether its ok or what needs improving would be appreciated, thanks. ?php // PHP 4.3.11 class SecretToken { var $_returnCode; function GenerateToken() { if(!isset($_SESSION['token'])) { session_regenerate_id(); $new_token = md5(uniqid(rand(), true)); $_SESSION['token'] = $new_token; } } function VerifyToken($post) { if(isset($_SESSION['token'])) { $saved_token = ($_SESSION['token']); } if($post == $saved_token): $this-_returnCode = 1; unset($_SESSION['token']); else: $this-_returnCode = 0; endif; } function ReturnCode() { ## Result will be 1 for success or 0 for fail return $this-_returnCode; } // end class definition } ? Basically in my web form I call GenerateToken firstly, then when the forms been submitted I then call VerifyToken and finally check return codes using a switch statement, seems to work, TIA James Benson -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] autocomplete a field
Hi, Anyone know if theres a way to disable this feature for user using old browsers or not suporting JS/XML? Thanks, pancarne.
[PHP] mozilla urlencode
I seem to have a problem with Mozilla or with IE? echo a name=\.urlencode($mydata-district).\/a; a name=Montr%E9al+District+%234/a http://foo.org/_private/directory.php#Montr%E9al+District+%234 works in IE6, but Mozilla will not accept it. Mozilla does not work. Am I approaching this wrong? Should I create my HTML this way? echo a name=\.$mydata-district.\/a; a name=Montréal District #4/a If I do, Mozilla prferes this: http://foo.org/_private/directory.php#Montr%E9al%20District%20#4 or http://foo.org/_private/directory.php#Montr%E9al%20District%20%234 IE refuses it and prefers: http://foo.org/_private/directory.php#Montr%E9al+District+%234 What's my work around? Complain to Mozilla? Same for Firefox BTW. I cannot change my field. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] mozilla urlencode
i dont think having a + in an achor tag is standard.. but i could be wrong. John Taylor-Johnston wrote: I seem to have a problem with Mozilla or with IE? echo a name=\.urlencode($mydata-district).\/a; a name=Montr%E9al+District+%234/a http://foo.org/_private/directory.php#Montr%E9al+District+%234 works in IE6, but Mozilla will not accept it. Mozilla does not work. Am I approaching this wrong? Should I create my HTML this way? echo a name=\.$mydata-district.\/a; a name=Montréal District #4/a If I do, Mozilla prferes this: http://foo.org/_private/directory.php#Montr%E9al%20District%20#4 or http://foo.org/_private/directory.php#Montr%E9al%20District%20%234 IE refuses it and prefers: http://foo.org/_private/directory.php#Montr%E9al+District+%234 What's my work around? Complain to Mozilla? Same for Firefox BTW. I cannot change my field. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php