Re: [PHP] import Excel file into PostgreSQL
Alain Roger wrote: HI, I would like to know the best and fastest way how to import some colums contents from Excel file to PostgreSQL database. how can i do that ? I mean some columns of Excel should be imported into a particular table and some others into another table. If it's a proper excel file, try something like: http://sourceforge.net/projects/phpexcelreader If it's a CSV file, try http://www.php.net/fgetcsv -- Postgresql & php tutorials http://www.designmagick.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] import Excel file into PostgreSQL
HI, I would like to know the best and fastest way how to import some colums contents from Excel file to PostgreSQL database. how can i do that ? I mean some columns of Excel should be imported into a particular table and some others into another table. thanks for any suggestion. -- Alain Windows XP SP2 PostgreSQL 8.1.4 Apache 2.2.4 PHP 5.2.1
Re: [PHP] Check for well formed html
At 5:14 PM +0200 8/5/07, Tijnema wrote: On 8/5/07, tedd <[EMAIL PROTECTED]> wrote: Hi gang: I have a client who wants to include html tags in his CMS. I know that I can limit what tags he can use, but how can I check if the text is well formed with the tags permitted before storing it in his CMS? Cheers, tedd Have a look at Example 1687 on the manual page for preg_match_all, I think you can use it with a little modification :) Tijnema Tijnema: Thanks, that was interesting. See: http://www.webbytedd.com/b/match-tags/ The code will find and pull out matched tags, but it produces odd results if it finds a malformed tag (i.e., b/> ). Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Thoughts about music library
Hi. On Monday 06 August 2007 23:13, Børge Holen wrote: > As mentioned earlier, I want to make stuff myself When I did this I used Music Player Daemon (MPD - http://musicpd.org/) and wrote my own web interface in php. It offers a nice simple but powerful API, and is *very* low on resource usage (no seperate database). I used it running from an old 200Mhz SBC board in a Playstation 2 case. I thought it made for a nice flexible system as there are clients to control the daemon available for all manner of hardware. Cheers, Mark -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How to implement a plugin system?
On 8/6/07, Stut <[EMAIL PROTECTED]> wrote: > > Hamza Saglam wrote: > > Thanks for your response. However I am looking for something a bit more > > comprehensive :) > > > > I could do it as you suggested if I had only a few plugins. As I am > going to > > add loads of plugins over the time, rather than adding all the plugins > one > > by one, could something like a 'loader' class be implemented? What I > mean by > > that is, it will take the requested plugin names (with their own > parameters > > necessary) and load/initialise them. > > > > In semi-psuedo-code, it would be something like: > > > > foreach plugin suplied as the argument > >include the plugin > >initialise it > > end > > > > Perhaps I should change the question to: "Do you think something like > this > > would be efficient and useable? If not what sort of pattern would you > > follow?" > > What you're describing is the Factory pattern, and yes that's the most > efficient way to implement plugins. You should never load classes unless > you need them - it's a complete waste of time, and definitely not > recommended if you're going to have a lot of plugins. > > I would suggest you name your plugins X_plugin, Y_plugin and Z_plugin > (where plugin could be anything) because that adds a level of security. > Otherwise you could open yourself up to security issues because the user > could instantiate any class in your system. > > -Stut > > -- > http://stut.net/ > > > "Borokov Smith" <[EMAIL PROTECTED]> wrote in message > > news:[EMAIL PROTECTED] > >> Hey Hamza, > >> > >> require_once($chosenPlugin . '.class.php'); > >> > >> $obj = new $chosenPlugin(); > >> return $obj; > >> > >> And you can start from there. > >> > >> hth, > >> > >> boro > >> > >> > >> > >> Hamza Saglam schreef: > >>> Hello all, > >>> > >>> I am working on a project which needs to have some sort of plugins > >>> architecture and I am kinda stuck. Basically I want to give a list of > >>> items to the user, and according to his/her selection, I want to load > >>> relevant functionality into my application. > >>> > >>> > >>> I was thinking of having an abstract plugin class, and have the > >>> plugins implement that but then how would I actually load the plugins? > >>> Say for instance I want to load plugins X,Y,Z (and lets say i > >>> implemented them as [X|Y|Z].class.php) , should I just 'include' (or > >>> require) them? Or should I initialize all possible plugins and just > >>> pick the ones user has chosen (which sounds a bit pointless as it > >>> would load unnecessary stuff)? > >>> > >>> > >>> How would you go about doing something like this? > >>> > >>> > >>> Thanks. > >>> > >>> > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > allow me to elaborate. you want to aim for composition as a flexible alternative to sub-classing to extend behavior. Namely what you want is the Strategy pattern. Strategy allows you to compose objects at run time dynamically, thereby changing behavior in your system on-the-fly. The components are made similar by a common interface, which can be either the PHP *interface* or the PHP *abstract class*. these components each encapsulate a different algorithm or module as you would call it. and the interface makes the system simple to extend. to create a new module you simply implement the interface and it is interchangeable with the other modules in the system. the factory method pattern is sort of complex. it is used to encapsulate object creation. it is typically used to instantiate objects in a *family* *of products* which is defined by a common interface, ie the strategy pattern. the factory method is used to create products in a standard way. factory method pattern goes further, in typical implementations, by using template method in a parent class. this controls the boundaries of the modules in the system. the template method invokes the a factory method on a subclass to get a concrete object. it then operates on the the concrete object in a predefined sequence. the abstract base class can define different types of methods. the base class may specify methods that must be implemented by concrete subclasses. it can also expose hook methods, with a default implementation. these methods can be optionally implemented in the subclasses. after invoking the factory method to get a concrete object the factorys template method will invoke the remaining methods, mandatory, hook or otherwise on the newly created concrete object in a predefined sequence before handing the new object to the client code that called it. http://www.phppatterns.com/docs/design/strategy_pattern http://www.phppatterns.com/docs/design/the_factory_method -nathan
Re: [PHP] Can anyone point me toward some useful resources?
greg, how is your application written? is it fairly modular? you could build an n-tier system by assigning different components of the application to different pieces of hardware. then you could have the components communicate via a local high speed network. soap would be a good protocol for the communication. http://www.phppatterns.com/docs/design/a_quick_intro_to_ntier?s=tier caching is a common performance tool as well. this is a different approach though, but can be used in tandem w/ the n-tier concept. -nathan On 8/6/07, greg patmore <[EMAIL PROTECTED]> wrote: > > Hi all, > > > > I was wondering if anyone could point me toward some good resources > regarding suggestions on handling user preferences over a cluster in a > heavy traffic website. > > > > Online resources are preferable:-), but thanks for any help you could > give. > > > > Regards, > > Greg > > > >
[PHP] mail problem - deadline!!!!! - SOLVED
Good evening list, Solved the problem myself :-) i changed the mail function instead of $youremail = '[EMAIL PROTECTED]', i used $to = "" and changed the mail fuction from: @mail($contato_email,$subjectline,$body, "From: $contato_email"); into @mail($to,$subjectline,$body, "From: $contato_email"); -- Best regards, Luc Powered by The Bat! version 3.99.3 with Windows XP (build 2600), version 5.1 Service Pack 2 and using the best browser: Opera. "From St Paul's second letter to the Corithians: 'Dear Corinthians, you could have at least replied to the first ...'" - Giobbe Covatta - Italian writer -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Thoughts about music library
On Monday 06 August 2007 23:57, Jay Blanchard wrote: > [snip] > I'm building an web interface for my music collection. > [/snip] > > Have you seen Ampache - http://www.ampache.org/ as a matter of fact... yes. From my point of view, it seems defect... the only thing it misses is the ballroom and beer, They could atleast supply a bartender and/or random play function/DJ. dunno. I don't need neither mysql overhead, voting, transcoding and LEAST of all a flashplayer. God forbid, the linux ppc port don't play nice with flash. Last I checked ice downsampled by itself if asked to, so I really don't understand why these ppl are using it for proclaiming their product. Don't know how it stored all the tag data, but i rather use inotify within the kernel to update a serialized cache file than using fullblown sql here. seems much more appropriate, since I rather use ssh to update/upload/rename and move files withing my collection. At least I would like to have the option. Of course I could connect a daemon to the mysql queries to update... I just didn't. As mentioned earlier, I want to make stuff myself, it seems so much cooler but thanks for the tip =D -- --- Børge http://www.arivene.net --- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Thoughts about music library
[snip] I'm building an web interface for my music collection. [/snip] Have you seen Ampache - http://www.ampache.org/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Thoughts about music library
On Monday 06 August 2007 23:39, Colin Guthrie wrote: > Børge Holen wrote: > > I'm building an web interface for my music collection. > > I'd have a quick look at mp3act. It does pretty much what you want I think. yes, but where is the fun in that? ;D and if something irritate me, it simple to fix it when I built it > > Also you may like Jinzora. > > There are probably others out there too. > > HTH > > Col. -- --- Børge http://www.arivene.net --- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Thoughts about music library
Børge Holen wrote: > I'm building an web interface for my music collection. I'd have a quick look at mp3act. It does pretty much what you want I think. Also you may like Jinzora. There are probably others out there too. HTH Col. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Thoughts about music library
I'm building an web interface for my music collection. What I would like is some opinions on what to choose pro/cons: The first choice I took was to stream music directly to a player, i.e. I construct and export an m3u with php and open that with any player. This gives me an external playlist independent of browser screen. The loosing choice was to use icecast to stream. Here I can construct an online playlist witch shows whats up next, what was the last song, and skip back/forth... so on. This would mainly be for programmin excersice, any takers on pros? The next thing would be the playlists, I would like an option to save them for further use. My playlist so far is either that I enter a directory and press play. This would put all the files in this directory (not recursive) into a playlist and export, or I press one single file and a m3u gets exported. I can easily save this file as the... well... last playlists sorted after date or whatever, but how would I go on if I wanted to add songs. Here I was thinking about making a button behind each song or directory and have a js sort of table to one end of the screen witch add,update or gives me the choice to delete a song/album... This seems like a screenfilling option of sorts, anyone else with a less extensive, prettier or just a better solution? -- --- Børge http://www.arivene.net --- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Saving
Aww fuck! I clicked the wrong newsgroup. Sorry about that guys. "Stut" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] Dan wrote: Has anyone had to save the insance of a class which had a properties which were pointers? I have a really simple class. Just a few functions and a couple properties & variables. But now I need to be able to save the class to a file. Of course when you re-open the file the pointers will be useless. I was thinking and the only way I came up with storing this to file would be to get the Name of the TTabSheets and the Text of the Node. That way when I read it back in I just have to search for those names in the PageControl and Tree by looping through and set those. Although this would probably work it's probably not the best way to do it right? TPage = class private pge: TTabSheet; par: TTabSheet; txt: String; show: Boolean; node: TTreeNode; function GetTab: TTabSheet; procedure SetTab(Tab: TTabSheet); function GetText: String; procedure SetText(text: String); public Constructor Create; overload; Constructor Create(pg: TTabSheet; text: String; pare: TTabSheet = nil; showProp: boolean = true); overload; property page: TTabSheet read GetTab write SetTab; property text: String read GetText write SetText; end; That looks a lot like Delphi not PHP. I'm assuming that means you're using that freaky Delphi for PHP thing in which case you'll have better luck on their mailing list(s). -Stut -- http://stut.net/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: How to implement a plugin system?
I think I have a rough understanding of the whole process so I should start coding :) Many thanks to everyone for your suggestions. Regards, Hamza. ""Hamza Saglam"" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hello all, > > I am working on a project which needs to have some sort of plugins > architecture and I am kinda stuck. Basically I want to give a list of > items to the user, and according to his/her selection, I want to load > relevant functionality into my application. > > > I was thinking of having an abstract plugin class, and have the > plugins implement that but then how would I actually load the plugins? > Say for instance I want to load plugins X,Y,Z (and lets say i > implemented them as [X|Y|Z].class.php) , should I just 'include' (or > require) them? Or should I initialize all possible plugins and just > pick the ones user has chosen (which sounds a bit pointless as it > would load unnecessary stuff)? > > > How would you go about doing something like this? > > > Thanks. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How to implement a plugin system?
You might want to take a look at stickleback: http://sourceforge.net/projects/stickleback Documentation is very thin on the ground right now, but there's a presentation here: http://www.appulsus.com/resources/stickpres200706/img0.html mz On Mon, 6 Aug 2007, Hamza Saglam wrote: Hello Boro, Thanks for your response. However I am looking for something a bit more comprehensive :) I could do it as you suggested if I had only a few plugins. As I am going to add loads of plugins over the time, rather than adding all the plugins one by one, could something like a 'loader' class be implemented? What I mean by that is, it will take the requested plugin names (with their own parameters necessary) and load/initialise them. In semi-psuedo-code, it would be something like: foreach plugin suplied as the argument include the plugin initialise it end Perhaps I should change the question to: "Do you think something like this would be efficient and useable? If not what sort of pattern would you follow?" Warm regards, Hamza. "Borokov Smith" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] Hey Hamza, require_once($chosenPlugin . '.class.php'); $obj = new $chosenPlugin(); return $obj; And you can start from there. hth, boro Hamza Saglam schreef: Hello all, I am working on a project which needs to have some sort of plugins architecture and I am kinda stuck. Basically I want to give a list of items to the user, and according to his/her selection, I want to load relevant functionality into my application. I was thinking of having an abstract plugin class, and have the plugins implement that but then how would I actually load the plugins? Say for instance I want to load plugins X,Y,Z (and lets say i implemented them as [X|Y|Z].class.php) , should I just 'include' (or require) them? Or should I initialize all possible plugins and just pick the ones user has chosen (which sounds a bit pointless as it would load unnecessary stuff)? How would you go about doing something like this? Thanks. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- getInstance() http://www.getinstance.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How to implement a plugin system?
Hamza Saglam wrote: Thanks for your response. However I am looking for something a bit more comprehensive :) I could do it as you suggested if I had only a few plugins. As I am going to add loads of plugins over the time, rather than adding all the plugins one by one, could something like a 'loader' class be implemented? What I mean by that is, it will take the requested plugin names (with their own parameters necessary) and load/initialise them. In semi-psuedo-code, it would be something like: foreach plugin suplied as the argument include the plugin initialise it end Perhaps I should change the question to: "Do you think something like this would be efficient and useable? If not what sort of pattern would you follow?" What you're describing is the Factory pattern, and yes that's the most efficient way to implement plugins. You should never load classes unless you need them - it's a complete waste of time, and definitely not recommended if you're going to have a lot of plugins. I would suggest you name your plugins X_plugin, Y_plugin and Z_plugin (where plugin could be anything) because that adds a level of security. Otherwise you could open yourself up to security issues because the user could instantiate any class in your system. -Stut -- http://stut.net/ "Borokov Smith" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] Hey Hamza, require_once($chosenPlugin . '.class.php'); $obj = new $chosenPlugin(); return $obj; And you can start from there. hth, boro Hamza Saglam schreef: Hello all, I am working on a project which needs to have some sort of plugins architecture and I am kinda stuck. Basically I want to give a list of items to the user, and according to his/her selection, I want to load relevant functionality into my application. I was thinking of having an abstract plugin class, and have the plugins implement that but then how would I actually load the plugins? Say for instance I want to load plugins X,Y,Z (and lets say i implemented them as [X|Y|Z].class.php) , should I just 'include' (or require) them? Or should I initialize all possible plugins and just pick the ones user has chosen (which sounds a bit pointless as it would load unnecessary stuff)? How would you go about doing something like this? Thanks. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Which Chat system to use
Hi zerof, Thanks for the reply. Unfortunately the chat you've suggested does not have one basic need that is private chats (via separate channels). This way a user chatting in the room will be able to send direct messages with others. Any other tips? On 8/4/07, zerof <[EMAIL PROTECTED]> wrote: > robert mena escreveu: > > Hi, > > > > I need to add a simple chat system to my site and I am trying to find out > > good solutions, free or paid. Some of the requirements : > > - php :) > > - uses some sort of template system (smarty better) > > - support for private chats > > - source code available > > - one chat room (except for private chats everybody sees everything) > > > > So far the chat systems I've found are too complex (need to register the > > nick before entering the chat, confusing interface), not stable enough ( > > http://www.phpfreechat.net/) or integrated with other systems. > > > > There is no need for : > > - multiple chat rooms > > - operator/ban > > - registration of the nickname > > - archive of previous chats > > > > thanks. > > > -- > http://socket7.net/lace/ > > -- > zerof > http://www.educar.pro.br/ > Apache - PHP - MySQL - Boolean Logics - Project Management > -- > You must hear, always, one second opinion! In all cases. > -- > Let the people know if this info was useful for you! > -- > > -- > 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] How to implement a plugin system?
Hello Boro, Thanks for your response. However I am looking for something a bit more comprehensive :) I could do it as you suggested if I had only a few plugins. As I am going to add loads of plugins over the time, rather than adding all the plugins one by one, could something like a 'loader' class be implemented? What I mean by that is, it will take the requested plugin names (with their own parameters necessary) and load/initialise them. In semi-psuedo-code, it would be something like: foreach plugin suplied as the argument include the plugin initialise it end Perhaps I should change the question to: "Do you think something like this would be efficient and useable? If not what sort of pattern would you follow?" Warm regards, Hamza. "Borokov Smith" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hey Hamza, > > require_once($chosenPlugin . '.class.php'); > > $obj = new $chosenPlugin(); > return $obj; > > And you can start from there. > > hth, > > boro > > > > Hamza Saglam schreef: >> Hello all, >> >> I am working on a project which needs to have some sort of plugins >> architecture and I am kinda stuck. Basically I want to give a list of >> items to the user, and according to his/her selection, I want to load >> relevant functionality into my application. >> >> >> I was thinking of having an abstract plugin class, and have the >> plugins implement that but then how would I actually load the plugins? >> Say for instance I want to load plugins X,Y,Z (and lets say i >> implemented them as [X|Y|Z].class.php) , should I just 'include' (or >> require) them? Or should I initialize all possible plugins and just >> pick the ones user has chosen (which sounds a bit pointless as it >> would load unnecessary stuff)? >> >> >> How would you go about doing something like this? >> >> >> Thanks. >> >> -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How to implement a plugin system?
Hey Hamza, require_once($chosenPlugin . '.class.php'); $obj = new $chosenPlugin(); return $obj; And you can start from there. hth, boro Hamza Saglam schreef: Hello all, I am working on a project which needs to have some sort of plugins architecture and I am kinda stuck. Basically I want to give a list of items to the user, and according to his/her selection, I want to load relevant functionality into my application. I was thinking of having an abstract plugin class, and have the plugins implement that but then how would I actually load the plugins? Say for instance I want to load plugins X,Y,Z (and lets say i implemented them as [X|Y|Z].class.php) , should I just 'include' (or require) them? Or should I initialize all possible plugins and just pick the ones user has chosen (which sounds a bit pointless as it would load unnecessary stuff)? How would you go about doing something like this? Thanks. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Saving
Dan wrote: Has anyone had to save the insance of a class which had a properties which were pointers? I have a really simple class. Just a few functions and a couple properties & variables. But now I need to be able to save the class to a file. Of course when you re-open the file the pointers will be useless. I was thinking and the only way I came up with storing this to file would be to get the Name of the TTabSheets and the Text of the Node. That way when I read it back in I just have to search for those names in the PageControl and Tree by looping through and set those. Although this would probably work it's probably not the best way to do it right? TPage = class private pge: TTabSheet; par: TTabSheet; txt: String; show: Boolean; node: TTreeNode; function GetTab: TTabSheet; procedure SetTab(Tab: TTabSheet); function GetText: String; procedure SetText(text: String); public Constructor Create; overload; Constructor Create(pg: TTabSheet; text: String; pare: TTabSheet = nil; showProp: boolean = true); overload; property page: TTabSheet read GetTab write SetTab; property text: String read GetText write SetText; end; That looks a lot like Delphi not PHP. I'm assuming that means you're using that freaky Delphi for PHP thing in which case you'll have better luck on their mailing list(s). -Stut -- http://stut.net/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] How to implement a plugin system?
Hello all, I am working on a project which needs to have some sort of plugins architecture and I am kinda stuck. Basically I want to give a list of items to the user, and according to his/her selection, I want to load relevant functionality into my application. I was thinking of having an abstract plugin class, and have the plugins implement that but then how would I actually load the plugins? Say for instance I want to load plugins X,Y,Z (and lets say i implemented them as [X|Y|Z].class.php) , should I just 'include' (or require) them? Or should I initialize all possible plugins and just pick the ones user has chosen (which sounds a bit pointless as it would load unnecessary stuff)? How would you go about doing something like this? Thanks. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Saving
Has anyone had to save the insance of a class which had a properties which were pointers? I have a really simple class. Just a few functions and a couple properties & variables. But now I need to be able to save the class to a file. Of course when you re-open the file the pointers will be useless. I was thinking and the only way I came up with storing this to file would be to get the Name of the TTabSheets and the Text of the Node. That way when I read it back in I just have to search for those names in the PageControl and Tree by looping through and set those. Although this would probably work it's probably not the best way to do it right? TPage = class private pge: TTabSheet; par: TTabSheet; txt: String; show: Boolean; node: TTreeNode; function GetTab: TTabSheet; procedure SetTab(Tab: TTabSheet); function GetText: String; procedure SetText(text: String); public Constructor Create; overload; Constructor Create(pg: TTabSheet; text: String; pare: TTabSheet = nil; showProp: boolean = true); overload; property page: TTabSheet read GetTab write SetTab; property text: String read GetText write SetText; end; -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] compose html body with variables
Edward Kay wrote: -Original Message- From: Matt [mailto:[EMAIL PROTECTED] Sent: 06 August 2007 15:38 To: php-general@lists.php.net Subject: [PHP] compose html body with variables Hello, I'm trying to compose the body of an html email to use with the mail() function. I'm running into problem because I'm not sure how to quote the multi-line body. Here is what I have: $body = " echo "Hello, here is your quote from Freight Services."; echo "Shipping from: $origin to $destination"; echo ""; echo "Shipping subtotal $" . number_format($subtotal,2); echo ""; echo ""; echo "Freight charges $" . number_format($freightCharges,2); echo ""; echo "Fuel surcharge $" . number_format($fuelSurcharge,2); echo ""; echo "Pickup and delivery $" . number_format($pickupDelivery,2); echo ""; echo ""; echo "Miscellaneus costs (e.g. liftgates, etc.) below $" . number_format($miscCost,2); echo ""; echo ""; if ($liftgatePickup == "50"){ echo "Adding liftgate on pickup $50.00"; echo ""; } if ($liftgateDelivery == "50"){ echo "Adding liftgate on delivery $50.00"; echo ""; } if ($spectimeDelivery == "35"){ echo "Adding cost of specific-time delivery $35.00"; echo ""; } if ($conventionDelivery == "35"){ echo "Adding cost of convention delivery $35.00"; echo ""; } if ($dreyageWait != 0){ echo "Adding cost for wait $" . $dreyageWait; echo ""; } if ($insideDelivery == "25"){ echo "Adding cost for inside delivery $25.00"; echo ""; } if ($notifyClient == "10"){ echo "Adding cost for client notification $10.00"; echo ""; } echo "Total cost is $" . number_format($totalcost,2); echo ""; echo "foo Services"; $subject = "Online Freight Quote"; mail($email, $subject, $body, "From: [EMAIL PROTECTED]: [EMAIL PROTECTED]: [EMAIL PROTECTED]: PHP 4.x\r\nMIME-Version: 1.0\r\nContent-Type: text/html; charset=iso-8859-1\r\n"); If anyone could assist me I'd appreciate it very much, Matt Hi Matt, The problem here is that you're using echo statements, which output directly. Instead you need to build a string containing this output, for example: $body = "Hello, here is your quote from Freight Services."; $body .= "Shipping from: $origin to $destination"; etc. Note the use of the .= operator. This is the same as saying $body = $body.'whatever'; At the end, $body will then contain the HTML body of your email which you pass to the mail function. Hope this helps, Edward Very good! Thank you so much Edward. That worked perfectly. Matt -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Can anyone point me toward some useful resources?
Hi all, I was wondering if anyone could point me toward some good resources regarding suggestions on handling user preferences over a cluster in a heavy traffic website. Online resources are preferable:-), but thanks for any help you could give. Regards, Greg
RE: [PHP] compose html body with variables
> -Original Message- > From: Matt [mailto:[EMAIL PROTECTED] > Sent: 06 August 2007 15:38 > To: php-general@lists.php.net > Subject: [PHP] compose html body with variables > > > Hello, > > I'm trying to compose the body of an html email to use with the mail() > function. I'm running into problem because I'm not sure how to quote > the multi-line body. Here is what I have: > > $body = " >echo "Hello, here is your quote from Freight Services. />"; >echo "Shipping from: $origin to $destination"; > echo ""; > echo "Shipping subtotal $" . number_format($subtotal,2); > echo ""; > echo ""; > echo "Freight charges $" . > number_format($freightCharges,2); > echo ""; > echo "Fuel surcharge $" . number_format($fuelSurcharge,2); > echo ""; > echo "Pickup and delivery $" . > number_format($pickupDelivery,2); > echo ""; > echo ""; > echo "Miscellaneus costs (e.g. liftgates, etc.) below $" > . number_format($miscCost,2); > echo ""; > echo ""; > if ($liftgatePickup == "50"){ > echo "Adding liftgate on pickup $50.00"; > echo ""; > } > if ($liftgateDelivery == "50"){ > echo "Adding liftgate on delivery $50.00"; > echo ""; > } > if ($spectimeDelivery == "35"){ > echo "Adding cost of specific-time > delivery $35.00"; > echo ""; > } > if ($conventionDelivery == "35"){ > echo "Adding cost of convention delivery $35.00"; > echo ""; > } > if ($dreyageWait != 0){ > echo "Adding cost for wait $" . $dreyageWait; > echo ""; > } > if ($insideDelivery == "25"){ > echo "Adding cost for inside delivery $25.00"; > echo ""; > } > if ($notifyClient == "10"){ > echo "Adding cost for client notification $10.00"; > echo ""; > } > echo "Total cost is $" . number_format($totalcost,2); > echo ""; > > echo "foo Services"; > > >$subject = "Online Freight Quote"; > >mail($email, $subject, $body, "From: > [EMAIL PROTECTED]: [EMAIL PROTECTED]: > [EMAIL PROTECTED]: PHP 4.x\r\nMIME-Version: 1.0\r\nContent-Type: > text/html; charset=iso-8859-1\r\n"); > > If anyone could assist me I'd appreciate it very much, > > Matt > Hi Matt, The problem here is that you're using echo statements, which output directly. Instead you need to build a string containing this output, for example: $body = "Hello, here is your quote from Freight Services."; $body .= "Shipping from: $origin to $destination"; etc. Note the use of the .= operator. This is the same as saying $body = $body.'whatever'; At the end, $body will then contain the HTML body of your email which you pass to the mail function. Hope this helps, Edward -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Check if var has a date (timestamp or regular)
OOzy Pal wrote: How can I check an inputed date if it is a valid date and if it is in the form of a timestamp or regular date such as (22-07-2007 or 22/07/2007) You could first check if the variable consists only of numbers. If so, it's likely a timestamp. If $var does consist of something other than digits, pass it to strtotime() first. $arr_date = ( ctype_digit($var) ? getDate($var) : getDate(strtotime($var)) ); Finally, check that the date is legitimate: if (checkdate($arr_date['mon'], $arr_date['mday'], $arr_date['year'])) { ... } brian -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Error Handling question
debussy007 wrote: Hi, I am new to PHP and need some help for error handling. I read in the docs that i can handle the errors this way in my PhP: set_error_handler('errorHandler'); function errorHandler($errnum,$errmsg,$file,$lineno){ [...] } But does that mean that I have to copy paste this code in all my Php pages or is there a better way ? You could use auto_prepend_file: http://www.php.net/manual/en/ini.core.php#ini.auto-prepend-file brian -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] compose html body with variables
Hello, I'm trying to compose the body of an html email to use with the mail() function. I'm running into problem because I'm not sure how to quote the multi-line body. Here is what I have: $body = " echo "Hello, here is your quote from Freight Services./>"; echo "Shipping from: $origin to $destination"; echo ""; echo "Shipping subtotal $" . number_format($subtotal,2); echo ""; echo ""; echo "Freight charges $" . number_format($freightCharges,2); echo ""; echo "Fuel surcharge $" . number_format($fuelSurcharge,2); echo ""; echo "Pickup and delivery $" . number_format($pickupDelivery,2); echo ""; echo ""; echo "Miscellaneus costs (e.g. liftgates, etc.) below $" . number_format($miscCost,2); echo ""; echo ""; if ($liftgatePickup == "50"){ echo "Adding liftgate on pickup $50.00"; echo ""; } if ($liftgateDelivery == "50"){ echo "Adding liftgate on delivery $50.00"; echo ""; } if ($spectimeDelivery == "35"){ echo "Adding cost of specific-time delivery $35.00"; echo ""; } if ($conventionDelivery == "35"){ echo "Adding cost of convention delivery $35.00"; echo ""; } if ($dreyageWait != 0){ echo "Adding cost for wait $" . $dreyageWait; echo ""; } if ($insideDelivery == "25"){ echo "Adding cost for inside delivery $25.00"; echo ""; } if ($notifyClient == "10"){ echo "Adding cost for client notification $10.00"; echo ""; } echo "Total cost is $" . number_format($totalcost,2); echo ""; echo "foo Services"; $subject = "Online Freight Quote"; mail($email, $subject, $body, "From: [EMAIL PROTECTED]: [EMAIL PROTECTED]: [EMAIL PROTECTED]: PHP 4.x\r\nMIME-Version: 1.0\r\nContent-Type: text/html; charset=iso-8859-1\r\n"); If anyone could assist me I'd appreciate it very much, Matt -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Check if var has a date (timestamp or regular)
How can I check an inputed date if it is a valid date and if it is in the form of a timestamp or regular date such as (22-07-2007 or 22/07/2007) -- OOzy Ubuntu-Feisty -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] passthru
Why don't you just use the man2html script? 2007. 08. 6, hétfő keltezéssel 05.14-kor Payne ezt írta: > Hi, > > Does anyone know way to passthru man pages so they don't show the ascii > formating? > > Payne >
Re: [PHP] Re: passthru
Does anyone know way to passthru man pages so they don't show the ascii formating? You could: 1) Replace all newlines (ASCII 10) with a tag. htmlspecialchars() will do this for you. Does it? I thought it only replaced entities. \n is not a "special char" in html lingo in that you can include them happily in a document and it is still syntactically correct! I believe you want the nl2br() function instead here. Ah yes. My bad. -- Richard Heyes +44 (0)844 801 1072 http://www.websupportsolutions.co.uk Knowledge Base and HelpDesk software that can cut the cost of online support -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Error Handling question
Hi, I am new to PHP and need some help for error handling. I read in the docs that i can handle the errors this way in my PhP: set_error_handler('errorHandler'); function errorHandler($errnum,$errmsg,$file,$lineno){ [...] } But does that mean that I have to copy paste this code in all my Php pages or is there a better way ? Thank you. -- View this message in context: http://www.nabble.com/Error-Handling-question-tf4223141.html#a12013437 Sent from the PHP - General mailing list archive at Nabble.com. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: passthru
Richard Heyes wrote: >> Does anyone know way to passthru man pages so they don't show the >> ascii formating? > > You could: > > 1) Replace all newlines (ASCII 10) with a tag. htmlspecialchars() >will do this for you. Does it? I thought it only replaced entities. \n is not a "special char" in html lingo in that you can include them happily in a document and it is still syntactically correct! I believe you want the nl2br() function instead here. > 2) Use a tag within which newlines are preserved > 3) Use preg_replace to replace non-printable characters (Can't remember >how exactly, but everything you need is in the manual - you will want >to strip everything from ASCII 1 - ASCII 32. IIRC. > I think it would be more to do with the special characters for making things bold and overwriting etc. rather than new lines specifically but I think you're 3rd point should work (without thinking about it too much :)) Col -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] passthru
Richard Heyes wrote: Does anyone know way to passthru man pages so they don't show the ascii formating? You could: 1) Replace all newlines (ASCII 10) with a tag. htmlspecialchars() will do this for you. 2) Use a tag within which newlines are preserved 3) Use preg_replace to replace non-printable characters (Can't remember how exactly, but everything you need is in the manual - you will want to strip everything from ASCII 1 - ASCII 32. IIRC. Thanks, I will give that a shot. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] passthru
Does anyone know way to passthru man pages so they don't show the ascii formating? You could: 1) Replace all newlines (ASCII 10) with a tag. htmlspecialchars() will do this for you. 2) Use a tag within which newlines are preserved 3) Use preg_replace to replace non-printable characters (Can't remember how exactly, but everything you need is in the manual - you will want to strip everything from ASCII 1 - ASCII 32. IIRC. -- Richard Heyes +44 (0)844 801 1072 http://www.websupportsolutions.co.uk Knowledge Base and HelpDesk software that can cut the cost of online support -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Adding to time having a timestamp
How can I add a day to a date if I have a timestamp. Here is my line: list($d,$m,$y,$dayname,$monthname,$am)=explode(' ',date('d m Y D M a', $timestamp)); Simply add 86400 (number of seconds in a day). -- Richard Heyes +44 (0)844 801 1072 http://www.websupportsolutions.co.uk Knowledge Base and HelpDesk software that can cut the cost of online support -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] passthru
Hi, Does anyone know way to passthru man pages so they don't show the ascii formating? Payne -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] About MySQL Tables
> -Original Message- > From: Kelvin Park [mailto:[EMAIL PROTECTED] > > I have two tables that share product codes to relate data. > One table is called IMAGE, and another one is called the PRODUCT. > There are more than one image for every product, for example product > code 1122 will have 3 images and 4938 will have 5 images within the > IMAGE table. Since all my product information is stored in PRODUCT table > except for the image file names (e.g. 1122_1.jpg, 1122_2.jpg or > 4938_1.gif), I have to build the following query: SELECT * FROM PRODUCT, > IMAGE WHERE PRODUCT.productcode = IMAGE.productcode. However, this > causes a little problem. When I print out all the product information > with its images, more than one copy of a product is printed out (because > of multiple images for each product). I'm still looking for a way to > build a query string so that I could have only one image displayed per > product (so that a user can click on the product to view more images). > You could use a Group By to limit each PRODUCT SELECT * from PRODUCT, IMAGE where PRODUCT.productcode = IMAGE.produtcode group by PRODUCT.productcode You could do it via 2 selects (ie, the first query simply lists all items in PRODUCT, then within this loop, a second query lists all entries in IMAGES which have the productcode, with a "limit 1" in the query. Personally, I'd go with the Group By option, and be clever with your ORDER so the correct image gets selected. Regards Chris Aitken The Web Hub Designer and Programmer Phone : 02 4648 0808 Mobile : 0411 132 075 - Making The Web Work The Web Hub http://www.thewebhub.com.au/ [EMAIL PROTECTED] - Confidentiality Statement: This message is intended only for the use of the Addressee and may contain information that is PRIVILEDGED and CONFIDENTIAL. If you are not the intended recipient, dissemination of this communication is prohibited. If you have received this communication in error, please erase all copies of the message and its attachments and notify us immediately -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php