RE: [PHP] Re: PHP Application Structre
-Original Message- From: richard gray [mailto:r...@richgray.com] Sent: 10 May 2010 07:05 PM Subject: Re: [PHP] Re: PHP Application Structre On 10/05/2010 18:17, Ashley Sheridan wrote: > It makes sense sometimes to have different files for different > sections of a website. For example, blog.php, gallery.php, cart.php > could deal with the blog, gallery and shopping cart sections for an > artists website. Yes, it could all be achieved with one script > handling everything, but sometimes when the areas of the site differ > greatly, it results in a lot of extra code to deal with pulling in the > right template and content parts. I've always favoured only including > the code a page needs rather than a huge amount of stuff that it doesn't. > this isn't necessarily true - the architecture I've developed uses a single dispatch script (works fine with the mod rewrite option 2 scenario as well) - this script does general checks/security/filters etc then simply determines what page/function the user wants from the request ($_GET/$_POST parameter) and passes control to the specific handler via including the relevant controller module. The controller module is responsible for which template is required and loads up specific classes needed to process the request etc so each module just loads its own stuff and nothing else so there's no overhead. This method also has a small extra benefit that the web server document root just has a very simple 2 liner script instead a myriad of php scripts... if the webserver is misconfigured then someone who sees the source code doesn't get to see much.. Just my 0.02 Euros Cheers Rich -- This is the design I also use. My single entry point (or dispatch script) is only 12 lines of code and never changes, even though the application is constantly updated and expanded. It doesn't load 100's of KB, instead relies on the next (module) layer to load its own requirements. But it does ensure the environment is correct, input checked, db connected, core api's loaded. It's really six of one and half-a-dozen of the other because all designs end up at more or less the same point, but for me this was the most efficient, flexible and expandable design after trying several approaches. Even major design changes like registering modules and scripts and adding mod-rewrite can be done without needing to change the entry script. If another completely unrelated app is ever added I'll just call it's script as Ashley described. The design allows for some interesting options, like a single installed app running multiple domains. We use cents and they're worthless... Cheers Arno -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: PHP Application Structre
On Mon, May 10, 2010 at 9:19 PM, David McGlone wrote: > On Monday 10 May 2010 22:15:44 Paul M Foster wrote: > > On Mon, May 10, 2010 at 06:09:00PM -0400, David McGlone wrote: > > > On Monday 10 May 2010 13:04:36 richard gray wrote: > > > > On 10/05/2010 18:17, Ashley Sheridan wrote: > > > > > It makes sense sometimes to have different files for different > > > > > sections of a website. For example, blog.php, gallery.php, cart.php > > > > > could deal with the blog, gallery and shopping cart sections for an > > > > > artists website. Yes, it could all be achieved with one script > > > > > handling everything, but sometimes when the areas of the site > differ > > > > > greatly, it results in a lot of extra code to deal with pulling in > > > > > the right template and content parts. I've always favoured only > > > > > including the code a page needs rather than a huge amount of stuff > > > > > that it doesn't. > > > > > > > > this isn't necessarily true - the architecture I've developed uses a > > > > single dispatch script (works fine with the mod rewrite option 2 > > > > scenario as well) - this script does general checks/security/filters > > > > etc then simply determines what page/function the user wants from the > > > > request ($_GET/$_POST parameter) and passes control to the specific > > > > handler via including the relevant controller module. The controller > > > > module is responsible for which template is required and loads up > > > > specific classes needed to process the request etc so each module > just > > > > loads its own stuff and nothing else so there's no overhead. > > > > > > > > This method also has a small extra benefit that the web server > document > > > > root just has a very simple 2 liner script instead a myriad of php > > > > scripts... if the webserver is misconfigured then someone who sees > the > > > > source code doesn't get to see much.. > > > > > > This thread makes me wonder if using Smarty is smart. Does anyone here > > > use a templeting system such as smarty or am I the only one? > > > > Lots of people use templating systems and particularly Smarty. Here's > > the difference between a templating system and just hand-coding: > > > > Hand coding-- > > > > > > > > Templating system: > > > > > > > > (Okay, I'm not familiar with Smarty syntax, but in essence template > > systems allow you to type less when you want PHP values to show up on > > the page.) > > > > Advantage: It *may* be easier for non-programmers to "read" the page > > with templating systems. I'm not sure this is really true. They're still > > liable to say, "What the heck is {flavor}?" Besides, my inclination is > > to tell designers to make everything look pretty, turn the resulting > > HTML over the the coders, who will then mark it up for PHP. After that, > > the designers can stay away from it. > > > > Disadvantage: You're adding another layer (and a LOT of code) just to > > save yourself some typing. With straight PHP, the server reads the code, > > interprets the PHP, substitutes values and shoves the page down to the > > browser. With a templating system, the system must load and call the > > templating engine, which must then substitute the proper values, and > > then output the built page to the browser. > > I don't know how everyone else does things, but I get a feeling of being > very > well organized when using smarty. > > I have to say that by using smarty, it has also helped me understand PHP > more > in depth. Maybe it's because of the strict organization, or maybe it's > because > I've been practicing a whole lot more. dunno. if theres one thing i tend to stay away from, or start deleting the second i inherit a new codebase, its smarty. ive never seen anything more bloated & ridiculous. hey, lets all learn *another* set of conventions & syntax on top of what we've already learned, drop *another* url in our bookmarks and slow down the entire universe in the process... imo smarty and most any 'template engine' on top of php can be summarized in one line of code: include($someScript); // :P i did gander at robs template system in interjinn once, but never got my head wrapped round it; honestly i only gave it a day or so. i prefer to go the typical route as per above, and omit the bloat that systems like smarty, savant etc bring to the table. nothing personal david, just an anti-smarty rant :) -nathan
RE: [PHP] regexp questions
> -Original Message- > From: Spud. Ivan. [mailto:spudm...@hotmail.com] > Sent: 11 May 2010 01:25 > To: php-general@lists.php.net > Subject: RE: [PHP] regexp questions > > > Is there any place where to read the changelog or something? Um, you mean, like, http://php.net/changelog ?? ;) Cheers! Mike -- Mike Ford, Electronic Information Developer, Libraries and Learning Innovation, Leeds Metropolitan University, C507, Civic Quarter Campus, Woodhouse Lane, LEEDS, LS1 3HE, United Kingdom Email: m.f...@leedsmet.ac.uk Tel: +44 113 812 4730 To view the terms under which this email is distributed, please go to http://disclaimer.leedsmet.ac.uk/email.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Forward to a Different PHP Script?
Hi, I am not sure if this makes sense, but here is a snippet of what I have: $q=$_GET["q"]; //find out which feed was selected if($q=="Herald Times") { $xml=("http://www.heraldtimesonline.com/rss/news.xml";); } else{ //execute a whole different php program, like http://localhost/mypages/another_program.php exit; } Is it possible that I could do something like this? If yes, what is the name of the function that I should use? Thanks for your help. Alice _ The New Busy is not the too busy. Combine all your e-mail accounts with Hotmail. http://www.windowslive.com/campaign/thenewbusy?tile=multiaccount&ocid=PID28326::T:WLMTAGL:ON:WL:en-US:WM_HMP:042010_4
RE: [PHP] Forward to a Different PHP Script?
-Original Message- From: Alice Wei [mailto:aj...@alumni.iu.edu] Sent: 11 May 2010 10:55 AM Subject: [PHP] Forward to a Different PHP Script? Hi, I am not sure if this makes sense, but here is a snippet of what I have: $q=$_GET["q"]; //find out which feed was selected if($q=="Herald Times") { $xml=("http://www.heraldtimesonline.com/rss/news.xml";); } else{ //execute a whole different php program, like http://localhost/mypages/another_program.php exit; } Is it possible that I could do something like this? If yes, what is the name of the function that I should use? Thanks for your help. Alice _ Use include(mypages/another_program.php); Cheers Arno -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: -----json and php----help
shahrzad khorrami wrote: hi dears, I have a json file. I want to access some fileds of this json file only and can add some fields to it also... I couldn't find any thing in www, json api ! is there any function to get specific data from json file or add function that can add something in somewhere in this json file or create new json file from this file with my format? $json = // get your json and pop it in this var $data = json_decode( $json ); // work on data as php arrays/objects etc $json = json_encode( $data ); // save the json back to a file or output or.. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: -----json and php----help
thanks Nathan, I think this is a good way
Re: [PHP] Re: PHP Application Structre
Nathan Nobbe wrote: On Mon, May 10, 2010 at 9:19 PM, David McGlone wrote: On Monday 10 May 2010 22:15:44 Paul M Foster wrote: On Mon, May 10, 2010 at 06:09:00PM -0400, David McGlone wrote: On Monday 10 May 2010 13:04:36 richard gray wrote: On 10/05/2010 18:17, Ashley Sheridan wrote: It makes sense sometimes to have different files for different sections of a website. For example, blog.php, gallery.php, cart.php could deal with the blog, gallery and shopping cart sections for an artists website. Yes, it could all be achieved with one script handling everything, but sometimes when the areas of the site differ greatly, it results in a lot of extra code to deal with pulling in the right template and content parts. I've always favoured only including the code a page needs rather than a huge amount of stuff that it doesn't. this isn't necessarily true - the architecture I've developed uses a single dispatch script (works fine with the mod rewrite option 2 scenario as well) - this script does general checks/security/filters etc then simply determines what page/function the user wants from the request ($_GET/$_POST parameter) and passes control to the specific handler via including the relevant controller module. The controller module is responsible for which template is required and loads up specific classes needed to process the request etc so each module just loads its own stuff and nothing else so there's no overhead. This method also has a small extra benefit that the web server document root just has a very simple 2 liner script instead a myriad of php scripts... if the webserver is misconfigured then someone who sees the source code doesn't get to see much.. This thread makes me wonder if using Smarty is smart. Does anyone here use a templeting system such as smarty or am I the only one? Lots of people use templating systems and particularly Smarty. Here's the difference between a templating system and just hand-coding: Hand coding-- Templating system: (Okay, I'm not familiar with Smarty syntax, but in essence template systems allow you to type less when you want PHP values to show up on the page.) Advantage: It *may* be easier for non-programmers to "read" the page with templating systems. I'm not sure this is really true. They're still liable to say, "What the heck is {flavor}?" Besides, my inclination is to tell designers to make everything look pretty, turn the resulting HTML over the the coders, who will then mark it up for PHP. After that, the designers can stay away from it. Disadvantage: You're adding another layer (and a LOT of code) just to save yourself some typing. With straight PHP, the server reads the code, interprets the PHP, substitutes values and shoves the page down to the browser. With a templating system, the system must load and call the templating engine, which must then substitute the proper values, and then output the built page to the browser. I don't know how everyone else does things, but I get a feeling of being very well organized when using smarty. I have to say that by using smarty, it has also helped me understand PHP more in depth. Maybe it's because of the strict organization, or maybe it's because I've been practicing a whole lot more. dunno. if theres one thing i tend to stay away from, or start deleting the second i inherit a new codebase, its smarty. ive never seen anything more bloated & ridiculous. hey, lets all learn *another* set of conventions & syntax on top of what we've already learned, drop *another* url in our bookmarks and slow down the entire universe in the process... imo smarty and most any 'template engine' on top of php can be summarized in one line of code: include($someScript); // :P i did gander at robs template system in interjinn once, but never got my head wrapped round it; honestly i only gave it a day or so. i prefer to go the typical route as per above, and omit the bloat that systems like smarty, savant etc bring to the table. nothing personal david, just an anti-smarty rant :) yeah I went down the smarty path a few years ago, through xslt, custom templates etc.. then one day i realised that Pre Hypertext Processor basically meant that PHP is a rather fancy template engine, so I use it instead now :p -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Forward to a Different PHP Script?
Arno Kuhl wrote: > -Original Message- > From: Alice Wei [mailto:aj...@alumni.iu.edu] > Sent: 11 May 2010 10:55 AM > Subject: [PHP] Forward to a Different PHP Script? > > Hi, > > I am not sure if this makes sense, but here is a snippet of what I have: > > $q=$_GET["q"]; > > //find out which feed was selected > if($q=="Herald Times") > { > $xml=("http://www.heraldtimesonline.com/rss/news.xml";); > } > else{ > >//execute a whole different php program, like > http://localhost/mypages/another_program.php >exit; > } > > Is it possible that I could do something like this? If yes, what is the > name of the function that I should use? > Thanks for your help. > > Alice > _ > > > Use include(mypages/another_program.php); > > Cheers > Arno Alternatively you could use header() to perform a redirect to another page/site/whatever. With the warning that there should be no output before the call to header; but see also output buffering if needed. Cheers -- David Robley I owe, I owe, it's off to work I go. Today is Sweetmorn, the 58th day of Discord in the YOLD 3176. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP Application Structre
On Tue, 2010-05-11 at 08:48 +0530, chetan rane wrote: > Hi all, > > mod rewrite was actually inrduced to have search engne frendly urls. > hnce if you want a seo site then you have to use options 1 & 2. using > smarty or any templating engine for readibility is not total true. > one of the major advantages of using template engines is caching > > On 5/11/10, David McGlone wrote: > > On Monday 10 May 2010 13:04:36 richard gray wrote: > >> On 10/05/2010 18:17, Ashley Sheridan wrote: > >> > It makes sense sometimes to have different files for different sections > >> > of a website. For example, blog.php, gallery.php, cart.php could deal > >> > with the blog, gallery and shopping cart sections for an artists > >> > website. Yes, it could all be achieved with one script handling > >> > everything, but sometimes when the areas of the site differ greatly, it > >> > results in a lot of extra code to deal with pulling in the right > >> > template and content parts. I've always favoured only including the code > >> > a page needs rather than a huge amount of stuff that it doesn't. > >> > >> this isn't necessarily true - the architecture I've developed uses a > >> single dispatch script (works fine with the mod rewrite option 2 > >> scenario as well) - this script does general checks/security/filters etc > >> then simply determines what page/function the user wants from the > >> request ($_GET/$_POST parameter) and passes control to the specific > >> handler via including the relevant controller module. The controller > >> module is responsible for which template is required and loads up > >> specific classes needed to process the request etc so each module just > >> loads its own stuff and nothing else so there's no overhead. > >> > >> This method also has a small extra benefit that the web server document > >> root just has a very simple 2 liner script instead a myriad of php > >> scripts... if the webserver is misconfigured then someone who sees the > >> source code doesn't get to see much.. > > > > This thread makes me wonder if using Smarty is smart. Does anyone here use a > > templeting system such as smarty or am I the only one? > > > > -- > > Blessings, > > David M. > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > > -- > Sent from my mobile device > > with regards, > > Chetan Dattaram Rane > Mob : +91 9766646714 > Phone: 0831-2462055 > Aside from the fact that I've yet to find any actual evidence that search engines treat what most people consider 'search engine friendly' urls any different from the 'unfriendly dynamic' ones. Next time you search for something online have a look at the URLs and see how many belong to forums with dynamic URLs. More than you'd think I would imagine, but it does go a long way to prove that most search engines don't give much credence to the URL these days. Of course, it does help if your keywords are in the URL, but I've not noticed much of a difference between: somesite.com/page-about-subject and somesite.com/?page=page-about-subject Thanks, Ash http://www.ashleysheridan.co.uk
RE: [PHP] Forward to a Different PHP Script?
> From: ak...@telkomsa.net > To: aj...@alumni.iu.edu; php-general@lists.php.net > Subject: RE: [PHP] Forward to a Different PHP Script? > Date: Tue, 11 May 2010 11:01:30 +0200 > > -Original Message- > From: Alice Wei [mailto:aj...@alumni.iu.edu] > Sent: 11 May 2010 10:55 AM > Subject: [PHP] Forward to a Different PHP Script? > > Hi, > > I am not sure if this makes sense, but here is a snippet of what I have: > > $q=$_GET["q"]; > > //find out which feed was selected > if($q=="Herald Times") > { > $xml=("http://www.heraldtimesonline.com/rss/news.xml";); > } > else{ > >//execute a whole different php program, like > http://localhost/mypages/another_program.php >exit; > } > > Is it possible that I could do something like this? If yes, what is the name > of the function that I should use? > Thanks for your help. > > Alice > _ > > > Use include(mypages/another_program.php); > > Cheers > Arno Cool, it worked. Thanks! > _ Hotmail is redefining busy with tools for the New Busy. Get more from your inbox. http://www.windowslive.com/campaign/thenewbusy?ocid=PID28326::T:WLMTAGL:ON:WL:en-US:WM_HMP:042010_2
Re: [PHP] Re: PHP Application Structre
Nathan Nobbe wrote: i did gander at robs template system in interjinn once, but never got my head wrapped round it; honestly i only gave it a day or so. i prefer to go the typical route as per above, and omit the bloat that systems like smarty, savant etc bring to the table. nothing personal david, just an anti-smarty rant :) Interestingly, Paul makes a reference to "make" in an earlier post. Indeed I use my template engine in several ways. One of which is like make such that I use it to also generate configuration files for other projects. For instance, it's happened enough times where I've had to glue together multiple applications, each with their own configuration, and permissions nuances. I leverage one aspect of the template engine to build the configuration files for each project based on a single centralized master configuration (at least as regards paths and database settings). This means that I generally only change one configuration when adapting a build between dev, staging, and production. Additionally, I use other aspects of the template engine, such as post processing to properly set directory/file ownerships and permissions in different environments, perform W3C XHTML validation on generated pages, etc. This is functionality that was not originally intended but evolved as I realized that the template engine could do much more than just expand macros and tags. The engine is pluggable and allows declaring processing chains at various levels. Between dev, staging, and production I usually just do: svn update ./buildSite.php And this installs InterJinn designed pages, InterJinn managed configurations, and InterJinn managed applications (such as Drupal, Joomla, MediaWiki, PHPMyAdmin, FengOffice, etc). Additionally, depending on need, I will generate templates for Drupal or MediaWiki using TemplateJinn since the template engine doesn't need to active at runtime. I can thus re-use simple tags for more complicated layout aspects like DHTML widgets. In another scenario, I handle a fair amount of Government content these days and can use the government's own CLF2 compliant HTML templates to generate pages that use this layout with minimal modification. For instance, recently I had to work with an ASP template to embed various content and stuff, I just added a few InterJinn tags to include page title, meta tags, french/english flip links, and the content. Then I created the content pages. Finally, I run buildSite.php and generate the entire section of ASP pages (yes I know it's odd they use this particular style of content). It's very convenient that the tag that creates the flip link between french and english is target aware and can properly link the french named page to the english named page and vice versa. Similarly, in another Government project on which I worked, the government used another contractor (this kind of thing happens quite often in Canada due to competition rules) to markup their project's consultation document. To incorporate this other company's content into the site, I just added a custom template handler to copy/lightly modify the pages programmatically so that they could be embedded seemlessly into the site. Then I deliver everything to the client along with relative path resources upon which those pages rely. Requirements for PHP: zero -- Runtime processing: zero! But don't be mistaken in thinking it can only work to generate pages. It is also used to generate on-the-fly widget content or even email content. Cheers, Rob. -- http://www.interjinn.com Application and Templating Framework for PHP -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: PHP Application Structre
At 1:34 AM -0600 5/11/10, Nathan Nobbe wrote: -snip- if theres one thing i tend to stay away from, or start deleting the second i inherit a new codebase, its smarty. ive never seen anything more bloated & ridiculous. hey, lets all learn *another* set of conventions & syntax on top of what we've already learned, drop *another* url in our bookmarks and slow down the entire universe in the process... imo smarty and most any 'template engine' on top of php can be summarized in one line of code: include($someScript); // :P i did gander at robs template system in interjinn once, but never got my head wrapped round it; honestly i only gave it a day or so. i prefer to go the typical route as per above, and omit the bloat that systems like smarty, savant etc bring to the table. nothing personal david, just an anti-smarty rant :) -nathan -nathan: Thanks! While I was reading this thread, I was beginning to think I was pretty dumb for not using Smarty. I have reviewed Smarty several times and simply thought "Damn, this is a lot of stuff to figure out!" But then I slipped back into my comfortable world of controlling everything myself. I have a professional goal to keep web languages separated as much as possible in my coding. For example, I try to never embed code. That's a far larger task than most people realize. As such, placing a template engine between me and the final product seems like I'm releasing control over a portion of my work that deals with the "separation of languages" goal I'm trying to achieve. 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] Re: PHP Application Structre
At 10:00 AM -0400 5/11/10, Robert Cummings wrote: Nathan Nobbe wrote: i did gander at robs template system in interjinn once, but never got my head wrapped round it; honestly i only gave it a day or so. i prefer to go the typical route as per above, and omit the bloat that systems like smarty, savant etc bring to the table. nothing personal david, just an anti-smarty rant :) Interestingly, Paul makes a reference to "make" in an earlier post. Indeed I use my template engine in several ways. One of which is like make such that I use it to also generate configuration files for other projects. For instance, it's happened enough times where I've had to glue together multiple applications, each with their own configuration, and permissions nuances. I leverage one aspect of the template engine to build the configuration files for each project based on a single centralized master configuration (at least as regards paths and database settings). This means that I generally only change one configuration when adapting a build between dev, staging, and production. Additionally, I use other aspects of the template engine, such as post processing to properly set directory/file ownerships and permissions in different environments, perform W3C XHTML validation on generated pages, etc. This is functionality that was not originally intended but evolved as I realized that the template engine could do much more than just expand macros and tags. The engine is pluggable and allows declaring processing chains at various levels. Between dev, staging, and production I usually just do: svn update ./buildSite.php And this installs InterJinn designed pages, InterJinn managed configurations, and InterJinn managed applications (such as Drupal, Joomla, MediaWiki, PHPMyAdmin, FengOffice, etc). Additionally, depending on need, I will generate templates for Drupal or MediaWiki using TemplateJinn since the template engine doesn't need to active at runtime. I can thus re-use simple tags for more complicated layout aspects like DHTML widgets. In another scenario, I handle a fair amount of Government content these days and can use the government's own CLF2 compliant HTML templates to generate pages that use this layout with minimal modification. For instance, recently I had to work with an ASP template to embed various content and stuff, I just added a few InterJinn tags to include page title, meta tags, french/english flip links, and the content. Then I created the content pages. Finally, I run buildSite.php and generate the entire section of ASP pages (yes I know it's odd they use this particular style of content). It's very convenient that the tag that creates the flip link between french and english is target aware and can properly link the french named page to the english named page and vice versa. Similarly, in another Government project on which I worked, the government used another contractor (this kind of thing happens quite often in Canada due to competition rules) to markup their project's consultation document. To incorporate this other company's content into the site, I just added a custom template handler to copy/lightly modify the pages programmatically so that they could be embedded seemlessly into the site. Then I deliver everything to the client along with relative path resources upon which those pages rely. Requirements for PHP: zero -- Runtime processing: zero! But don't be mistaken in thinking it can only work to generate pages. It is also used to generate on-the-fly widget content or even email content. Cheers, Rob. Rob: If I could understand what the Hell you are talking about, I'd be a better programmer. You're a bit like Einstein talking to a bunch of High School Physics Teachers. We nod our collective heads thinking "huh?" while hoping there isn't going to be a test. If you want me to understand this stuff, you have to dumb down some. 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] Re: PHP Application Structre
tedd wrote: Rob: If I could understand what the Hell you are talking about, I'd be a better programmer. You're a bit like Einstein talking to a bunch of High School Physics Teachers. We nod our collective heads thinking "huh?" while hoping there isn't going to be a test. If you want me to understand this stuff, you have to dumb down some. H... I thought I was dumbing it down :) Some will understand what I'm saying. Mostly, I just get annoyed when people say that templates engines just add overhead. It depends on the template engine. As I tried to explain in the example above, I use mine in many ways that decrease overhead and even allow for it to generate content used in a non-PHP environment. Mostly, I just solve problems :D Cheers, Rob. -- http://www.interjinn.com Application and Templating Framework for PHP -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] regexp questions
hehe, but I can't find anything related to regexp. I've found something at http://php.net/preg_match Changelog Version Description 5.2.2 Named subpatterns now accept the syntax (?) and (?'name') as well as (?P). Previous versions accepted only (?P). 4.3.3 The offset parameter was added 4.3.0 The PREG_OFFSET_CAPTURE flag was added 4.3.0 The flags parameter was added But it doesn't explain why my regexps work fine within php 5.1 but 5.3 Ivan. > > -Original Message- > From: Spud. Ivan. [mailto:spudm...@hotmail.com] > Sent: 11 May 2010 01:25 > To: php-general@lists.php.net > Subject: RE: [PHP] regexp questions > > > Is there any place where to read the changelog or something? Um, you mean, like, http://php.net/changelog ?? ;) Cheers! Mike -- Mike Ford, Electronic Information Developer, Libraries and Learning Innovation, Leeds Metropolitan University, C507, Civic Quarter Campus, Woodhouse Lane, LEEDS, LS1 3HE, United Kingdom Email: m.f...@leedsmet.ac.uk Tel: +44 113 812 4730 _ Disfruta de Messenger y Hotmail en tu BlackBerry ¡Hazlo ya! http://serviciosmoviles.es.msn.com/messenger/blackberry.aspx
Re: [PHP] regexp questions
On 05/11/2010 09:56 AM, Spud. Ivan. wrote: > > But it doesn't explain why my regexps work fine within php 5.1 but 5.3 > > Ivan. > Post a regex and what you think it should match but doesn't. -- Thanks! -Shawn http://www.spidean.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Array group and sum values.
I have this: while ($row = mysql_fetch_array($theData[0])) { $col1[] = $row[0]; $col2[] = lookup($row[1]); // this goes off and gets the country name. I then loop through col1 and col2 to produce something like this: 52 ARMENIA 215 CANADA 57 CANADA 261 COLOMBIA 53 EGYPT 62 INDIA 50 INDIA Is there a way I can group these? Thanks! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: regexp questions
Get a copy of http://www.weitz.de/regex-coach/ and contribute. Use the pattern on your string, one section at a time. On 5/10/2010 7:53 PM, Spud. Ivan. wrote: Hi, I've recently changed from php 5.1 to 5.3.2 and I'm havong problems with preg_match, because the same regular expressions used in php 5.1 are not matching anything in 5.3.2. There are any significant changes that I should know? I've been searching but I haven't found anything. Thanks. I.Lopez. _ Recibe en tu HOTMAIL los emails de TODAS tus CUENTAS. + info http://www.vivelive.com/hotmail-la-gente-de-hoy/index.html?multiaccount -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: regexp questions
I think the error is related to changed described here. http://www.pcre.org/changelog.txt Shiplu Mokadd.im My talks, http://talk.cmyweb.net Follow me, http://twitter.com/shiplu SUST Programmers, http://groups.google.com/group/p2psust Innovation distinguishes bet ... ... (ask Steve Jobs the rest) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: regexp questions
On Tue, 2010-05-11 at 23:29 +0700, shiplu wrote: > I think the error is related to changed described here. > http://www.pcre.org/changelog.txt > > Shiplu Mokadd.im > My talks, http://talk.cmyweb.net > Follow me, http://twitter.com/shiplu > SUST Programmers, http://groups.google.com/group/p2psust > Innovation distinguishes bet ... ... (ask Steve Jobs the rest) > That's quite a long document, care to narrow it down slightly? :p Thanks, Ash http://www.ashleysheridan.co.uk
Re: [PHP] php path and relink
Am 11.05.2010 02:23, schrieb Augusto Flavio: > Hi, > > > I have a shell account with limited access. The php cli version installated > is 4.4.6. But the server have also the php 5.2.6. I checked the php version > and i got this: > > > $ php -v > PHP 4.4.9 (cli) (built: Sep 17 2008 11:04:03) > . > > But i want that the php command be a link to the php5. > > How can i "re-link" this php command to the path /usr/local/php5/bin/php ? > > I tried include this path in the PATH variable env but didn't worked. > > > Some idea? > > > Thanks > > Augusto Morais. > > If it's only for your shell: Edit .bashrc and paste this: alias php="/usr/local/php5/bin/php" Save and re-login. -- Piero -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: regexp questions
oops! Please see the change log for version 8.00 on http://www.pcre.org/changelog.txt Shiplu Mokadd.im My talks, http://talk.cmyweb.net Follow me, http://twitter.com/shiplu SUST Programmers, http://groups.google.com/group/p2psust Innovation distinguishes bet ... ... (ask Steve Jobs the rest)
Re: [PHP] Array group and sum values.
Paul Halliday wrote: > I have this: > > while ($row = mysql_fetch_array($theData[0])) { > > $col1[] = $row[0]; > $col2[] = lookup($row[1]); // this goes off and gets the country name. > > I then loop through col1 and col2 to produce something like this: > > 52ARMENIA > 215 CANADA > 57CANADA > 261 COLOMBIA > 53EGYPT > 62INDIA > 50INDIA > > Is there a way I can group these? > > Thanks! > Group them?? How about this while ($row = mysql_fetch_array($theData[0])) { $col1[lookup($row[1])][] = $row[0]; which, using the data you showed, will give you this Array ( [ARMENIA] => Array ( [0] => 52 ) [CANADA] => Array ( [0] => 215 [1] => 57 ) [COLOMBIA] => Array ( [0] => 261 ) [EGYPT] => Array ( [0] => 53 ) [INDIA] => Array ( [0] => 62 [1] => 50 ) ) -- Jim Lucas "Some men are born to greatness, some achieve greatness, and some have greatness thrust upon them." Twelfth Night, Act II, Scene V by William Shakespeare -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Array group and sum values.
On Tue, May 11, 2010 at 2:25 PM, Jim Lucas wrote: > Paul Halliday wrote: >> I have this: >> >> while ($row = mysql_fetch_array($theData[0])) { >> >> $col1[] = $row[0]; >> $col2[] = lookup($row[1]); // this goes off and gets the country name. >> >> I then loop through col1 and col2 to produce something like this: >> >> 52 ARMENIA >> 215 CANADA >> 57 CANADA >> 261 COLOMBIA >> 53 EGYPT >> 62 INDIA >> 50 INDIA >> >> Is there a way I can group these? >> >> Thanks! >> > > Group them?? > > How about this > > while ($row = mysql_fetch_array($theData[0])) { > > $col1[lookup($row[1])][] = $row[0]; > > which, using the data you showed, will give you this > > > Array > ( > [ARMENIA] => Array > ( > [0] => 52 > ) > > [CANADA] => Array > ( > [0] => 215 > [1] => 57 > ) > > [COLOMBIA] => Array > ( > [0] => 261 > ) > > [EGYPT] => Array > ( > [0] => 53 > ) > > [INDIA] => Array > ( > [0] => 62 > [1] => 50 > ) > > ) > > -- > Jim Lucas > > "Some men are born to greatness, some achieve greatness, > and some have greatness thrust upon them." > > Twelfth Night, Act II, Scene V > by William Shakespeare > I was actually hoping to have them arranged like: $col1[0] = INDIA $col2[0] = 112 $col1[1] = CANADA $col2[1] = 272 ... Thanks. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Array group and sum values.
Paul Halliday wrote: > On Tue, May 11, 2010 at 2:25 PM, Jim Lucas wrote: >> Paul Halliday wrote: >>> I have this: >>> >>> while ($row = mysql_fetch_array($theData[0])) { >>> >>> $col1[] = $row[0]; >>> $col2[] = lookup($row[1]); // this goes off and gets the country name. >>> >>> I then loop through col1 and col2 to produce something like this: >>> >>> 52ARMENIA >>> 215 CANADA >>> 57CANADA >>> 261 COLOMBIA >>> 53EGYPT >>> 62INDIA >>> 50INDIA >>> >>> Is there a way I can group these? >>> >>> Thanks! >>> >> Group them?? >> >> How about this >> >> while ($row = mysql_fetch_array($theData[0])) { >> >>$col1[lookup($row[1])][] = $row[0]; >> >> which, using the data you showed, will give you this >> >> >> Array >> ( >>[ARMENIA] => Array >>( >>[0] => 52 >>) >> >>[CANADA] => Array >>( >>[0] => 215 >>[1] => 57 >>) >> >>[COLOMBIA] => Array >>( >>[0] => 261 >>) >> >>[EGYPT] => Array >>( >>[0] => 53 >>) >> >>[INDIA] => Array >>( >>[0] => 62 >>[1] => 50 >>) >> >> ) >> >> -- >> Jim Lucas >> >> "Some men are born to greatness, some achieve greatness, >> and some have greatness thrust upon them." >> >> Twelfth Night, Act II, Scene V >>by William Shakespeare >> > > I was actually hoping to have them arranged like: > > $col1[0] = INDIA > $col2[0] = 112 > $col1[1] = CANADA > $col2[1] = 272 > ... > > Thanks. > Well, then take what I gave you and do this: $group[lookup($row[1])][] = $row[0]; foreach ( $group AS $x => $y ) { $col1[] = $x; $col2[] = array_sum($y); } In the end you will end up with this $y ) { $col1[] = $x; $col2[] = array_sum($y); } print_r($col1); print_r($col2); -- Jim Lucas "Some men are born to greatness, some achieve greatness, and some have greatness thrust upon them." Twelfth Night, Act II, Scene V by William Shakespeare -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Array group and sum values.
On Tue, May 11, 2010 at 4:03 PM, Jim Lucas wrote: > Paul Halliday wrote: >> On Tue, May 11, 2010 at 2:25 PM, Jim Lucas wrote: >>> Paul Halliday wrote: I have this: while ($row = mysql_fetch_array($theData[0])) { $col1[] = $row[0]; $col2[] = lookup($row[1]); // this goes off and gets the country name. I then loop through col1 and col2 to produce something like this: 52 ARMENIA 215 CANADA 57 CANADA 261 COLOMBIA 53 EGYPT 62 INDIA 50 INDIA Is there a way I can group these? Thanks! >>> Group them?? >>> >>> How about this >>> >>> while ($row = mysql_fetch_array($theData[0])) { >>> >>> $col1[lookup($row[1])][] = $row[0]; >>> >>> which, using the data you showed, will give you this >>> >>> >>> Array >>> ( >>> [ARMENIA] => Array >>> ( >>> [0] => 52 >>> ) >>> >>> [CANADA] => Array >>> ( >>> [0] => 215 >>> [1] => 57 >>> ) >>> >>> [COLOMBIA] => Array >>> ( >>> [0] => 261 >>> ) >>> >>> [EGYPT] => Array >>> ( >>> [0] => 53 >>> ) >>> >>> [INDIA] => Array >>> ( >>> [0] => 62 >>> [1] => 50 >>> ) >>> >>> ) >>> >>> -- >>> Jim Lucas >>> >>> "Some men are born to greatness, some achieve greatness, >>> and some have greatness thrust upon them." >>> >>> Twelfth Night, Act II, Scene V >>> by William Shakespeare >>> >> >> I was actually hoping to have them arranged like: >> >> $col1[0] = INDIA >> $col2[0] = 112 >> $col1[1] = CANADA >> $col2[1] = 272 >> ... >> >> Thanks. >> > > Well, then take what I gave you and do this: > > $group[lookup($row[1])][] = $row[0]; > > foreach ( $group AS $x => $y ) > { > $col1[] = $x; > $col2[] = array_sum($y); > } > > > In the end you will end up with this > > > $data = array( > array(52, 'ARMENIA'), > array(215, 'CANADA'), > array(57, 'CANADA'), > array(261, 'COLOMBIA'), > array(53, 'EGYPT'), > array(62, 'INDIA'), > array(50, 'INDIA'), > ); > > foreach ( $data AS $row ) > { > $group[$row[1]][] = $row[0]; > } > > print_r($group); > > foreach ( $group AS $x => $y ) > { > $col1[] = $x; > $col2[] = array_sum($y); > } > > print_r($col1); > print_r($col2); > > Perfect! and a lot simpler than I thought. Thanks. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] regexp questions
I think we've not so much only with the regex, but maybe you can tell me somethin helpful ;) /Word1:<\/a><\/h4>\(fir.*?st word.*?(.*)Word2:<\/a><\/h4>(.*)Second word:<\/a><\/h4>(.*)Word3:<\/a><\/h4>(.*)rd word/is Thanks. I.Lopez. >> On 05/11/2010 09:56 AM, Spud. Ivan. wrote: > > But it doesn't explain why my regexps work fine within php 5.1 but 5.3 > > Ivan. > Post a regex and what you think it should match but doesn't. -- Thanks! -Shawn http://www.spidean.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php _ Disfruta de Messenger y Hotmail en tu BlackBerry ¡Hazlo ya! http://serviciosmoviles.es.msn.com/messenger/blackberry.aspx
RE: [PHP] regexp questions
On Tue, 2010-05-11 at 22:45 +0200, Spud. Ivan. wrote: > > I think we've not so much only with the regex, but maybe you can tell me > somethin helpful ;) > > /Word1:<\/a><\/h4>\( href=\"http:\/\/www.thiswebsite.com\/some-script.php\">fir.*?st > word.*?(.*)Word2:<\/a><\/h4>(.*)Second > word:<\/a><\/h4>(.*)Word3:<\/a><\/h4>(.*)rd word/is > > Thanks. > I.Lopez. > > >> > On 05/11/2010 09:56 AM, Spud. Ivan. wrote: > > > > But it doesn't explain why my regexps work fine within php 5.1 but 5.3 > > > > Ivan. > > > > Post a regex and what you think it should match but doesn't. > > > -- > Thanks! > -Shawn > http://www.spidean.com > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > _ > Disfruta de Messenger y Hotmail en tu BlackBerry ¡Hazlo ya! > http://serviciosmoviles.es.msn.com/messenger/blackberry.aspx What are you trying to match the regex against? Also, I've noticed you've used a lot of periods (.) where it looks like you intended a literal period to be matched. In regular expressions, periods match any character expect the newline, so "www.thiswebsite.com" would also match the string "www_thiswebsite_com". Ps, please try not to top post, as it disrupts the zen flow of the list! :) Thanks, Ash http://www.ashleysheridan.co.uk
Re: [PHP] Array group and sum values.
On 05/11/2010 02:17 PM, Paul Halliday wrote: > On Tue, May 11, 2010 at 4:03 PM, Jim Lucas wrote: >> Paul Halliday wrote: >>> On Tue, May 11, 2010 at 2:25 PM, Jim Lucas wrote: Paul Halliday wrote: > I have this: > > while ($row = mysql_fetch_array($theData[0])) { > > $col1[] = $row[0]; > $col2[] = lookup($row[1]); // this goes off and gets the country name. > > I then loop through col1 and col2 to produce something like this: > > 52ARMENIA > 215 CANADA > 57CANADA > 261 COLOMBIA > 53EGYPT > 62INDIA > 50INDIA > > Is there a way I can group these? > > Thanks! > > > Group them?? How about this while ($row = mysql_fetch_array($theData[0])) { $col1[lookup($row[1])][] = $row[0]; which, using the data you showed, will give you this Array ( [ARMENIA] => Array ( [0] => 52 ) [CANADA] => Array ( [0] => 215 [1] => 57 ) [COLOMBIA] => Array ( [0] => 261 ) [EGYPT] => Array ( [0] => 53 ) [INDIA] => Array ( [0] => 62 [1] => 50 ) ) -- Jim Lucas "Some men are born to greatness, some achieve greatness, and some have greatness thrust upon them." Twelfth Night, Act II, Scene V by William Shakespeare >>> >>> I was actually hoping to have them arranged like: >>> >>> $col1[0] = INDIA >>> $col2[0] = 112 >>> $col1[1] = CANADA >>> $col2[1] = 272 >>> ... >>> >>> Thanks. >>> I would probably do this: $col1 = $col2 = array(); while ($row = mysql_fetch_array($theData[0])) { $country = lookup($row[1]); if(($found = array_search($country, $col1)) !== false) { $col2[$found] += $row[0]; } else { $col1[] = $country; $col2[] = $row[0]; } } -- Thanks! -Shawn http://www.spidean.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Array group and sum values.
On 05/11/2010 04:09 PM, Shawn McKenzie wrote: > On 05/11/2010 02:17 PM, Paul Halliday wrote: >> On Tue, May 11, 2010 at 4:03 PM, Jim Lucas wrote: >>> Paul Halliday wrote: On Tue, May 11, 2010 at 2:25 PM, Jim Lucas wrote: > Paul Halliday wrote: >> I have this: >> >> while ($row = mysql_fetch_array($theData[0])) { >> >> $col1[] = $row[0]; >> $col2[] = lookup($row[1]); // this goes off and gets the country >> name. >> >> I then loop through col1 and col2 to produce something like this: >> >> 52ARMENIA >> 215 CANADA >> 57CANADA >> 261 COLOMBIA >> 53EGYPT >> 62INDIA >> 50INDIA >> >> Is there a way I can group these? >> >> Thanks! >> >> >> > Group them?? > > How about this > > while ($row = mysql_fetch_array($theData[0])) { > >$col1[lookup($row[1])][] = $row[0]; > > which, using the data you showed, will give you this > > > Array > ( >[ARMENIA] => Array >( >[0] => 52 >) > >[CANADA] => Array >( >[0] => 215 >[1] => 57 >) > >[COLOMBIA] => Array >( >[0] => 261 >) > >[EGYPT] => Array >( >[0] => 53 >) > >[INDIA] => Array >( >[0] => 62 >[1] => 50 >) > > ) > > -- > Jim Lucas > > "Some men are born to greatness, some achieve greatness, > and some have greatness thrust upon them." > > Twelfth Night, Act II, Scene V >by William Shakespeare > I was actually hoping to have them arranged like: $col1[0] = INDIA $col2[0] = 112 $col1[1] = CANADA $col2[1] = 272 ... Thanks. > > I would probably do this: > > $col1 = $col2 = array(); > > while ($row = mysql_fetch_array($theData[0])) { > $country = lookup($row[1]); > > if(($found = array_search($country, $col1)) !== false) { > $col2[$found] += $row[0]; > } else { > $col1[] = $country; > $col2[] = $row[0]; > } > } > Although I myself would prefer it to be in this format: $result = array(); foreach($rows as $row) { $country = lookup($row[1]); if(isset($result[$country])) { $result[$country] += $row[0]; } else { $result[$country] = $row[0]; } } Which would give: array ( INDIA => 112 CANADA => 272 //etc... ) Then to use, just: foreach($result as $country => $value) { echo $country . ' ' . $value; // or whatever } -- Thanks! -Shawn http://www.spidean.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] regexp questions
> From: a...@ashleysheridan.co.uk > To: spudm...@hotmail.com > CC: php-general@lists.php.net > Date: Tue, 11 May 2010 21:43:54 +0100 > Subject: RE: [PHP] regexp questions > > On Tue, 2010-05-11 at 22:45 +0200, Spud. Ivan. wrote: > > > > > I think we've not so much only with the regex, but maybe you can tell me > > somethin helpful ;) > > > > /Word1:<\/a><\/h4>\( > href=\"http:\/\/www.thiswebsite.com\/some-script.php\">fir.*?st > > word.*?(.*)Word2:<\/a><\/h4>(.*)Second > > word:<\/a><\/h4>(.*)Word3:<\/a><\/h4>(.*)rd word/is > > > > Thanks. > > I.Lopez. > > > > >> > > On 05/11/2010 09:56 AM, Spud. Ivan. wrote: > > > > > > But it doesn't explain why my regexps work fine within php 5.1 but 5.3 > > > > > > Ivan. > > > > > > > Post a regex and what you think it should match but doesn't. > > > > > > -- > > Thanks! > > -Shawn > > http://www.spidean.com > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > _ > > Disfruta de Messenger y Hotmail en tu BlackBerry ¡Hazlo ya! > > http://serviciosmoviles.es.msn.com/messenger/blackberry.aspx > > > What are you trying to match the regex against? > > Also, I've noticed you've used a lot of periods (.) where it looks like > you intended a literal period to be matched. In regular expressions, > periods match any character expect the newline, so "www.thiswebsite.com" > would also match the string "www_thiswebsite_com". > > > Ps, please try not to top post, as it disrupts the zen flow of the > list! :) > > Thanks, > Ash > http://www.ashleysheridan.co.uk > > Ok I'm sorry for top posting ;) Sure, I know that . match any character, but only one and It doesn't matter to me if it's . or _ , it's ok I think. The problem is that if I test it in a small string, it works, but if I take the 30kb html source, it only works with php versions older than 5.2 So, I think you wan't not to test the regexp within the original file, (or yes? :) ) I.Lopez. _ Diseñar aplicaciones tiene premio. ¡Si eres desarrollador no esperes más! http://www.imaginemobile.es
RE: [PHP] regexp questions
On Tue, 2010-05-11 at 23:48 +0200, Spud. Ivan. wrote: > > > > > From: a...@ashleysheridan.co.uk > > To: spudm...@hotmail.com > > CC: php-general@lists.php.net > > Date: Tue, 11 May 2010 21:43:54 +0100 > > Subject: RE: [PHP] regexp questions > > > > On Tue, 2010-05-11 at 22:45 +0200, Spud. Ivan. wrote: > > > > > > > > I think we've not so much only with the regex, but maybe you can tell me > > > somethin helpful ;) > > > > > > /Word1:<\/a><\/h4>\( > > href=\"http:\/\/www.thiswebsite.com\/some-script.php\">fir.*?st > > > word.*?(.*)Word2:<\/a><\/h4>(.*)Second > > > word:<\/a><\/h4>(.*)Word3:<\/a><\/h4>(.*)rd word/is > > > > > > Thanks. > > > I.Lopez. > > > > > > >> > > > On 05/11/2010 09:56 AM, Spud. Ivan. wrote: > > > > > > > > But it doesn't explain why my regexps work fine within php 5.1 but 5.3 > > > > > > > > Ivan. > > > > > > > > > > Post a regex and what you think it should match but doesn't. > > > > > > > > > -- > > > Thanks! > > > -Shawn > > > http://www.spidean.com > > > > > > -- > > > PHP General Mailing List (http://www.php.net/) > > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > > _ > > > Disfruta de Messenger y Hotmail en tu BlackBerry ¡Hazlo ya! > > > http://serviciosmoviles.es.msn.com/messenger/blackberry.aspx > > > > > > What are you trying to match the regex against? > > > > Also, I've noticed you've used a lot of periods (.) where it looks like > > you intended a literal period to be matched. In regular expressions, > > periods match any character expect the newline, so "www.thiswebsite.com" > > would also match the string "www_thiswebsite_com". > > > > > > Ps, please try not to top post, as it disrupts the zen flow of the > > list! :) > > > > Thanks, > > Ash > > http://www.ashleysheridan.co.uk > > > > > > > > > Ok I'm sorry for top posting ;) > > > > Sure, I know that . match any character, but only one and It doesn't matter > to me if it's . or _ , it's ok I think. > > > > The problem is that if I test it in a small string, it works, but if I take > the 30kb html source, it only works with php versions older than 5.2 > > So, I think you wan't not to test the regexp within the original file, (or > yes? :) ) > > > > I.Lopez. > > > > _ > Diseñar aplicaciones tiene premio. ¡Si eres desarrollador no esperes más! > http://www.imaginemobile.es Is it possible that you're running out of memory for this script? Increase the memory a script can use in php.ini to see if this helps. If that doesn't, can you determine the exact maximum filesize you can process with this regular expression? It could be you've found a bug in the regex parser perhaps? Thanks, Ash http://www.ashleysheridan.co.uk
Re: [PHP] regexp questions
Spud. Ivan. wrote: > > I think we've not so much only with the regex, but maybe you can tell me > somethin helpful ;) > > /Word1:<\/a><\/h4>\( href=\"http:\/\/www.thiswebsite.com\/some-script.php\">fir.*?st > word.*?(.*)Word2:<\/a><\/h4>(.*)Second > word:<\/a><\/h4>(.*)Word3:<\/a><\/h4>(.*)rd word/is > > Thanks. > I.Lopez. > > On 05/11/2010 09:56 AM, Spud. Ivan. wrote: >> But it doesn't explain why my regexps work fine within php 5.1 but 5.3 >> >> Ivan. >> > > Post a regex and what you think it should match but doesn't. > > Again... Why don't you show us an example of what it is you are trying to match this against. Then, after that example, show us what you would like to see as the output. Then, send us a copy of the code you are trying to use to make it all happen. -- Jim Lucas "Some men are born to greatness, some achieve greatness, and some have greatness thrust upon them." Twelfth Night, Act II, Scene V by William Shakespeare -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] 2D barcodes
I have a project where I need to add some 2D barcodes onto some PDF files. I plan to use fpdi, since I've used it before and am familiar with it, but I need a source to generate the 2D barcodes, preferably as a png or jpg. Anyone have a suggestion - either a local classfile or a reliable web service? Free is preferred. :-) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP Encoder like IonCube
Hi Shiplu - I also have a product with similar requirements. I searched a LOT and was never able to find a free solution that I was satisfied with. Even a lot of the commercial solutions required some server-side runtime EXE or something be installed, and my customers are not tech savvy enough to get that going. I ultimately settled on PHP Lockit, which is $29. It's a Windows program that you run to create an obfuscated version of your script. I'm very satisfied with the obfuscation, and it does not require any external runtime files or anything. Works like a charm, and I recommend it. http://phplockit.com/ - Brian On May 9, 2010, at 1:36 PM, shiplu wrote: > Is there any php encoder like IonCube ? > Looking for an opensource solution. > My main target is to deliver encoded php codes so that it can not be > re-engineered. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP Encoder like IonCube
On Tue, 2010-05-11 at 16:50 -0700, Brian Dunning wrote: > Hi Shiplu - > > I also have a product with similar requirements. I searched a LOT and was > never able to find a free solution that I was satisfied with. Even a lot of > the commercial solutions required some server-side runtime EXE or something > be installed, and my customers are not tech savvy enough to get that going. > > I ultimately settled on PHP Lockit, which is $29. It's a Windows program that > you run to create an obfuscated version of your script. I'm very satisfied > with the obfuscation, and it does not require any external runtime files or > anything. Works like a charm, and I recommend it. > > http://phplockit.com/ > > - Brian > > On May 9, 2010, at 1:36 PM, shiplu wrote: > > > Is there any php encoder like IonCube ? > > Looking for an opensource solution. > > My main target is to deliver encoded php codes so that it can not be > > re-engineered. > > > > Does slightly limit you to the Windows platform though, which I always think is a shame when using a language as open as PHP. Thanks, Ash http://www.ashleysheridan.co.uk
Re: [PHP] PHP Encoder like IonCube
Totally agree. But just in case it wasn't clear, you only need a Windows computer once to run the obfuscator; once done the code runs on any PHP server. On May 11, 2010, at 5:06 PM, Ashley Sheridan wrote: > Does slightly limit you to the Windows platform though, which I always think > is a shame when using a language as open as PHP. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP Encoder like IonCube
I dont own a windows computer. I found phpcoder.sf.net. it uses eaccelerator to encode. This is good. But the problem is latest version of e-accelerator discontinued the encoder. So may be, an older version will do it. Didn't configured it yet. Shiplu Mokadd.im My talks, http://talk.cmyweb.net Follow me, http://twitter.com/shiplu SUST Programmers, http://groups.google.com/group/p2psust Innovation distinguishes bet ... ... (ask Steve Jobs the rest) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP Encoder like IonCube
On May 11, 2010, at 8:36 PM, shiplu wrote: I dont own a windows computer. I found phpcoder.sf.net. it uses eaccelerator to encode. This is good. But the problem is latest version of e-accelerator discontinued the encoder. So may be, an older version will do it. Didn't configured it yet. Shiplu Mokadd.im My talks, http://talk.cmyweb.net Follow me, http://twitter.com/shiplu SUST Programmers, http://groups.google.com/group/p2psust Innovation distinguishes bet ... ... (ask Steve Jobs the rest) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Guys, This is what contracts are for. You should be licensing the code to the users/clients. The contract is a legally enforcable doc that protects you. We do this with classic ASP code and have not had any issues at all. Moving to another language is no barrier. The one thing to remember about altering the code is that when, not if, you need to maintain it and your dev machine with all the toys is not available, it's gonna be a pain to deal with. A good contract will help you to avoid all that. Bastien Sent from my iPod -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP Application Structre
Ashley Sheridan wrote: On Tue, 2010-05-11 at 08:48 +0530, chetan rane wrote: Hi all, mod rewrite was actually inrduced to have search engne frendly urls. hnce if you want a seo site then you have to use options 1 & 2. using smarty or any templating engine for readibility is not total true. one of the major advantages of using template engines is caching I've read some {disparaging?) comments on "option 2", but I've got a question, or point, about that. I'm not at all sure that you have to use "mod_rewrite" at all, can't you just use a FORCETYPE directive on your handler script(s)? I've certainly got some work in the form: somesite.com/scriptname/var1/var2/var3 that seems to work well with no use of the rewrite module. Aside from the fact that I've yet to find any actual evidence that search engines treat what most people consider 'search engine friendly' urls any different from the 'unfriendly dynamic' ones. Next time you search for something online have a look at the URLs and see how many belong to forums with dynamic URLs. More than you'd think I would imagine, but it does go a long way to prove that most search engines don't give much credence to the URL these days. Of course, it does help if your keywords are in the URL, but I've not noticed much of a difference between: somesite.com/page-about-subject and somesite.com/?page=page-about-subject I think that this may be an artifact of an earlier time. There was a time when SE's didn't do so well with query strings, but it'd be a little silly to think their owners didn't realize this and left things exactly the way they were back in 2002 ... wouldn't it? My $0.02, Kevin Kinsey -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php