Re: [PHP] Re: Question regarding passwords/security
Store everything in the database in an encrypted form. Stuart Dallas wrote: On 22 Dec 2011, at 19:34, Paul M Foster wrote: I have concerns that the items in a session buffer can be copied and used to spoof legitimate logins. This is harder to do when the info is held in a database. Storing stuff in a database is no more secure, it simply requires one single extra step... finding the DB credentials in the source code. Given that the only way a user could read session data (assuming you're using the default session handler, i.e. file-based) is if they have access to those files. If they do have access to those files they almost certainly also have access to your source code (since the web user must be able to read both), especially if you're using a shared host. If you're using a dedicated server then you should address the reason you're worried about people having access to session files first. -Stuart -- Stuart Dallas 3ft9 Ltd http://3ft9.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Question regarding passwords/security
On 12/22/2011 10:05 AM, Paul M Foster wrote: Not sure how to ask this question... I've always eschewed consulting a database on page loads to determine if a user is logged in, primarily because of latency issues. For example, you could store a nonce like the session ID in a table for a user when they log in. Then each time they arrive at a page which needs certain permissions to access, you'd check the table for the nonce and compare it to the actual session ID or whatever to determine that they're properly logged in. This seems reasonable but suffers from the lag on the database link's query-and-response lag time. So I've always preferred some solution where something is dragged along in a session cookie instead. Maybe something like the hash of user login, email and user name, which wouldn't be there unless you'd put it there on login. But this latter scheme just seems inherently less secure than consulting the table. Is there any concensus or overwhelming argument one way or the other? Paul Why not just use Sessions, that's what the function is for. http://php.net/manual/en/features.sessions.php There is a good example on this page. I'm also big on using the session buffer to maintain the current states for visitors. e.g., one I'm working on now. Obviously, most are binary switches. Makes condition logic simple. [confirmedRestrictedUser] = [idPassed] = [loggedIn] = [newRegRecordMode] = [pendingRestrictedUser] = [recordToken] = [regModeLoggedIn] = [regUserEditMode] = [restrictedMode] = 1 [secrCodePassed] = [securityPassed] = [sessionStart] = Thu, 22 Dec 2011 12:49:54 -0500 [userType] = restricted -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Question regarding passwords/security
On Thu, Dec 22, 2011 at 12:55:41PM -0500, Al wrote: On 12/22/2011 10:05 AM, Paul M Foster wrote: Not sure how to ask this question... I've always eschewed consulting a database on page loads to determine if a user is logged in, primarily because of latency issues. For example, you could store a nonce like the session ID in a table for a user when they log in. Then each time they arrive at a page which needs certain permissions to access, you'd check the table for the nonce and compare it to the actual session ID or whatever to determine that they're properly logged in. This seems reasonable but suffers from the lag on the database link's query-and-response lag time. So I've always preferred some solution where something is dragged along in a session cookie instead. Maybe something like the hash of user login, email and user name, which wouldn't be there unless you'd put it there on login. But this latter scheme just seems inherently less secure than consulting the table. Is there any concensus or overwhelming argument one way or the other? Paul Why not just use Sessions, that's what the function is for. http://php.net/manual/en/features.sessions.php There is a good example on this page. I'm also big on using the session buffer to maintain the current states for visitors. e.g., one I'm working on now. Obviously, most are binary switches. Makes condition logic simple. [confirmedRestrictedUser] = [idPassed] = [loggedIn] = [newRegRecordMode] = [pendingRestrictedUser] = [recordToken] = [regModeLoggedIn] = [regUserEditMode] = [restrictedMode] = 1 [secrCodePassed] = [securityPassed] = [sessionStart] = Thu, 22 Dec 2011 12:49:54 -0500 [userType] = restricted I have concerns that the items in a session buffer can be copied and used to spoof legitimate logins. This is harder to do when the info is held in a database. Paul -- Paul M. Foster http://noferblatz.com http://quillandmouse.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Question regarding passwords/security
On 22 Dec 2011, at 19:34, Paul M Foster wrote: I have concerns that the items in a session buffer can be copied and used to spoof legitimate logins. This is harder to do when the info is held in a database. Storing stuff in a database is no more secure, it simply requires one single extra step... finding the DB credentials in the source code. Given that the only way a user could read session data (assuming you're using the default session handler, i.e. file-based) is if they have access to those files. If they do have access to those files they almost certainly also have access to your source code (since the web user must be able to read both), especially if you're using a shared host. If you're using a dedicated server then you should address the reason you're worried about people having access to session files first. -Stuart -- Stuart Dallas 3ft9 Ltd http://3ft9.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Question regarding passwords/security
On 12/22/2011 2:54 PM, Stuart Dallas wrote: On 22 Dec 2011, at 19:34, Paul M Foster wrote: I have concerns that the items in a session buffer can be copied and used to spoof legitimate logins. This is harder to do when the info is held in a database. Storing stuff in a database is no more secure, it simply requires one single extra step... finding the DB credentials in the source code. Given that the only way a user could read session data (assuming you're using the default session handler, i.e. file-based) is if they have access to those files. If they do have access to those files they almost certainly also have access to your source code (since the web user must be able to read both), especially if you're using a shared host. If you're using a dedicated server then you should address the reason you're worried about people having access to session files first. -Stuart Sessions are faster, one step to read the session array. Encode a token e.g., MD5 the timestamp, and save it in the session buffer. Gets pretty secure. If you're on a shared host with poor security, bad folks can do anything on your site. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Question about losing port number
On 09/26/2011 05:45 PM, vince chan wrote: Hi: I have a general question about PHP: So basically I have a link, and I want the href to be absolute., so I do 'https://' . $_SERVER['HTTP_HOST'] . '/login' ; this gives me https://127.0.0.1/login on my local; however, what i really want is https://127.0.0.1:9090/login, it is missing :9090. I also have tried to use $_SERVER['SERVER_PORT'], but $_SERVER['SERVER_PORT'] doesn't give me 9090, it gives me 80. Could anyone help me? Thx I the page that you are on is connected via port 80 then $_SERVER['SERVER_PORT'] will be 80. If it is connected via 9090 then $_SERVER['SERVER_PORT'] will be 9090. If you want it to be different than how it is currently connected then you will have to hard code the port number in the href. -- Thanks! -Shawn http://www.spidean.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Question about news.php.net
MikeB wrote: Daniel Brown wrote: On Mon, Sep 13, 2010 at 19:51, MikeBmpbr...@gmail.com wrote: As part of the bug report I included a link to an image of my nntp config. I saw that, thanks. I'll look into creating a mirror of the news server, as well, for NNTP-only access. I won't lie and say that it's a priority, but I'll try to get to it as soon as I have time, Mike. You must have already done something. It's working a lot better today. Thanks. Perhaps I spoke too soon. It seems intermittent. Lots of denials today. However, I've switched to the gmane list as recommended by somone else on this thread and that works a treat, so I may just do an unsubscribe here to get rid of the annoying timeout messages. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Question about news.php.net
Gary wrote: MikeB wrote: I understand that the news server is based on a mailing list, but I can't handle another high-volume source dumping stuff into my email (even if I filter it into a separate folder) so I am trying to subscribe through the news group. However, getting access seems to be hit-and-miss, since I more often than not get a message that the connection to news.php.net timed out. Tried nntp://news.gmane.org/gmane.comp.php.general ? Bingo! Thanks! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Question on XML/XSL/PHP/MySQL
Ryan Park wrote: Hypothetically say that I have MySQL with petabytes of data. I want to use XSL as my template language. But in order to use XSL, I need to make XML filled with petabytes of data. This does not sound elaborate way to use XSL/XML; I would rather use PHP/MySQL/Smarty. Is there a way around this so that I can use XSL instead of Smarty? have you tried rdf serialized as xml and displayed w/ xslt? you could also do it on the clientside (with xslt) obviously and palm off the presentation to the client; or ecmascript over json encoded data. still unsure why you'd want to display petabytes of data in one page though; normally we'd use paging for this - at which point you take that out of the equation and decision should be down to whether you want to publish your (petabytes of) data as human readable data or as both human and machine readable data. If the decision is both then look into rdf as xml w/ xslt or as XHTML+RDFa for the smarty approach. regards! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Question: Sorting through table headers?
What you are trying to do is ridiculously easy, and something which I accomplished years ago. Basically every column heading needs to be output as a hyperlink which repeats the current page with the addition of orderby=column_name in the URL. This information appears in the $_GET array, so you just repeat the previous sql query with the addition of an ORDER BY clause. This assumes that you have already taken care of caching the query and paginating the results. You cannot do this in a separate class as it requires action in both the presentation (UI) and data access layers, and a single class is not allowed to operate in more than one layer. -- Tony Marston http://www.tonymarston.net http://www.radicore.org Parham Doustdar parha...@gmail.com wrote in message news:77.26.26879.9b9ad...@pb1.pair.com... Hello there, I've been asked to create something like the tables you usually see, where the headers are actually links and when you click the links, the table gets sorted based on the header. Are there any classes that you know of that would do the job? My current idea is to return an array of the colomn which contains the data you want to sort on (like 'name') then sort the array and do something like: [code] for (i = 0; i length(array); i++) mysql_query(select * from table where 'name' = ${aray[i]}); [/code] Any better algorithms anyone? Thanks! -- --- Contact info: Skype: parham-d MSN: fire_lizard16 at hotmail dot com GoogleTalk: parha...@gmail.com Twitter: PD90 email: parham90 at GMail dot com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Question: Sorting through table headers?
Tony Marston wrote: You cannot do this in a separate class as it requires action in both the presentation (UI) and data access layers, and a single class is not allowed to operate in more than one layer. You can, but you shouldn't if you want to write your classes according to the MVC pattern. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Question: Sorting through table headers?
On Mon, Sep 14, 2009 at 3:29 PM, Marcus Gnaß gona...@gmx.de wrote: Tony Marston wrote: You cannot do this in a separate class as it requires action in both the presentation (UI) and data access layers, and a single class is not allowed to operate in more than one layer. You can, but you shouldn't if you want to write your classes according to the MVC pattern. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Why not send the data as XML and let the client handle it? Sorting and the filtering are relatively simple to implement in JS -- Bastien Cat, the other other white meat -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Question: Sorting through table headers?
On Mon, Sep 14, 2009 at 3:57 PM, Bastien Koert phps...@gmail.com wrote: On Mon, Sep 14, 2009 at 3:29 PM, Marcus Gnaß gona...@gmx.de wrote: Tony Marston wrote: You cannot do this in a separate class as it requires action in both the presentation (UI) and data access layers, and a single class is not allowed to operate in more than one layer. You can, but you shouldn't if you want to write your classes according to the MVC pattern. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Why not send the data as XML and let the client handle it? Sorting and the filtering are relatively simple to implement in JS -- Bastien Cat, the other other white meat Make that send ALL the data -- Bastien Cat, the other other white meat -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Question: what are frameworks?
good question !! I think the word framework is modern fashion term in the first case. in former days we used to say library C comes with a standard library, in modern words C comes with a standard framework. I use my own framework, means I reuse my code written for similar things before, so I use my framework. its like a painter, he uses a ready made frame to paint what ever he wants, u can use the yahoo UI framework to paint ur page. A operating system is a framework unifieing the underlaying hardware. as in former days u said library u say more modern framework in both cases its a bunch of functions doing some stuff the user of the framework hasn't to take care about by using the framework. hope that helps ralph ralph_def...@yahoo.de Parham Doustdar parha...@gmail.com wrote in message news:5c.b0.05105.f18be...@pb1.pair.com... Hi there, I've heard of frameworks, but I don't quite know what they are used for. I've done a little search on the internet, but even though I've been able to find different PHP frameworks, I'm not quite sure what they offer, or in what they differ, or why I shouldn't just use PHP as it is. Can someone give a little bit of explaination? Thanks! -- --- Contact info: Skype: parham-d MSN: fire_lizard16 at hotmail dot com email: parham90 at GMail dot com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Question: what are frameworks?
Ralph Deffke wrote: good question !! I think the word framework is modern fashion term in the first case. in former days we used to say library C comes with a standard library, in modern words C comes with a standard framework. I use my own framework, means I reuse my code written for similar things before, so I use my framework. its like a painter, he uses a ready made frame to paint what ever he wants, u can use the yahoo UI framework to paint ur page. A operating system is a framework unifieing the underlaying hardware. as in former days u said library u say more modern framework in both cases its a bunch of functions doing some stuff the user of the framework hasn't to take care about by using the framework. hope that helps I think framework is different than library. Pear is a collection of libraries. PECL (and binary modules that ship with php) are a collection of libraries. I don't use pre-packaged frameworks so it probably is best for me not to define them, but I think they are a basically a collection of classes and libraries intended to make rapid development of web applications faster. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Question: what are frameworks?
Parham Doustdar parha...@gmail.com wrote in message news:5c.b0.05105.f18be...@pb1.pair.com... Hi there, I I've heard of frameworks, but I don't quite know what they are used for. I've done a little search on the internet, but even though I've been able to find different PHP frameworks, I'm not quite sure what they offer, or in what they differ, or why I shouldn't just use PHP as it is. Can someone give a little bit of explaination? Thanks! A framework is more than just a simple collection of libraries, it is a support structure in which another software project (application) can be organised and developed. The simplest framework is nothing more than a menu system which informs the user what application components are available, and provides the means for the user to choose an option from that list and cause it to executed or activated. This means that each application component can be developed without the need for any code to handle the menu functionality. The component is simply plugged into the framework and it is instantly available. This simple framework can be extended to provide other features, such as security. Instead of allowing just anybody to access the application it may need to be restricted to registered users only, and this can be accomplished by inserting a login mechanism into the framework. It may then be decided that not every user is allowed to access every component, so additional access control mechanisms can be built in. It should be possible to extend the framework without having to touch every single component that runs within it. The framework may provide other facilities, such as providing the ability to navigate between components, to pass messages between components, audit logging, workflow, et cetera. This allows the application programmers to concentrate on the needs of the application without being bogged down with other details. Some people seem to think that each application needs its own separate framework in order to satisfy the unique needs of that application, but they have simply not learned to abstract out that functionality which is common to every application. It is therefore possible to build a framework that can be used by any number of different applications. RADICORE is such a framework. An advantage of a reusable framework is that once a programmer has become familiar with it he can carry that knowledge forward into the next application without having to learn a different framework. A framework is a support structure in which another software project (application) can be organised and developed. The simplest framework is nothing more than a menu system which informs the user what application components are available, and provides the means for the user to choose an option from that list and cause it to executed or activated. This means that each application component can be developed without the need for any code to handle the menu functionality. The component is simply plugged into the framework and it is instantly available. This simple framework can be extended to provide other features, such as security. Instead of allowing just anybody to access the application it may need to be restricted to registered users only, and this can be accomplished by inserting a login mechanism into the framework. It may then be decided that not every user is allowed to access every component, so additional access control mechanisms can be built in. It should be possible to extend the framework without having to touch every single component that runs within it. The framework may provide other facilities, such as providing the ability to navigate between components, to pass messages between components, audit logging, workflow, et cetera. This allows the application programmers to concentrate on the needs of the application without being bogged down with other details. Some people seem to think that each application needs its own separate framework in order to satisfy the unique needs of that application, but they have simply not learned to abstract out that functionality which is common to every application. It is therefore possible to build a framework that can be used by any number of different applications. RADICORE is such a framework. An advantage of a reusable framework is that once a programmer has become familiar with it he can carry that knowledge forward into the next application without having to learn a different framework. There are lots of different PHP frameworks available for the simple reason that there are lots of different PHP programmers who each have their own methodologies and techniques. Some frameworks are written to aid the development of particular kinds of software, such as building web sites or CMS systems, whereas others (like Radicore) are for building web applications. -- Tony Marston http://www.tonymarston.net http://www.radicore.org -- PHP General Mailing List
Re: [PHP] Re: Question: what are frameworks?
Michael A. Peters wrote: Ralph Deffke wrote: good question !! I think the word framework is modern fashion term in the first case. in former days we used to say library C comes with a standard library, in modern words C comes with a standard framework. I use my own framework, means I reuse my code written for similar things before, so I use my framework. its like a painter, he uses a ready made frame to paint what ever he wants, u can use the yahoo UI framework to paint ur page. A operating system is a framework unifieing the underlaying hardware. as in former days u said library u say more modern framework in both cases its a bunch of functions doing some stuff the user of the framework hasn't to take care about by using the framework. hope that helps I think framework is different than library. Pear is a collection of libraries. PECL (and binary modules that ship with php) are a collection of libraries. I don't use pre-packaged frameworks so it probably is best for me not to define them, but I think they are a basically a collection of classes and libraries intended to make rapid development of web applications faster. You might consider reading this: http://en.wikipedia.org/wiki/Software_framework -- With warm regards, Sudheer. S Business: http://binaryvibes.co.in, Tech stuff: http://techchorus.net, Personal: http://sudheer.net -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Question: what are frameworks?
On Sun, Aug 9, 2009 at 9:29 AM, Sudheer Satyanarayanasudhee...@binaryvibes.co.in wrote: Michael A. Peters wrote: Ralph Deffke wrote: good question !! I think the word framework is modern fashion term in the first case. in former days we used to say library C comes with a standard library, in modern words C comes with a standard framework. I use my own framework, means I reuse my code written for similar things before, so I use my framework. its like a painter, he uses a ready made frame to paint what ever he wants, u can use the yahoo UI framework to paint ur page. A operating system is a framework unifieing the underlaying hardware. as in former days u said library u say more modern framework in both cases its a bunch of functions doing some stuff the user of the framework hasn't to take care about by using the framework. hope that helps I think framework is different than library. Pear is a collection of libraries. PECL (and binary modules that ship with php) are a collection of libraries. I don't use pre-packaged frameworks so it probably is best for me not to define them, but I think they are a basically a collection of classes and libraries intended to make rapid development of web applications faster. You might consider reading this: http://en.wikipedia.org/wiki/Software_framework -- With warm regards, Sudheer. S Business: http://binaryvibes.co.in, Tech stuff: http://techchorus.net, Personal: http://sudheer.net -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php It's also worth noting that the frameworks goals may differ. The CodeIgniter framework has support for both PHP 4 and PHP5, which makes it more flexible where hosts have not upgraded to php5 for whatever reason. Many of the others (like cake, symfony and zend) tend to only support php5 and are also more object oriented from a coding perspective. Then there implementation features; CodeIgniter has a smaller learning curve, footprint and is faster than many of the others. Zend allows developers to pick and choose the framework components to use as well having a very rich feature set. symfony has a full ORM layers that handles mapping object to the database layer. Cake, symfony and zend offer features to generate the basic classes for each database table. In all cases the idea of the framework is to abstract the heavy lifting (the common features of developing uploaders, database handlers, forms handling, validation etc) and allowing developers to simply use the framework functionality to handle that, freeing up time to focus on getting the business logic of the application in place. -- Bastien Cat, the other other white meat -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Question on code profiling
Andrew Ballard a écrit : I'm trying to profile a site on our development server to see why it takes around 4 seconds to generate a pretty basic page. Last time I seen this is when I did validate DOM Document without DTD on local disk :D Can you put somewhere the essential code that take time ? -- Mickaël Wolff aka Lupus Michaelis http://lupusmic.org Seeking for a position http://lupusmic.org/pro/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Question on code profiling
On Fri, Jul 24, 2009 at 2:27 AM, Lupus Michaelismickael+...@lupusmic.org wrote: Andrew Ballard a écrit : I'm trying to profile a site on our development server to see why it takes around 4 seconds to generate a pretty basic page. Last time I seen this is when I did validate DOM Document without DTD on local disk :D Can you put somewhere the essential code that take time ? -- Mickaël Wolff aka Lupus Michaelis http://lupusmic.org Not really. I haven't written much for this site yet, so the bulk of the code is just the framework itself. If I can't find anything, I'll probably be posting on the ZF mailing list next. I have had really good experiences with ZF on a couple shared-hosting Linux servers I've used, but performance on Windows so far has been dismal. Andrew -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Question on code profiling
Just an idea: try using the (microtime(true) - $start) approach in portions of code to try isolate the portion that is taking more time. Sometimes that helps me to find the function that is slowing everything down. Jonathan On Thu, Jul 23, 2009 at 6:18 PM, Andrew Ballardaball...@gmail.com wrote: On Thu, Jul 23, 2009 at 5:10 PM, Ben Dunlapbdun...@agentintellect.com wrote: significant (around 46%), it says they only account for 193ms. What could account for that much difference between what xdebug calculates versus the total elapsed time? Are you counting total elapsed time from the perspective of the web browser? If so, YSlow might be helpful: http://developer.yahoo.com/yslow/ Ben -- Twitter: @bdunlap I'm using YSlow too. Here's the last run I did: YSlow: 4.494 seconds Elapsed (microtime(true) - $start): 3.990795135498 seconds xdebug(WinCacheGrind): 402ms (0.402 seconds) Andrew -- 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] Re: Question about template systems
On Wed, 2009-03-04 at 18:01 -0800, Michael A. Peters wrote: Robert Cummings wrote: On Wed, 2009-03-04 at 15:21 -0800, Michael A. Peters wrote: Robert Cummings wrote: To punt what is repeated over and over during runtime to a single compilation phase when building the template target. To simplify the use of parameters so that they can be used in arbitrary order with default values. To allow for the encapsulation of complex content in tag format that benefits from building at compile time and from being encapsulated in custom tags that integrate well with the rest of the HTML body. I can't speak to those (and I have no opinion on template systems having never used any of them. To remove the necessaity of constantly moving in and out of PHP tags. php does not require that you constantly move in and out of PHP tags. There's at least one and possibly several pure php solutions that allow one to never write a line of html but get beautiful dynamic html output. It doesn't require, but if you're not moving between them, then you're probably echoing your HTML, and that can be a maintenance nightmare. echoing html involves mixing html and php. Using an XML class (like DOMDocument) to build the document does not. So you punt the entire rendering of the HTML content to run-time execution one node at a time? 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: Question about template systems
On Wed, 2009-03-04 at 21:42 -0700, Nathan Nobbe wrote: On Wed, Mar 4, 2009 at 7:01 PM, Michael A. Peters mpet...@mac.com wrote: echoing html involves mixing html and php. Using an XML class (like DOMDocument) to build the document does not. ive actually written a little templating system which subclasses SimpleXMLElement to achieve just that, take a peak at the syntax if you like (any feedback appreciated), http://nathan.moxune.com/phacadeDemo/ the syntax toward the bottom is what i really liked when i was starting out. the demo page is about as far as i got w/ it, though. what i ended up not liking about it, is how its joined at the hip w/ xml. suppose i want to template other things,.. css, js, php all come to mind. i could do that w/ pure php, and im sure any of these other systems such as smarty could let you template things beyond a subset of xml. what i like about this blitz module, and Rob's TemplateJinn, is an additional emphasis on performance. That was one of the reasons I wrote the TemplateJinn parser from scratch. It isn't dependent on XML. The custom tag aspect (only one part) of it uses XML-like tag syntax, but it does not require that an entire document be XML compliant nor even XML-like at all. This allows the tags to be applied to older non-compliant documents, partial documents, non tag documents, etc. the other thing that i cant understand in general about templating is the whole notion of making things easier for so-called designers, ui folks or w/e, who arent used to 'code'. in my personal experience, i have yet to see anyone actually doing that right, or anything close to it in a real environment. im not trying to say there is one way and only one way to use a templating system, but im just saying that is a halmark benefit, which i dont think ive ever seen in practice.. what i see is programmers using them b/c they feel its hepling them separate presentation and logic. I've had non programmers use my template engine, and they've not had a problem. That doesn't mean to say it wasn't primarily developed for my own use, but having a tag structure makes it fairly easy for anyone using tags to understand. that said, i think folks really should look at what templating solutions are doing or can do in their environment. i dont know, most templating systems look pretty similar to me from a distance, smarty savant look fundamentally similar. you have a class which you populate with data, and then those are mapped into placeholders in template files. the rest of the differences seem skin deep to me, but if im missing something, id love to know. There are different philosophies for how template engines work. For instance Smarty uses a push system-- you initialize the template, assign variable values, and smarty pushes the values to the template, then returns the final content. TemplateJinn generally works the other way... the template declares one or more modules (or makes use of a pre-loaded module), the template includes tags that pull data from the module. Since it's compiled to the final page, or PHP source that would be included, then the data is pulled at run-time and the need for the template processor is removed at run-time. TemplateJinn can work the other way also... but I find it more natural for the template to declare what it wants and to pull data from the module than the other way around. 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: Question about template systems
Robert Cummings wrote: On Wed, 2009-03-04 at 18:01 -0800, Michael A. Peters wrote: Robert Cummings wrote: On Wed, 2009-03-04 at 15:21 -0800, Michael A. Peters wrote: Robert Cummings wrote: To punt what is repeated over and over during runtime to a single compilation phase when building the template target. To simplify the use of parameters so that they can be used in arbitrary order with default values. To allow for the encapsulation of complex content in tag format that benefits from building at compile time and from being encapsulated in custom tags that integrate well with the rest of the HTML body. I can't speak to those (and I have no opinion on template systems having never used any of them. To remove the necessaity of constantly moving in and out of PHP tags. php does not require that you constantly move in and out of PHP tags. There's at least one and possibly several pure php solutions that allow one to never write a line of html but get beautiful dynamic html output. It doesn't require, but if you're not moving between them, then you're probably echoing your HTML, and that can be a maintenance nightmare. echoing html involves mixing html and php. Using an XML class (like DOMDocument) to build the document does not. So you punt the entire rendering of the HTML content to run-time execution one node at a time? Cheers, Rob. This is what I do. I create the nodes as needed and add them to the parent nodes when I'm done with them - and when the document is finished, add the various content nodes to the body node, body/head nodes to html node, and then use saveXML(); to get the output as x(ht)ml to send to the browser. If that's what you described then yes. Otherwise, then no - it's not. some example, IE to build my form - $xmlForm = $myxhtml-createElement(form); $xmlForm-setAttribute(id,records); $xmlForm-setAttribute(method,post); if ($multipart 0) { $xmlForm-setAttribute(enctype,multipart/form-data); } $xmlForm-setAttribute(action,$formaction); $xmlForm-setAttribute(onsubmit,$onsubmit); $hiddenDiv = $myxhtml-createElement(div); $hiddenDiv-setAttribute(id,hidden_inputs); $hinput=hiddenInput($myxhtml,coord_pref,$coord_pref); $hinput-setAttribute(id,coord_pref); $hiddenDiv-appendChild($hinput); $hinput=hiddenInput($myxhtml,alt_pref,$alt_pref); $hiddenDiv-appendChild($hinput); $hinput=hiddenInput($myxhtml,temp_pref,$temp_pref); $hiddenDiv-appendChild($hinput); // etc .. if(isset($imgref)) { $hinput=hiddenInput($myxhtml,imgref,$imgref); $hiddenDiv-appendChild($hinput); $hasimage=1; } if ($museum == 1) { if (isset($validarray['museum'])) { require('xml_record_museum.inc'); } else { $hinput=hiddenInput($myxhtml,museumid,$rcd_musid); $hinput-setAttribute(id,museumid); $hiddenDiv-appendChild($hinput); $hinput=hiddenInput($myxhtml,museum_name,$rcd_musnum); $hinput-setAttribute(id,museum_name); $hiddenDiv-appendChild($hinput); } } if ($editrecord == 1) { $hinput=hiddenInput($myxhtml,recordid,$record); $hiddenDiv-appendChild($hinput); } if (isset($validarray['species'])) { require('xml_record_species.inc'); } else { $hinput=hiddenInput($myxhtml,herpid,$rcd_species); $hinput-setAttribute(id,herpid); $hiddenDiv-appendChild($hinput); } ... $xmlForm-appendChild($hiddenDiv); $submitDiv = $myxhtml-createElement(div); $submitDiv-setAttribute(id,submitdiv); $submitDiv-setAttribute(class,formFloat); $submitInput = $myxhtml-createElement(input); $submitInput-setAttribute(type,submit); $submitInput-setAttribute(id,submit); $submitInput-setAttribute(name,submit); $submitInput-setAttribute(value,$submit_val); $submitDiv-appendChild($submitInput); $xmlForm-appendChild($submitDiv); $contentDiv-appendChild($xmlForm); The various requires are files that create various parts of the form. They are in individual separate files because some of them are used in other forms and I don't like to have replicated code that is functionally equivalent. hiddenInput is a simple function I wrote that returns an input node of type hidden - which I can (when needed, IE if I want to add an id tag for javascript hook) I can continue to modify. function hiddenInput($document,$name,$value) { $input = $document-createElement(input); $input-setAttribute(type,hidden); $input-setAttribute(name,$name); $input-setAttribute(value,$value); return($input); } Does that answer your question? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Question about template systems
On Thu, 2009-03-05 at 02:04 -0800, Michael A. Peters wrote: Robert Cummings wrote: On Wed, 2009-03-04 at 18:01 -0800, Michael A. Peters wrote: Robert Cummings wrote: On Wed, 2009-03-04 at 15:21 -0800, Michael A. Peters wrote: Robert Cummings wrote: To punt what is repeated over and over during runtime to a single compilation phase when building the template target. To simplify the use of parameters so that they can be used in arbitrary order with default values. To allow for the encapsulation of complex content in tag format that benefits from building at compile time and from being encapsulated in custom tags that integrate well with the rest of the HTML body. I can't speak to those (and I have no opinion on template systems having never used any of them. To remove the necessaity of constantly moving in and out of PHP tags. php does not require that you constantly move in and out of PHP tags. There's at least one and possibly several pure php solutions that allow one to never write a line of html but get beautiful dynamic html output. It doesn't require, but if you're not moving between them, then you're probably echoing your HTML, and that can be a maintenance nightmare. echoing html involves mixing html and php. Using an XML class (like DOMDocument) to build the document does not. So you punt the entire rendering of the HTML content to run-time execution one node at a time? Cheers, Rob. This is what I do. I create the nodes as needed and add them to the parent nodes when I'm done with them - and when the document is finished, add the various content nodes to the body node, body/head nodes to html node, and then use saveXML(); to get the output as x(ht)ml to send to the browser. If that's what you described then yes. Otherwise, then no - it's not. some example, IE to build my form - $xmlForm = $myxhtml-createElement(form); $xmlForm-setAttribute(id,records); $xmlForm-setAttribute(method,post); if ($multipart 0) { $xmlForm-setAttribute(enctype,multipart/form-data); } $xmlForm-setAttribute(action,$formaction); $xmlForm-setAttribute(onsubmit,$onsubmit); $hiddenDiv = $myxhtml-createElement(div); $hiddenDiv-setAttribute(id,hidden_inputs); $hinput=hiddenInput($myxhtml,coord_pref,$coord_pref); $hinput-setAttribute(id,coord_pref); $hiddenDiv-appendChild($hinput); $hinput=hiddenInput($myxhtml,alt_pref,$alt_pref); $hiddenDiv-appendChild($hinput); $hinput=hiddenInput($myxhtml,temp_pref,$temp_pref); $hiddenDiv-appendChild($hinput); // etc .. if(isset($imgref)) { $hinput=hiddenInput($myxhtml,imgref,$imgref); $hiddenDiv-appendChild($hinput); $hasimage=1; } if ($museum == 1) { if (isset($validarray['museum'])) { require('xml_record_museum.inc'); } else { $hinput=hiddenInput($myxhtml,museumid,$rcd_musid); $hinput-setAttribute(id,museumid); $hiddenDiv-appendChild($hinput); $hinput=hiddenInput($myxhtml,museum_name,$rcd_musnum); $hinput-setAttribute(id,museum_name); $hiddenDiv-appendChild($hinput); } } if ($editrecord == 1) { $hinput=hiddenInput($myxhtml,recordid,$record); $hiddenDiv-appendChild($hinput); } if (isset($validarray['species'])) { require('xml_record_species.inc'); } else { $hinput=hiddenInput($myxhtml,herpid,$rcd_species); $hinput-setAttribute(id,herpid); $hiddenDiv-appendChild($hinput); } ... $xmlForm-appendChild($hiddenDiv); $submitDiv = $myxhtml-createElement(div); $submitDiv-setAttribute(id,submitdiv); $submitDiv-setAttribute(class,formFloat); $submitInput = $myxhtml-createElement(input); $submitInput-setAttribute(type,submit); $submitInput-setAttribute(id,submit); $submitInput-setAttribute(name,submit); $submitInput-setAttribute(value,$submit_val); $submitDiv-appendChild($submitInput); $xmlForm-appendChild($submitDiv); $contentDiv-appendChild($xmlForm); The various requires are files that create various parts of the form. They are in individual separate files because some of them are used in other forms and I don't like to have replicated code that is functionally equivalent. hiddenInput is a simple function I wrote that returns an input node of type hidden - which I can (when needed, IE if I want to add an id tag for javascript hook) I can continue to modify. function hiddenInput($document,$name,$value) { $input = $document-createElement(input); $input-setAttribute(type,hidden); $input-setAttribute(name,$name); $input-setAttribute(value,$value); return($input); } Does that answer your question? That was what I thought. 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: Question about template systems
Robert Cummings wrote: function hiddenInput($document,$name,$value) { $input = $document-createElement(input); $input-setAttribute(type,hidden); $input-setAttribute(name,$name); $input-setAttribute(value,$value); return($input); } Does that answer your question? That was what I thought. Cheers, Rob. Is there a reason I shouldn't be doing it that way? The reasons I like it so much, even though it requires more lines to do the same thing - 1) Mixing html and php is really ugly and difficult to maintain - sometimes even a week after I write mixed code I have issues reading it, especially when mixing html and php inside a loop. It's much easier to track down a missing } this way. 2) Let's me easily translate to valid html 4.01 for clients that don't accept xml+html 3) So far I haven't (yet) found an xss attack that works with zero input validation. Everything I've tried - even the most bizarre filter dodging tricks - seems to be nicely turned into a text node. For that reason alone it seems worth it, but that's a side effect of me choosing to do things that way. A very pleasant one, though. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Question about template systems
On Thu, 2009-03-05 at 03:08 -0800, Michael A. Peters wrote: Robert Cummings wrote: function hiddenInput($document,$name,$value) { $input = $document-createElement(input); $input-setAttribute(type,hidden); $input-setAttribute(name,$name); $input-setAttribute(value,$value); return($input); } Does that answer your question? That was what I thought. Cheers, Rob. Is there a reason I shouldn't be doing it that way? I didn't say you shouldn't. It's just expensive on every page request to regenerate a document node by node. it also strikes me as tedious :/ 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: Question about template systems
Robert Cummings wrote: Is there a reason I shouldn't be doing it that way? I didn't say you shouldn't. It's just expensive on every page request to regenerate a document node by node. it also strikes me as tedious :/ It's definitely tedious - but I end up writing functions that do the tedious stuff when I can. Paragraph nodes that include several children (span nodes and anchor nodes etc.) are the worst. Not too bad though once you get use to doing it that way. Paragraphs with too many spans and links are usually bad design anyway, so it encourages you to find a way to get your content point across in a better fashion ;) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Question about template systems
On Mar 5, 2009, at 4:16 AM, Robert Cummings rob...@interjinn.com wrote: On Thu, 2009-03-05 at 03:08 -0800, Michael A. Peters wrote: Robert Cummings wrote: function hiddenInput($document,$name,$value) { $input = $document-createElement(input); $input-setAttribute(type,hidden); $input-setAttribute(name,$name); $input-setAttribute(value,$value); return($input); } imo, I'd much rather have the simple syntax of phacade, rather than use the Dom Api directly; if I were using this approach in practice. Does that answer your question? That was what I thought. Cheers, Rob. Is there a reason I shouldn't be doing it that way? I didn't say you shouldn't. It's just expensive on every page request to regenerate a document node by node. it also strikes me as tedious :/ it's way less tedious if you curb the syntax, which was my motivation for the system I posted earlier. The idea was to make it feel just like writing xhtml, but really it's just php code. it's definately an expensive approach, but at least using native code for most of the heavy lifting should make it way faster than a straight php solution (using the same approach). -nathan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Question about template systems
On Tue, 2009-03-03 at 21:18 -0600, Shawn McKenzie wrote: Matthew Croud wrote: Hello, First post here, I'm in the process of learning PHP , I'm digesting a few books as we speak. I'm working on a content heavy website that provides a lot of information, a template system would be great and so i've been looking at ways to create dynamic data with a static navigation system. So far, using the require_once(); function seems to fit the bill in order to bring in the same header html file on each page. I've also looked at Smartys template system. I wondered how you folk would go about creating a template system ? My second question might be me jumping the gun here, I haven't come across this part in my book but i'll ask about it anyway. I often see websites that have a dynamic body and static header, and their web addresses end like this: index.php?id=445 where 445 i presume is some my file reference. What is this called ? It seems like the system i'm after but it doesn't appear in my book, If anyone could let me know what this page id subject is called i can do some research on the subject. Thanks for any help you can provide :) Matt. I have written a popular theme/template system for some CMS systems. In my opinion, templating is only needed for those that are totally ignorant of the concept of programming languages in general. I'm not sure... but I'm pretty sur eyou just called me ignorant. Blanket statements like that one above are themselves ignorant. 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: Question about template systems
Robert Cummings wrote: On Tue, 2009-03-03 at 21:18 -0600, Shawn McKenzie wrote: Matthew Croud wrote: Hello, First post here, I'm in the process of learning PHP , I'm digesting a few books as we speak. I'm working on a content heavy website that provides a lot of information, a template system would be great and so i've been looking at ways to create dynamic data with a static navigation system. So far, using the require_once(); function seems to fit the bill in order to bring in the same header html file on each page. I've also looked at Smartys template system. I wondered how you folk would go about creating a template system ? My second question might be me jumping the gun here, I haven't come across this part in my book but i'll ask about it anyway. I often see websites that have a dynamic body and static header, and their web addresses end like this: index.php?id=445 where 445 i presume is some my file reference. What is this called ? It seems like the system i'm after but it doesn't appear in my book, If anyone could let me know what this page id subject is called i can do some research on the subject. Thanks for any help you can provide :) Matt. I have written a popular theme/template system for some CMS systems. In my opinion, templating is only needed for those that are totally ignorant of the concept of programming languages in general. I'm not sure... but I'm pretty sur eyou just called me ignorant. Blanket statements like that one above are themselves ignorant. Cheers, Rob. Well then you're ignorant because I didn't call you ignorant! Didn't you write your own template system? Seriously though, I should have worded that differently. I guess the second paragraph was more what I was after. But to clarify the first paragraph, I would suspect if they are anything like me, many of those that know and use PHP prefer to do control type things in PHP (loops, ifs, includes, etc.). I know I do. I like templating in that I use a template (HTML file) and add echos, or use simple templating logic so that {somevar} echoes $somevar, but why replicate what PHP can do with a separate language? -- 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] Re: Question about template systems
On Wed, 2009-03-04 at 10:55 -0600, Shawn McKenzie wrote: Robert Cummings wrote: On Tue, 2009-03-03 at 21:18 -0600, Shawn McKenzie wrote: Matthew Croud wrote: Hello, First post here, I'm in the process of learning PHP , I'm digesting a few books as we speak. I'm working on a content heavy website that provides a lot of information, a template system would be great and so i've been looking at ways to create dynamic data with a static navigation system. So far, using the require_once(); function seems to fit the bill in order to bring in the same header html file on each page. I've also looked at Smartys template system. I wondered how you folk would go about creating a template system ? My second question might be me jumping the gun here, I haven't come across this part in my book but i'll ask about it anyway. I often see websites that have a dynamic body and static header, and their web addresses end like this: index.php?id=445 where 445 i presume is some my file reference. What is this called ? It seems like the system i'm after but it doesn't appear in my book, If anyone could let me know what this page id subject is called i can do some research on the subject. Thanks for any help you can provide :) Matt. I have written a popular theme/template system for some CMS systems. In my opinion, templating is only needed for those that are totally ignorant of the concept of programming languages in general. I'm not sure... but I'm pretty sur eyou just called me ignorant. Blanket statements like that one above are themselves ignorant. Cheers, Rob. Well then you're ignorant because I didn't call you ignorant! Didn't you write your own template system? Seriously though, I should have worded that differently. I guess the second paragraph was more what I was after. But to clarify the first paragraph, I would suspect if they are anything like me, many of those that know and use PHP prefer to do control type things in PHP (loops, ifs, includes, etc.). I know I do. I like templating in that I use a template (HTML file) and add echos, or use simple templating logic so that {somevar} echoes $somevar, but why replicate what PHP can do with a separate language? To punt what is repeated over and over during runtime to a single compilation phase when building the template target. To simplify the use of parameters so that they can be used in arbitrary order with default values. To allow for the encapsulation of complex content in tag format that benefits from building at compile time and from being encapsulated in custom tags that integrate well with the rest of the HTML body. To remove the necessaity of constantly moving in and out of PHP tags. To speed up a site. To speed up development. To make easier to use for non-developers. To integrate standards compliance checks into the build phase. To do sooo many things that are just inconvenient and tedious using intermingled PHP code with fixed parameters order (or alternatively a big fugly array). 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: Question about template systems
Robert Cummings wrote: On Wed, 2009-03-04 at 10:55 -0600, Shawn McKenzie wrote: Robert Cummings wrote: On Tue, 2009-03-03 at 21:18 -0600, Shawn McKenzie wrote: Matthew Croud wrote: Hello, First post here, I'm in the process of learning PHP , I'm digesting a few books as we speak. I'm working on a content heavy website that provides a lot of information, a template system would be great and so i've been looking at ways to create dynamic data with a static navigation system. So far, using the require_once(); function seems to fit the bill in order to bring in the same header html file on each page. I've also looked at Smartys template system. I wondered how you folk would go about creating a template system ? My second question might be me jumping the gun here, I haven't come across this part in my book but i'll ask about it anyway. I often see websites that have a dynamic body and static header, and their web addresses end like this: index.php?id=445 where 445 i presume is some my file reference. What is this called ? It seems like the system i'm after but it doesn't appear in my book, If anyone could let me know what this page id subject is called i can do some research on the subject. Thanks for any help you can provide :) Matt. I have written a popular theme/template system for some CMS systems. In my opinion, templating is only needed for those that are totally ignorant of the concept of programming languages in general. I'm not sure... but I'm pretty sur eyou just called me ignorant. Blanket statements like that one above are themselves ignorant. Cheers, Rob. Well then you're ignorant because I didn't call you ignorant! Didn't you write your own template system? Seriously though, I should have worded that differently. I guess the second paragraph was more what I was after. But to clarify the first paragraph, I would suspect if they are anything like me, many of those that know and use PHP prefer to do control type things in PHP (loops, ifs, includes, etc.). I know I do. I like templating in that I use a template (HTML file) and add echos, or use simple templating logic so that {somevar} echoes $somevar, but why replicate what PHP can do with a separate language? To punt what is repeated over and over during runtime to a single compilation phase when building the template target. To simplify the use of parameters so that they can be used in arbitrary order with default values. To allow for the encapsulation of complex content in tag format that benefits from building at compile time and from being encapsulated in custom tags that integrate well with the rest of the HTML body. To remove the necessaity of constantly moving in and out of PHP tags. To speed up a site. To speed up development. To make easier to use for non-developers. To integrate standards compliance checks into the build phase. To do sooo many things that are just inconvenient and tedious using intermingled PHP code with fixed parameters order (or alternatively a big fugly array). Cheers, Rob. Is that it? -- 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] Re: Question about template systems
On Wed, 2009-03-04 at 12:46 -0600, Shawn McKenzie wrote: Robert Cummings wrote: On Wed, 2009-03-04 at 10:55 -0600, Shawn McKenzie wrote: Robert Cummings wrote: On Tue, 2009-03-03 at 21:18 -0600, Shawn McKenzie wrote: Matthew Croud wrote: Hello, First post here, I'm in the process of learning PHP , I'm digesting a few books as we speak. I'm working on a content heavy website that provides a lot of information, a template system would be great and so i've been looking at ways to create dynamic data with a static navigation system. So far, using the require_once(); function seems to fit the bill in order to bring in the same header html file on each page. I've also looked at Smartys template system. I wondered how you folk would go about creating a template system ? My second question might be me jumping the gun here, I haven't come across this part in my book but i'll ask about it anyway. I often see websites that have a dynamic body and static header, and their web addresses end like this: index.php?id=445 where 445 i presume is some my file reference. What is this called ? It seems like the system i'm after but it doesn't appear in my book, If anyone could let me know what this page id subject is called i can do some research on the subject. Thanks for any help you can provide :) Matt. I have written a popular theme/template system for some CMS systems. In my opinion, templating is only needed for those that are totally ignorant of the concept of programming languages in general. I'm not sure... but I'm pretty sur eyou just called me ignorant. Blanket statements like that one above are themselves ignorant. Cheers, Rob. Well then you're ignorant because I didn't call you ignorant! Didn't you write your own template system? Seriously though, I should have worded that differently. I guess the second paragraph was more what I was after. But to clarify the first paragraph, I would suspect if they are anything like me, many of those that know and use PHP prefer to do control type things in PHP (loops, ifs, includes, etc.). I know I do. I like templating in that I use a template (HTML file) and add echos, or use simple templating logic so that {somevar} echoes $somevar, but why replicate what PHP can do with a separate language? To punt what is repeated over and over during runtime to a single compilation phase when building the template target. To simplify the use of parameters so that they can be used in arbitrary order with default values. To allow for the encapsulation of complex content in tag format that benefits from building at compile time and from being encapsulated in custom tags that integrate well with the rest of the HTML body. To remove the necessaity of constantly moving in and out of PHP tags. To speed up a site. To speed up development. To make easier to use for non-developers. To integrate standards compliance checks into the build phase. To do sooo many things that are just inconvenient and tedious using intermingled PHP code with fixed parameters order (or alternatively a big fugly array). Cheers, Rob. Is that it? No... I could have gone on :) 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: Question about template systems
On Wed, Mar 4, 2009 at 11:51 AM, Robert Cummings rob...@interjinn.comwrote: On Wed, 2009-03-04 at 12:46 -0600, Shawn McKenzie wrote: Robert Cummings wrote: On Wed, 2009-03-04 at 10:55 -0600, Shawn McKenzie wrote: Robert Cummings wrote: On Tue, 2009-03-03 at 21:18 -0600, Shawn McKenzie wrote: Matthew Croud wrote: Hello, First post here, I'm in the process of learning PHP , I'm digesting a few books as we speak. I'm working on a content heavy website that provides a lot of information, a template system would be great and so i've been looking at ways to create dynamic data with a static navigation system. So far, using the require_once(); function seems to fit the bill in order to bring in the same header html file on each page. I've also looked at Smartys template system. I wondered how you folk would go about creating a template system ? My second question might be me jumping the gun here, I haven't come across this part in my book but i'll ask about it anyway. I often see websites that have a dynamic body and static header, and their web addresses end like this: index.php?id=445 where 445 i presume is some my file reference. What is this called ? It seems like the system i'm after but it doesn't appear in my book, If anyone could let me know what this page id subject is called i can do some research on the subject. Thanks for any help you can provide :) Matt. I have written a popular theme/template system for some CMS systems. In my opinion, templating is only needed for those that are totally ignorant of the concept of programming languages in general. I'm not sure... but I'm pretty sur eyou just called me ignorant. Blanket statements like that one above are themselves ignorant. Cheers, Rob. Well then you're ignorant because I didn't call you ignorant! Didn't you write your own template system? Seriously though, I should have worded that differently. I guess the second paragraph was more what I was after. But to clarify the first paragraph, I would suspect if they are anything like me, many of those that know and use PHP prefer to do control type things in PHP (loops, ifs, includes, etc.). I know I do. I like templating in that I use a template (HTML file) and add echos, or use simple templating logic so that {somevar} echoes $somevar, but why replicate what PHP can do with a separate language? To punt what is repeated over and over during runtime to a single compilation phase when building the template target. To simplify the use of parameters so that they can be used in arbitrary order with default values. To allow for the encapsulation of complex content in tag format that benefits from building at compile time and from being encapsulated in custom tags that integrate well with the rest of the HTML body. To remove the necessaity of constantly moving in and out of PHP tags. To speed up a site. To speed up development. To make easier to use for non-developers. To integrate standards compliance checks into the build phase. To do sooo many things that are just inconvenient and tedious using intermingled PHP code with fixed parameters order (or alternatively a big fugly array). Cheers, Rob. Is that it? No... I could have gone on :) a bit ot, but id like to ask about TemplateJinn, Rob. do you have to run the compile pass, or can it fall back to runtime content inclusion? and no, ive not yet finished, RTFM :) also, morbidly curious, have you looked at blitz; thoughts ? thx, -nathan
Re: [PHP] Re: Question about template systems
On Wed, 2009-03-04 at 12:15 -0700, Nathan Nobbe wrote: On Wed, Mar 4, 2009 at 11:51 AM, Robert Cummings rob...@interjinn.comwrote: On Wed, 2009-03-04 at 12:46 -0600, Shawn McKenzie wrote: Robert Cummings wrote: On Wed, 2009-03-04 at 10:55 -0600, Shawn McKenzie wrote: Robert Cummings wrote: On Tue, 2009-03-03 at 21:18 -0600, Shawn McKenzie wrote: Matthew Croud wrote: Hello, First post here, I'm in the process of learning PHP , I'm digesting a few books as we speak. I'm working on a content heavy website that provides a lot of information, a template system would be great and so i've been looking at ways to create dynamic data with a static navigation system. So far, using the require_once(); function seems to fit the bill in order to bring in the same header html file on each page. I've also looked at Smartys template system. I wondered how you folk would go about creating a template system ? My second question might be me jumping the gun here, I haven't come across this part in my book but i'll ask about it anyway. I often see websites that have a dynamic body and static header, and their web addresses end like this: index.php?id=445 where 445 i presume is some my file reference. What is this called ? It seems like the system i'm after but it doesn't appear in my book, If anyone could let me know what this page id subject is called i can do some research on the subject. Thanks for any help you can provide :) Matt. I have written a popular theme/template system for some CMS systems. In my opinion, templating is only needed for those that are totally ignorant of the concept of programming languages in general. I'm not sure... but I'm pretty sur eyou just called me ignorant. Blanket statements like that one above are themselves ignorant. Cheers, Rob. Well then you're ignorant because I didn't call you ignorant! Didn't you write your own template system? Seriously though, I should have worded that differently. I guess the second paragraph was more what I was after. But to clarify the first paragraph, I would suspect if they are anything like me, many of those that know and use PHP prefer to do control type things in PHP (loops, ifs, includes, etc.). I know I do. I like templating in that I use a template (HTML file) and add echos, or use simple templating logic so that {somevar} echoes $somevar, but why replicate what PHP can do with a separate language? To punt what is repeated over and over during runtime to a single compilation phase when building the template target. To simplify the use of parameters so that they can be used in arbitrary order with default values. To allow for the encapsulation of complex content in tag format that benefits from building at compile time and from being encapsulated in custom tags that integrate well with the rest of the HTML body. To remove the necessaity of constantly moving in and out of PHP tags. To speed up a site. To speed up development. To make easier to use for non-developers. To integrate standards compliance checks into the build phase. To do sooo many things that are just inconvenient and tedious using intermingled PHP code with fixed parameters order (or alternatively a big fugly array). Cheers, Rob. Is that it? No... I could have gone on :) a bit ot, but id like to ask about TemplateJinn, Rob. do you have to run the compile pass, or can it fall back to runtime content inclusion? and no, ive not yet finished, RTFM :) You can manually run the compile pass (one or more pages or entire site). Or if enabled via configuration it can automatically detect page dependency changes and recompile as necessary (great for development since reloading in browser causes auto recompile). On live servers I disable the auto compile option usually. The templates allow embedding PHP code if you so wish, so you could embed run-time includes if you wanted. Or you could create a tag that performs a run-time include... I've used both methods for different projects. Legacy code or non-native systems sometimes warrant chunking... so can compile content chunks that benefit from custom tags but can themselves be included at runtime via traditional include philosophies (header.php, footer.php, etc). I've done this for generating custom MediaWiki/WordPress layouts. It's very flexible... you can pretty much do what you want while benefitting from custom tag engine (you're not limited to tags btw, it provides a generic pre/post processing system that allows other stuff (I usually remove unnecessary whitespace at a post process stage and for some sites fire off a check on the W3C XHTML validator). also, morbidly curious, have you looked at blitz; thoughts ? I
Re: [PHP] Re: Question about template systems
Robert Cummings wrote: To punt what is repeated over and over during runtime to a single compilation phase when building the template target. To simplify the use of parameters so that they can be used in arbitrary order with default values. To allow for the encapsulation of complex content in tag format that benefits from building at compile time and from being encapsulated in custom tags that integrate well with the rest of the HTML body. I can't speak to those (and I have no opinion on template systems having never used any of them. To remove the necessaity of constantly moving in and out of PHP tags. php does not require that you constantly move in and out of PHP tags. There's at least one and possibly several pure php solutions that allow one to never write a line of html but get beautiful dynamic html output. To speed up a site. I'm curious about that one, how so? -=-=-=- And I've got a question. Part of my page involves dynamically generated JavaScript. The JavaScript will rarely change but it will change. By having php generate it, when my database is updated the js automatically will be too (yes I give the no-cache headers when sending the js. Actually I allow it to be cached for a day.) Switching between php and JavaScript really sucks - moreso than switching between php and html as it is much easier to get lost in which language mode you are in. Anyone know of a slick way to dynamically create javascript with php? One thought I had - if there was an xml way to describe javascript and a filter to then create the actual javascript from the xml, I could create the js as xml and run it through the filter when sent to the browser. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Question about template systems
On Wed, 2009-03-04 at 15:21 -0800, Michael A. Peters wrote: Robert Cummings wrote: To punt what is repeated over and over during runtime to a single compilation phase when building the template target. To simplify the use of parameters so that they can be used in arbitrary order with default values. To allow for the encapsulation of complex content in tag format that benefits from building at compile time and from being encapsulated in custom tags that integrate well with the rest of the HTML body. I can't speak to those (and I have no opinion on template systems having never used any of them. To remove the necessaity of constantly moving in and out of PHP tags. php does not require that you constantly move in and out of PHP tags. There's at least one and possibly several pure php solutions that allow one to never write a line of html but get beautiful dynamic html output. It doesn't require, but if you're not moving between them, then you're probably echoing your HTML, and that can be a maintenance nightmare. To speed up a site. I'm curious about that one, how so? What need not be rendered at runtime because it was rendered at compile time saves that exact amount of time per page. When you include your header, include your footer, include your sidepanel, etc... these are all run-time hits. Primary navigation, secondary navigation, top bar navigation, etc etc. These can all be pre-rendered and pre-rendered contextually for each page to indicate which menu item corresponds to the current page. Here's what I do for a menu: jinn:menu title= name=primary-nav accumulators=true expand=active item caption=Logout href=//logout.php testVisible=userIsLoggedIn() / item caption=Home href=//index.php matchActive=^index.php / item caption=Mandate href=//about-us/mandate/index.php matchActive=^about-us/mandate/ / item caption=Panel Members href=//about-us/panel-members/index.php matchActive=^about-us/panel-members/ / /jinn:menu That's how I do menus, the tags and CSS is all then generated at compile time. The match active regex is run at compile time against the page being generated. The only thing that gets executed at run-time is userIsLoggedIn() and that determines if the menu item is displayed, but all the tags and CSS classes have already been pre-generated from this very simple declaration. Similarly I have tags for embedding media, images, etc. When I include an image tag, at compile time the width and height of the image are determined and expanded into the HTML img tag. There's lots of things developers do that costs them on every page load. I punt the unnecessary stuff to the compile stage. For some pages, ones that don't require any PHP logic, I can output a static HTML page that never invokes the PHP parser, all with the same look and feel built at compile time. 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: Question about template systems
Robert Cummings wrote: On Wed, 2009-03-04 at 15:21 -0800, Michael A. Peters wrote: Robert Cummings wrote: To punt what is repeated over and over during runtime to a single compilation phase when building the template target. To simplify the use of parameters so that they can be used in arbitrary order with default values. To allow for the encapsulation of complex content in tag format that benefits from building at compile time and from being encapsulated in custom tags that integrate well with the rest of the HTML body. I can't speak to those (and I have no opinion on template systems having never used any of them. To remove the necessaity of constantly moving in and out of PHP tags. php does not require that you constantly move in and out of PHP tags. There's at least one and possibly several pure php solutions that allow one to never write a line of html but get beautiful dynamic html output. It doesn't require, but if you're not moving between them, then you're probably echoing your HTML, and that can be a maintenance nightmare. echoing html involves mixing html and php. Using an XML class (like DOMDocument) to build the document does not. To speed up a site. I'm curious about that one, how so? What need not be rendered at runtime because it was rendered at compile time saves that exact amount of time per page. When you include your header, include your footer, include your sidepanel, etc... these are all run-time hits. Primary navigation, secondary navigation, top bar navigation, etc etc. These can all be pre-rendered and pre-rendered contextually for each page to indicate which menu item corresponds to the current page. Here's what I do for a menu: Thanks! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Question about template systems
On Wed, Mar 4, 2009 at 7:01 PM, Michael A. Peters mpet...@mac.com wrote: Robert Cummings wrote: On Wed, 2009-03-04 at 15:21 -0800, Michael A. Peters wrote: Robert Cummings wrote: To punt what is repeated over and over during runtime to a single compilation phase when building the template target. To simplify the use of parameters so that they can be used in arbitrary order with default values. To allow for the encapsulation of complex content in tag format that benefits from building at compile time and from being encapsulated in custom tags that integrate well with the rest of the HTML body. I can't speak to those (and I have no opinion on template systems having never used any of them. To remove the necessaity of constantly moving in and out of PHP tags. php does not require that you constantly move in and out of PHP tags. There's at least one and possibly several pure php solutions that allow one to never write a line of html but get beautiful dynamic html output. It doesn't require, but if you're not moving between them, then you're probably echoing your HTML, and that can be a maintenance nightmare. echoing html involves mixing html and php. Using an XML class (like DOMDocument) to build the document does not. ive actually written a little templating system which subclasses SimpleXMLElement to achieve just that, take a peak at the syntax if you like (any feedback appreciated), http://nathan.moxune.com/phacadeDemo/ the syntax toward the bottom is what i really liked when i was starting out. the demo page is about as far as i got w/ it, though. what i ended up not liking about it, is how its joined at the hip w/ xml. suppose i want to template other things,.. css, js, php all come to mind. i could do that w/ pure php, and im sure any of these other systems such as smarty could let you template things beyond a subset of xml. what i like about this blitz module, and Rob's TemplateJinn, is an additional emphasis on performance. the other thing that i cant understand in general about templating is the whole notion of making things easier for so-called designers, ui folks or w/e, who arent used to 'code'. in my personal experience, i have yet to see anyone actually doing that right, or anything close to it in a real environment. im not trying to say there is one way and only one way to use a templating system, but im just saying that is a halmark benefit, which i dont think ive ever seen in practice.. what i see is programmers using them b/c they feel its hepling them separate presentation and logic. that said, i think folks really should look at what templating solutions are doing or can do in their environment. i dont know, most templating systems look pretty similar to me from a distance, smarty savant look fundamentally similar. you have a class which you populate with data, and then those are mapped into placeholders in template files. the rest of the differences seem skin deep to me, but if im missing something, id love to know. sorry for the rant, -nathan
[PHP] Re: Question about template systems
Matthew Croud napsal(a): Hello, First post here, I'm in the process of learning PHP , I'm digesting a few books as we speak. I'm working on a content heavy website that provides a lot of information, a template system would be great and so i've been looking at ways to create dynamic data with a static navigation system. So far, using the require_once(); function seems to fit the bill in order to bring in the same header html file on each page. I've also looked at Smartys template system. If you are looking for performance stick to Blitz PHP - the only true template system. Martin Thanks for any help you can provide :) Matt. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Question about template systems
On Tue, 2009-03-03 at 20:53 +0100, Martin Zvarík wrote: Matthew Croud napsal(a): Hello, First post here, I'm in the process of learning PHP , I'm digesting a few books as we speak. I'm working on a content heavy website that provides a lot of information, a template system would be great and so i've been looking at ways to create dynamic data with a static navigation system. So far, using the require_once(); function seems to fit the bill in order to bring in the same header html file on each page. I've also looked at Smartys template system. If you are looking for performance stick to Blitz PHP - the only true template system. Martin Thanks for any help you can provide :) Matt. For now, while you're learning about PHP, I'd use an existing template system and tweak it to your needs. As you learn more, and need something a little more bespoke, then you can look at making one yourself based on what you've learnt about the coding and about existing template systems. I've never used any myself, so I can't comment from first-hand experience, but perhaps the Wikipedia entry may be of some help: http://en.wikipedia.org/wiki/Template_engine_(web) Ash www.ashleysheridan.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Question about template systems
Matthew Croud wrote: Hello, First post here, I'm in the process of learning PHP , I'm digesting a few books as we speak. I'm working on a content heavy website that provides a lot of information, a template system would be great and so i've been looking at ways to create dynamic data with a static navigation system. So far, using the require_once(); function seems to fit the bill in order to bring in the same header html file on each page. I've also looked at Smartys template system. I wondered how you folk would go about creating a template system ? My second question might be me jumping the gun here, I haven't come across this part in my book but i'll ask about it anyway. I often see websites that have a dynamic body and static header, and their web addresses end like this: index.php?id=445 where 445 i presume is some my file reference. What is this called ? It seems like the system i'm after but it doesn't appear in my book, If anyone could let me know what this page id subject is called i can do some research on the subject. Thanks for any help you can provide :) Matt. I have written a popular theme/template system for some CMS systems. In my opinion, templating is only needed for those that are totally ignorant of the concept of programming languages in general. It helps for those designers that know HTML or they export their graphics as HTML and know enough to modify it or add some simple tags like {post-date} to HTML. That's it! No loops, no ifs, nothing. Simple things designers/users can add that represent some complex code, queries, etc... PHP IS a template language. You can easily separate your logic and design/display using PHP. Anything more than abstracting some complex code to some simple var is overkill. If you want to display a dropdown of categories, and the code needed is a database query and some PHP logic, etc., then it makes sense in my above scenario to do this in code and then assign the result to a template var like {categories-dropdown} that the designer/user can use in the HTML. Other than that its just waste. Smarty and similar template approaches just take PHP (but more limited) and make it look slightly different. Anyone who doesn't know or want to know anything about programming will not see the difference between PHP and Smarty. Consider the following: PHP: ?php echo $somevar; ? Smarty: {somevar} //oh except in your PHP you have to do the following //$smarty-assign('somevar', $somevar); //$smarty-display('some.tpl'); PHP: include('header.tpl'); Smarty: {include file=header.tpl} Don't even get me started on loops and conditionals. Smarty just replicates PHP, except it looks slightly different and is much less powerful. If you are confused with: if ($something) { echo Some stuff...; } else { echo Some other stuff...; } Why is this better: {if $something} Some stuff... {else} Some other stuff... {/if} Like I said earlier, if you have some complex code that you can reduce to a simple tag or something that a designer can insert into HTML then great. If not then it is just unsuccessfully trying to replicate PHP! -- Thanks! -Shawn http://www.spidean.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Question about template systems
Shawn McKenzie wrote: Matthew Croud wrote: Hello, First post here, I'm in the process of learning PHP , I'm digesting a few books as we speak. I'm working on a content heavy website that provides a lot of information, a template system would be great and so i've been looking at ways to create dynamic data with a static navigation system. So far, using the require_once(); function seems to fit the bill in order to bring in the same header html file on each page. I've also looked at Smartys template system. I wondered how you folk would go about creating a template system ? My second question might be me jumping the gun here, I haven't come across this part in my book but i'll ask about it anyway. I often see websites that have a dynamic body and static header, and their web addresses end like this: index.php?id=445 where 445 i presume is some my file reference. What is this called ? It seems like the system i'm after but it doesn't appear in my book, If anyone could let me know what this page id subject is called i can do some research on the subject. Thanks for any help you can provide :) Matt. I have written a popular theme/template system for some CMS systems. In my opinion, templating is only needed for those that are totally ignorant of the concept of programming languages in general. It helps for those designers that know HTML or they export their graphics as HTML and know enough to modify it or add some simple tags like {post-date} to HTML. That's it! No loops, no ifs, nothing. Simple things designers/users can add that represent some complex code, queries, etc... PHP IS a template language. You can easily separate your logic and design/display using PHP. Anything more than abstracting some complex code to some simple var is overkill. If you want to display a dropdown of categories, and the code needed is a database query and some PHP logic, etc., then it makes sense in my above scenario to do this in code and then assign the result to a template var like {categories-dropdown} that the designer/user can use in the HTML. Other than that its just waste. Smarty and similar template approaches just take PHP (but more limited) and make it look slightly different. Anyone who doesn't know or want to know anything about programming will not see the difference between PHP and Smarty. Consider the following: PHP: ?php echo $somevar; ? Smarty: {somevar} //oh except in your PHP you have to do the following //$smarty-assign('somevar', $somevar); //$smarty-display('some.tpl'); PHP: include('header.tpl'); Smarty: {include file=header.tpl} Don't even get me started on loops and conditionals. Smarty just replicates PHP, except it looks slightly different and is much less powerful. If you are confused with: if ($something) { echo Some stuff...; } else { echo Some other stuff...; } Why is this better: {if $something} Some stuff... {else} Some other stuff... {/if} Like I said earlier, if you have some complex code that you can reduce to a simple tag or something that a designer can insert into HTML then great. If not then it is just unsuccessfully trying to replicate PHP! Actually, I forgot myself and the alternative syntax: if($something): echo Some stuff...; else: echo Some other stuff...; endif; Hardly different... -- 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] Re: Question about template systems
Hi I think what you are looking for is static Header Footer and dynamic content. One way of doing this is by having the front controller pattern For example : consider the following list of files in your application 1000.php 2000.php 1001.php 3000.php In the front controller Pattern we usually have a only one file referenced all eth time and most of the times it is Index.php The code of your index.php file would be something like this require_once header.php; require_once $_GET['r']..php; require_once footer.php; once this is done. To access any of the above mentioned files your URL will be like this index.php?r=1000 or index.php?r=2000 or index.php?r=1001 etc The code given above is just the start point and is not secure enough and had a Code injection threat. However I think this is enough to get you started. You can do more research on what is Code Injection and how to avoid it. From: Shawn McKenzie [mailto:nos...@mckenzies.net] Sent: Wednesday, March 04, 2009 9:05 AM To: php-general@lists.php.net Subject: [PHP] Re: Question about template systems Shawn McKenzie wrote: Matthew Croud wrote: Hello, First post here, I'm in the process of learning PHP , I'm digesting a few books as we speak. I'm working on a content heavy website that provides a lot of information, a template system would be great and so i've been looking at ways to create dynamic data with a static navigation system. So far, using the require_once(); function seems to fit the bill in order to bring in the same header html file on each page. I've also looked at Smartys template system. I wondered how you folk would go about creating a template system ? My second question might be me jumping the gun here, I haven't come across this part in my book but i'll ask about it anyway. I often see websites that have a dynamic body and static header, and their web addresses end like this: index.php?id=445 where 445 i presume is some my file reference. What is this called ? It seems like the system i'm after but it doesn't appear in my book, If anyone could let me know what this page id subject is called i can do some research on the subject. Thanks for any help you can provide :) Matt. I have written a popular theme/template system for some CMS systems. In my opinion, templating is only needed for those that are totally ignorant of the concept of programming languages in general. It helps for those designers that know HTML or they export their graphics as HTML and know enough to modify it or add some simple tags like {post-date} to HTML. That's it! No loops, no ifs, nothing. Simple things designers/users can add that represent some complex code, queries, etc... PHP IS a template language. You can easily separate your logic and design/display using PHP. Anything more than abstracting some complex code to some simple var is overkill. If you want to display a dropdown of categories, and the code needed is a database query and some PHP logic, etc., then it makes sense in my above scenario to do this in code and then assign the result to a template var like {categories-dropdown} that the designer/user can use in the HTML. Other than that its just waste. Smarty and similar template approaches just take PHP (but more limited) and make it look slightly different. Anyone who doesn't know or want to know anything about programming will not see the difference between PHP and Smarty. Consider the following: PHP: ?php echo $somevar; ? Smarty: {somevar} //oh except in your PHP you have to do the following //$smarty-assign('somevar', $somevar); //$smarty-display('some.tpl'); PHP: include('header.tpl'); Smarty: {include file=header.tpl} Don't even get me started on loops and conditionals. Smarty just replicates PHP, except it looks slightly different and is much less powerful. If you are confused with: if ($something) { echo Some stuff...; } else { echo Some other stuff...; } Why is this better: {if $something} Some stuff... {else} Some other stuff... {/if} Like I said earlier, if you have some complex code that you can reduce to a simple tag or something that a designer can insert into HTML then great. If not then it is just unsuccessfully trying to replicate PHP! Actually, I forgot myself and the alternative syntax: if($something): echo Some stuff...; else: echo Some other stuff...; endif; Hardly different... -- Thanks! -Shawn http://www.spidean.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Question about version control.. sorta..
TG wrote: Ok.. so I know about CVS and SVN and unfortunately haven't had as much experience with them as I'd like. I've used them, but always in a really basic sense and always on systems that have already been set up. A friend recently mentioned GIT ( http://git.or.cz/ ) too. But here's my situation.. I deal with dozens of clients. I usually make a backup copy of their site (at least the files, not usually the DB) so I have the latest copy of the site to make changes to. Usually I'm the only one working on the site, but sometimes other people may make changes too. Not so often than we're conflicting with our changes, or if this is a known issue, we make sure to coordinate. What I'd ideally like to do is be able to use a CVS type system to keep incremental backups of the code. So instead of checking code out of CVS, changing it, then checking it back in... I'd like to just do a mass checkin of the whole site and have changes recorded and the ability to look at previous versions with DIFF and all that. And of course the ability to 'check out' a previous set of files by date or revision maybe. I assume you can do this with one of the major version control systems, but mostly what I see with how to use these systems involves checking code out then checking it back in. That's not really what I want to do. The other issue is that I run Windows. So if there's something nice and WinGUI, that'd be nice. Please no you should be running linux responses. I don't have anything against Linux or Mac, they're great systems. But I have my reasons for running Windows. Also, I realize this is semi-OT for a PHP list, but asking on a CVS list or a SVN list might not give me the more comprehensive/broad experience base I'm looking for. I'd like a semi-unbiased response. :) Thanks in advance! -TG Hi TG, I use svn (on windows and linux); and very happy with it :) Not sure if you already have an SVN server or not, if you don't best to get one installed on server somewhere I'd reckon. To use with windows you can get something like Tortoise SVN which integrates right in to the windows shell; updateing, commiting etc is as simple as a right click on a synchronised folder. http://tortoisesvn.tigris.org/ Personally though; I use eclipse as my IDE (on windows + linux), and let eclipse handle all my svn needs by way of Subversive SVN (kit and connectors from polarion); works a charm and keeps everything in the ide + caters for all the norms like importing, rolling back, diff etc etc - couldn't recommend it enough. Regards -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Question on if() priorities
Frank Stanovcak wrote: I can't seem to find a reference to this in the manual, but is there an order of precedence for and or xor in an if statement? Kind of like PPMDAS or polish notation for math (PPMDAS = Powers. Parenthacies. Multiplication...) I ask because this seems to be working for me, but I want to make sure it is doing what I think it is. (code follows) if((($FILTERED['cod1'] == 0) or ($FILTERED['cod1'] == 1)) and (($FILTERED['cod2'] == 0) or ($FILTERED['cod2'] == 2)) and (($FILTERED['cod3'] == 0) or ($FILTERED['cod3'] == 4))) (end code) which is if either of the first set, and either of the second set, and either of the third set is true return true. Thanks in advance! Frank http://nl.php.net/manual/en/language.operators.php#language.operators.precedence -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Question on if() priorities
Thanks. Don't know how I could have missed that. Maciek Sokolewicz tula...@php.net wrote in message news:49428d51.3090...@php.net... Frank Stanovcak wrote: I can't seem to find a reference to this in the manual, but is there an order of precedence for and or xor in an if statement? Kind of like PPMDAS or polish notation for math (PPMDAS = Powers. Parenthacies. Multiplication...) I ask because this seems to be working for me, but I want to make sure it is doing what I think it is. (code follows) if((($FILTERED['cod1'] == 0) or ($FILTERED['cod1'] == 1)) and (($FILTERED['cod2'] == 0) or ($FILTERED['cod2'] == 2)) and (($FILTERED['cod3'] == 0) or ($FILTERED['cod3'] == 4))) (end code) which is if either of the first set, and either of the second set, and either of the third set is true return true. Thanks in advance! Frank http://nl.php.net/manual/en/language.operators.php#language.operators.precedence -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: question on parameter specification in href tag
Hi, thanks for the quick solutions ! Regards Xaver Xaver Thum xaver.t...@t-online.de schrieb im Newsbeitrag news:9b.01.31950.6dbe0...@pb1.pair.com... Hi, I want to set a link like a href=http://www.anyurl.com?mypar=17color=red; ... into my HTML file; that works fine. But if I specify a hex color like #CC instead of red, a href=http://www.anyurl.com?mypar=17color=#CC; ... the color is ignored (probably because # starts a PHP comment). Is there any workaround for this problem ? Thanks and Regards Xaver -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Question about __destruct()
On 22 Oct 2008, at 00:22, Jochem Maas wrote: Stut schreef: I use destructors to update dirty objects in memcache. care to eloborate ... sounds interesting. Nothing complicated. The core objects in my application are all cached in memcache. If anything changes in an object it changes an internal flag to indicate that it's dirty. The destructor checks that flag and if the object is dirty it updates the cached version (the DB version having been updated as changes were made). I also use them in my template class to optionally automagically output the footer without needing an explicit call on each page. not sure if I find that of much use, I see the validity but 1 LOC to eplicitly output a page footer seems to me to be less of a wtf than an(other) bit of auto-magic to save what is probably a very short simple method call. It's one of the things that help to keep my controllers clean. The pattern goes something like this... $page = Layout::Create('style'); $page-title = 'This is the page title'; $page-keywords = 'shiny,happy,page'; $page-description = 'It\'s a shiny happy page.'; $page-Start(); $data = array(); // Business logic here populating $data with vars for the page template $page-Render('dir/to/template.tpl.php', $data); I've found that pattern works very well for me and not having to worry about calling a method to output the footer it just one feature of a very useful templating system. They're far from useless. true. but they are limited, there is no garantee any other object will still exist when a particular dtor is run [at shutdown] which means a heavy OO codebase cannot have object automated object interaction at shutdown ... there are other gotchas (e.g. closed file descriptors to STDIN/STDOUT) Agreed, you do need to be careful depending on what you want to achieve. You've gotta remember that PHP is not (yet) an OOP language at heart. interaction with memcache though is a really good example. and I'd like to learn a little more :-D And I hope you did ;) -Stut -- http://stut.net/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Question about __destruct()
Stut schreef: On 22 Oct 2008, at 00:22, Jochem Maas wrote: Stut schreef: I use destructors to update dirty objects in memcache. care to eloborate ... sounds interesting. Nothing complicated. The core objects in my application are all cached in memcache. If anything changes in an object it changes an internal flag to indicate that it's dirty. The destructor checks that flag and if the object is dirty it updates the cached version (the DB version having been updated as changes were made). aha, I see, I take it these data object first check memcache for their data before possibly making an attempt to hit the DB for data. in your experience would dumping a result set of 50-60 rows from mysql into memcache as a single entry be 'correct' - from my reading/playing with memcache I don't see an issue but I was wondering if you had an opinion on max. size of data for a single entry? I also use them in my template class to optionally automagically output the footer without needing an explicit call on each page. not sure if I find that of much use, I see the validity but 1 LOC to eplicitly output a page footer seems to me to be less of a wtf than an(other) bit of auto-magic to save what is probably a very short simple method call. It's one of the things that help to keep my controllers clean. The pattern goes something like this... $page = Layout::Create('style'); $page-title = 'This is the page title'; $page-keywords = 'shiny,happy,page'; $page-description = 'It\'s a shiny happy page.'; $page-Start(); $data = array(); // Business logic here populating $data with vars for the page template $page-Render('dir/to/template.tpl.php', $data); I've found that pattern works very well for me and not having to worry about calling a method to output the footer it just one feature of a very useful templating system. package it up and call it VUTS :-) They're far from useless. true. but they are limited, there is no garantee any other object will still exist when a particular dtor is run [at shutdown] which means a heavy OO codebase cannot have object automated object interaction at shutdown ... there are other gotchas (e.g. closed file descriptors to STDIN/STDOUT) Agreed, you do need to be careful depending on what you want to achieve. You've gotta remember that PHP is not (yet) an OOP language at heart. interaction with memcache though is a really good example. and I'd like to learn a little more :-D And I hope you did ;) yes, thanks for the info! -Stut -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Question about __destruct()
On Tue, Oct 21, 2008 at 5:14 PM, Stut [EMAIL PROTECTED] wrote: When a script ends everything is released (with some small exceptions), thus also all references to instances of classes. Thus AFAIK a deconstructor will always be called at the end of script execution. but you have no control over what order dtors are called and you can't make any assumptions about state of file handles to STDIN/STDOUT and things like that ... personally I find dtors run at end of script to be nigh on useless. I use destructors to update dirty objects in memcache. I also use them in my template class to optionally automagically output the footer without needing an explicit call on each page. Never any issues this way? They always run without a hitch? -- -Dan Joseph www.canishosting.com - Plans start @ $1.99/month. Build a man a fire, and he will be warm for the rest of the day. Light a man on fire, and will be warm for the rest of his life.
Re: [PHP] Re: Question about __destruct()
On Wed, Oct 22, 2008 at 9:42 AM, Dan Joseph [EMAIL PROTECTED] wrote: On Tue, Oct 21, 2008 at 5:14 PM, Stut [EMAIL PROTECTED] wrote: When a script ends everything is released (with some small exceptions), thus also all references to instances of classes. Thus AFAIK a deconstructor will always be called at the end of script execution. but you have no control over what order dtors are called and you can't make any assumptions about state of file handles to STDIN/STDOUT and things like that ... personally I find dtors run at end of script to be nigh on useless. I use destructors to update dirty objects in memcache. I also use them in my template class to optionally automagically output the footer without needing an explicit call on each page. Never any issues this way? They always run without a hitch? -- -Dan Joseph www.canishosting.com - Plans start @ $1.99/month. Build a man a fire, and he will be warm for the rest of the day. Light a man on fire, and will be warm for the rest of his life. Don't throw exceptions in your dtors. Hilarity will not ensue. There are some good use cases for them as others have stated, but I'd recommend staying away unless you really need it. I've only ever used dtors for closing query results and gd resources. Trivial stuff to just try and lower the memory usage but isn't really necessary. In general though I stay away from them as most of my code is front-end meaning everything is tore down at the end of the request anyways. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Question about __destruct()
On 22 Oct 2008, at 14:42, Dan Joseph wrote: On Tue, Oct 21, 2008 at 5:14 PM, Stut [EMAIL PROTECTED] wrote: When a script ends everything is released (with some small exceptions), thus also all references to instances of classes. Thus AFAIK a deconstructor will always be called at the end of script execution. but you have no control over what order dtors are called and you can't make any assumptions about state of file handles to STDIN/STDOUT and things like that ... personally I find dtors run at end of script to be nigh on useless. I use destructors to update dirty objects in memcache. I also use them in my template class to optionally automagically output the footer without needing an explicit call on each page. Never any issues this way? They always run without a hitch? Not had any issues to far, and it's being used on some pretty busy sites and various PHP versions and several different web servers. -Stut -- http://stut.net/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Question about __destruct()
On 22 Oct 2008, at 09:35, Jochem Maas wrote: Stut schreef: On 22 Oct 2008, at 00:22, Jochem Maas wrote: Stut schreef: I use destructors to update dirty objects in memcache. care to eloborate ... sounds interesting. Nothing complicated. The core objects in my application are all cached in memcache. If anything changes in an object it changes an internal flag to indicate that it's dirty. The destructor checks that flag and if the object is dirty it updates the cached version (the DB version having been updated as changes were made). aha, I see, I take it these data object first check memcache for their data before possibly making an attempt to hit the DB for data. in your experience would dumping a result set of 50-60 rows from mysql into memcache as a single entry be 'correct' - from my reading/ playing with memcache I don't see an issue but I was wondering if you had an opinion on max. size of data for a single entry? There is a size limit known as the slab size. I believe by default this is set to 1MB. The only thing to bear in mind is the network traffic you'll be creating when you store large objects. You need to weigh up the size against how often you'll be retrieving it. Personally, if I were anywhere over a few kB in a single entry I'd look at whether I really need everything in that entry each time or if it's possible to break it up into smaller pieces. I also use them in my template class to optionally automagically output the footer without needing an explicit call on each page. not sure if I find that of much use, I see the validity but 1 LOC to eplicitly output a page footer seems to me to be less of a wtf than an(other) bit of auto-magic to save what is probably a very short simple method call. It's one of the things that help to keep my controllers clean. The pattern goes something like this... $page = Layout::Create('style'); $page-title = 'This is the page title'; $page-keywords = 'shiny,happy,page'; $page-description = 'It\'s a shiny happy page.'; $page-Start(); $data = array(); // Business logic here populating $data with vars for the page template $page-Render('dir/to/template.tpl.php', $data); I've found that pattern works very well for me and not having to worry about calling a method to output the footer it just one feature of a very useful templating system. package it up and call it VUTS :-) SVUTS!!! They're far from useless. true. but they are limited, there is no garantee any other object will still exist when a particular dtor is run [at shutdown] which means a heavy OO codebase cannot have object automated object interaction at shutdown ... there are other gotchas (e.g. closed file descriptors to STDIN/STDOUT) Agreed, you do need to be careful depending on what you want to achieve. You've gotta remember that PHP is not (yet) an OOP language at heart. interaction with memcache though is a really good example. and I'd like to learn a little more :-D And I hope you did ;) yes, thanks for the info! Sharing is good mmm'kay! -Stut -- http://stut.net/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Question about __destruct()
On Wed, Oct 22, 2008 at 2:29 PM, Stut [EMAIL PROTECTED] wrote: Never any issues this way? They always run without a hitch? Not had any issues to far, and it's being used on some pretty busy sites and various PHP versions and several different web servers. Terrific! Thanks for the information! -- -Dan Joseph www.canishosting.com - Plans start @ $1.99/month. Build a man a fire, and he will be warm for the rest of the day. Light a man on fire, and will be warm for the rest of his life.
[PHP] Re: Question about __destruct()
Dan Joseph wrote: Hi, I want to make sure I completely understand __destruct() and when its hit... Understand that it will run if all references to a particular object are removed, but is that also true when a page ends its execution? Example, I call a database class. It constructs, connects, then my page pulls some stuff out of the database, and then the php script ends. Does this also cause the deconstruct to execute? When a script ends everything is released (with some small exceptions), thus also all references to instances of classes. Thus AFAIK a deconstructor will always be called at the end of script execution. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Question about __destruct()
Mike van Riel schreef: Dan Joseph wrote: Hi, I want to make sure I completely understand __destruct() and when its hit... Understand that it will run if all references to a particular object are removed, but is that also true when a page ends its execution? Example, I call a database class. It constructs, connects, then my page pulls some stuff out of the database, and then the php script ends. Does this also cause the deconstruct to execute? When a script ends everything is released (with some small exceptions), thus also all references to instances of classes. Thus AFAIK a deconstructor will always be called at the end of script execution. but you have no control over what order dtors are called and you can't make any assumptions about state of file handles to STDIN/STDOUT and things like that ... personally I find dtors run at end of script to be nigh on useless. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Question about __destruct()
On 21 Oct 2008, at 22:08, Jochem Maas wrote: Mike van Riel schreef: Dan Joseph wrote: Hi, I want to make sure I completely understand __destruct() and when its hit... Understand that it will run if all references to a particular object are removed, but is that also true when a page ends its execution? Example, I call a database class. It constructs, connects, then my page pulls some stuff out of the database, and then the php script ends. Does this also cause the deconstruct to execute? When a script ends everything is released (with some small exceptions), thus also all references to instances of classes. Thus AFAIK a deconstructor will always be called at the end of script execution. but you have no control over what order dtors are called and you can't make any assumptions about state of file handles to STDIN/STDOUT and things like that ... personally I find dtors run at end of script to be nigh on useless. I use destructors to update dirty objects in memcache. I also use them in my template class to optionally automagically output the footer without needing an explicit call on each page. They're far from useless. -Stut -- http://stut.net/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Question about __destruct()
Stut schreef: On 21 Oct 2008, at 22:08, Jochem Maas wrote: Mike van Riel schreef: Dan Joseph wrote: Hi, I want to make sure I completely understand __destruct() and when its hit... Understand that it will run if all references to a particular object are removed, but is that also true when a page ends its execution? Example, I call a database class. It constructs, connects, then my page pulls some stuff out of the database, and then the php script ends. Does this also cause the deconstruct to execute? When a script ends everything is released (with some small exceptions), thus also all references to instances of classes. Thus AFAIK a deconstructor will always be called at the end of script execution. but you have no control over what order dtors are called and you can't make any assumptions about state of file handles to STDIN/STDOUT and things like that ... personally I find dtors run at end of script to be nigh on useless. I use destructors to update dirty objects in memcache. care to eloborate ... sounds interesting. I also use them in my template class to optionally automagically output the footer without needing an explicit call on each page. not sure if I find that of much use, I see the validity but 1 LOC to eplicitly output a page footer seems to me to be less of a wtf than an(other) bit of auto-magic to save what is probably a very short simple method call. They're far from useless. true. but they are limited, there is no garantee any other object will still exist when a particular dtor is run [at shutdown] which means a heavy OO codebase cannot have object automated object interaction at shutdown ... there are other gotchas (e.g. closed file descriptors to STDIN/STDOUT) interaction with memcache though is a really good example. and I'd like to learn a little more :-D -Stut -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: question about EOF
On Tue, 30 Sep 2008 12:48:35 +0800, LKSunny wrote: i want on inner EOF do something, calculate and call function ? can not ? if yes, how to ? Same way as you do with strings. e.g. ?php class foo { function bar() { return 'world!'; } function hello() { echo ENDHELLO Hello, {$this-bar()} ENDHELLO; } } $foo = new foo(); $foo-hello(); ? -- Ross McKay, Toronto, NSW Australia Let the laddie play wi the knife - he'll learn - The Wee Book of Calvin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Question before I end up writing alot of extra code...
Jason Pruim wrote: Hi everyone! So it's been a nice long weekend, I come in to work and try and mess with a project that I'm working on to get some new features added. All was going well until I realized that now my application is breaking... Here's the details... PHP 5.2 MySQL 5.2 I store the info in the database which is submitted from a HTML form.. Some of it text boxes, some check boxes, some radio buttons... I $_POST the info from the form into the processing script. The problem I'm running into though, is when a value has not changed it doesn't get $_POSTed back and my update script erases the info in the database... I'm trying to avoid using $_GET since it can be quite a few variables. Is there anyway I can do it without comparing the original field to what I am displaying? -- Jason Pruim Raoset Inc. Technology Manager MQC Specialist 11287 James St Holland, MI 49424 www.raoset.com [EMAIL PROTECTED] I don't see how this happens unless you are using a blank form to update an existing record. -Shawn -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: question about validation and sql injection
Sudhakar wrote: A) validating username in php If you do what needs to be done to prevent sql injection, it doesn't matter what you let users have for their user name. B) preventing sql injection htmlentities this has nothing to do with sql injection it just is needed so when you print data to the screen that may include html entities, they display right. addslashes This is a generic way to escape things and is a bad idea since it doesn't know what system you are using for your DB so you can't be sure it does it right. trim This is handy when reading form data just so you don't store any extra spaces at the beginning and end of entries. Often users will inadvertently add a space to the end or have spaces the come in from copy and paste. Again nothing to do with sql injection. mysql-real-escape-string If you are using MySQL this is the only function you need to prevent sql injection. Simply run any variable that will be part of a query through this function and then put single quotes around all variables in your queries and sql injection will be a non issue. Example $UserName = mysql_real_escape_string($UserName); $query = SELECT * FROM `user` WHERE `UserName` = '$UserName' ; run the query and all will be good. Many add the password to the where clause too but I prefer to use a php if statement to be sure the comparison is case sensitive (depending on the Collation you use in MySQL your conditional tests may or may not be case sensitive). magic_quotes_gpc is ON If you can, you should have this off. In php 6 Off will be the only option. With it on it adds slashes in an attempt to do a generic escape of characters to prevent sql injection. Since you can't be sure that will work right, the best bet is to read in your form data like this $UserName = trim(stripslashes($_POST['UserName'])); I do the same thing for all data read from forms. Then before I use the var as part of a query, I use the mysql_real_escape_string function on it. The only exception is when I am expecting an integer returned from a form, in which case I use this... $Status = (int) $_POST['Status']; that way no mater what the user or some hacker tries to get in, I am sure $Status contains an integer and I don't need to bother with the mysql_real_escape_string on that var. If magic_quotes_gpc is off, you can and should remove the strip slashes function call. Note the only reason I use trim is to get rid of any white space that may be at the ends of the string. magic_quotes_runtime is OFF magic_quotes_sybase is OFF These should both be off too. -- Chris W KE5GIX Protect your digital freedom and privacy, eliminate DRM, learn more at http://www.defectivebydesign.org/what_is_drm; Ham Radio Repeater Database. http://hrrdb.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Question regarding fopen
Does anyone have an idea? Is this a bug in PHP? Because when I add or remove one static letter in the filename, it does work. And if I don't the file is created, but the $imgstr (random 8 characters) is replaced by a totally different value (also random 8 characters).. I have no idea where this new value comes from. regards, Joep 2008/4/29 Joep Roebroek [EMAIL PROTECTED]: Hi, I'm having a strange problem with fopen For clearence, here is the phpinfo page: http://www.grondengoed.nl/phpinfo.php I will shortly explain the problem I'm having: $imagenamesmall = $foldersystem . '/' . $id . $imgstr . '-s' . $i . '.jpg'; echo $imagenamesmall; // For debugging purposses -- returns exactly what I want. //attempt to create folder @mkdir($foldersystem); @chmod($foldersystem, 0777); //save picture if(!($handle = fopen($imagenamesmall, 'w'))){ echo Cannot open file (31); exit; } //$imagesmall, contains the image resource if(fwrite($handle, $imagesmall) === FALSE) { echo Cannot write to file (32); exit; } fclose($handle); Erverything works perfectly fine.But one thing, it doesn't give the file the name that it should get. A name for instance has to be: 54961tdtdtdtd-s0.jpg The number is the id of the database row, the 8 characters are random. -s stands for small and 0 is the picture index. When I echo the value, I get what I want. But when I save it, the random 8 character string had become a totally different 8 character string :S. I have googled and checked things over and over again, cost me hours and I still haven't found the reason. What is noticeable is that when I leave one character away from the name, the value IS what it schould be:S. I really hope you can help me, if you need further info yust ask. Thanks in advance. regards, Joep Roebroek -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Question regarding fopen
?php $foldersystem = getcwd().'/test1'; $id = '54961'; $imgstr = 'tdtdtdtd'; //uniqid(); $i = 2; $imagenamesmall = $foldersystem . '/' . $id . $imgstr . '-s' . $i . '.jpg'; echo $imagenamesmall; // For debugging purposses -- returns exactly what I want. //attempt to create folder mkdir($foldersystem); chmod($foldersystem, 0777); //save picture if(!($handle = fopen($imagenamesmall, 'w'))){ echo Cannot open file (31); exit; } This code works for me. How about you ? -- /James On Thu, May 1, 2008 at 11:04 AM, Joep Roebroek [EMAIL PROTECTED] wrote: Does anyone have an idea? Is this a bug in PHP? Because when I add or remove one static letter in the filename, it does work. And if I don't the file is created, but the $imgstr (random 8 characters) is replaced by a totally different value (also random 8 characters).. I have no idea where this new value comes from. regards, Joep 2008/4/29 Joep Roebroek [EMAIL PROTECTED]: Hi, I'm having a strange problem with fopen For clearence, here is the phpinfo page: http://www.grondengoed.nl/phpinfo.php I will shortly explain the problem I'm having: $imagenamesmall = $foldersystem . '/' . $id . $imgstr . '-s' . $i . '.jpg'; echo $imagenamesmall; // For debugging purposses -- returns exactly what I want. //attempt to create folder @mkdir($foldersystem); @chmod($foldersystem, 0777); //save picture if(!($handle = fopen($imagenamesmall, 'w'))){ echo Cannot open file (31); exit; } //$imagesmall, contains the image resource if(fwrite($handle, $imagesmall) === FALSE) { echo Cannot write to file (32); exit; } fclose($handle); Erverything works perfectly fine.But one thing, it doesn't give the file the name that it should get. A name for instance has to be: 54961tdtdtdtd-s0.jpg The number is the id of the database row, the 8 characters are random. -s stands for small and 0 is the picture index. When I echo the value, I get what I want. But when I save it, the random 8 character string had become a totally different 8 character string :S. I have googled and checked things over and over again, cost me hours and I still haven't found the reason. What is noticeable is that when I leave one character away from the name, the value IS what it schould be:S. I really hope you can help me, if you need further info yust ask. Thanks in advance. regards, Joep Roebroek -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Question regarding fopen
Strangely enough.. It does.. But I have also tried adding a letter (which gives me the good result) and then renaming it... But then the value is wrong again :S I've never had a problem like this.. Very strange.. 2008/5/1 James Dempster [EMAIL PROTECTED]: ?php $foldersystem = getcwd().'/test1'; $id = '54961'; $imgstr = 'tdtdtdtd'; //uniqid(); $i = 2; $imagenamesmall = $foldersystem . '/' . $id . $imgstr . '-s' . $i . '.jpg'; echo $imagenamesmall; // For debugging purposses -- returns exactly what I want. //attempt to create folder mkdir($foldersystem); chmod($foldersystem, 0777); //save picture if(!($handle = fopen($imagenamesmall, 'w'))){ echo Cannot open file (31); exit; } This code works for me. How about you ? -- /James On Thu, May 1, 2008 at 11:04 AM, Joep Roebroek [EMAIL PROTECTED] wrote: Does anyone have an idea? Is this a bug in PHP? Because when I add or remove one static letter in the filename, it does work. And if I don't the file is created, but the $imgstr (random 8 characters) is replaced by a totally different value (also random 8 characters).. I have no idea where this new value comes from. regards, Joep 2008/4/29 Joep Roebroek [EMAIL PROTECTED]: Hi, I'm having a strange problem with fopen For clearence, here is the phpinfo page: http://www.grondengoed.nl/phpinfo.php I will shortly explain the problem I'm having: $imagenamesmall = $foldersystem . '/' . $id . $imgstr . '-s' . $i . '.jpg'; echo $imagenamesmall; // For debugging purposses -- returns exactly what I want. //attempt to create folder @mkdir($foldersystem); @chmod($foldersystem, 0777); //save picture if(!($handle = fopen($imagenamesmall, 'w'))){ echo Cannot open file (31); exit; } //$imagesmall, contains the image resource if(fwrite($handle, $imagesmall) === FALSE) { echo Cannot write to file (32); exit; } fclose($handle); Erverything works perfectly fine.But one thing, it doesn't give the file the name that it should get. A name for instance has to be: 54961tdtdtdtd-s0.jpg The number is the id of the database row, the 8 characters are random. -s stands for small and 0 is the picture index. When I echo the value, I get what I want. But when I save it, the random 8 character string had become a totally different 8 character string :S. I have googled and checked things over and over again, cost me hours and I still haven't found the reason. What is noticeable is that when I leave one character away from the name, the value IS what it schould be:S. I really hope you can help me, if you need further info yust ask. Thanks in advance. regards, Joep Roebroek -- 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] Re: Question regarding fopen
Do you have a piece of example code that will reproduce the problem? -- /James On Thu, May 1, 2008 at 12:26 PM, Joep Roebroek [EMAIL PROTECTED] wrote: Strangely enough.. It does.. But I have also tried adding a letter (which gives me the good result) and then renaming it... But then the value is wrong again :S I've never had a problem like this.. Very strange.. 2008/5/1 James Dempster [EMAIL PROTECTED]: ?php $foldersystem = getcwd().'/test1'; $id = '54961'; $imgstr = 'tdtdtdtd'; //uniqid(); $i = 2; $imagenamesmall = $foldersystem . '/' . $id . $imgstr . '-s' . $i . '.jpg'; echo $imagenamesmall; // For debugging purposses -- returns exactly what I want. //attempt to create folder mkdir($foldersystem); chmod($foldersystem, 0777); //save picture if(!($handle = fopen($imagenamesmall, 'w'))){ echo Cannot open file (31); exit; } This code works for me. How about you ? -- /James On Thu, May 1, 2008 at 11:04 AM, Joep Roebroek [EMAIL PROTECTED] wrote: Does anyone have an idea? Is this a bug in PHP? Because when I add or remove one static letter in the filename, it does work. And if I don't the file is created, but the $imgstr (random 8 characters) is replaced by a totally different value (also random 8 characters).. I have no idea where this new value comes from. regards, Joep 2008/4/29 Joep Roebroek [EMAIL PROTECTED]: Hi, I'm having a strange problem with fopen For clearence, here is the phpinfo page: http://www.grondengoed.nl/phpinfo.php I will shortly explain the problem I'm having: $imagenamesmall = $foldersystem . '/' . $id . $imgstr . '-s' . $i . '.jpg'; echo $imagenamesmall; // For debugging purposses -- returns exactly what I want. //attempt to create folder @mkdir($foldersystem); @chmod($foldersystem, 0777); //save picture if(!($handle = fopen($imagenamesmall, 'w'))){ echo Cannot open file (31); exit; } //$imagesmall, contains the image resource if(fwrite($handle, $imagesmall) === FALSE) { echo Cannot write to file (32); exit; } fclose($handle); Erverything works perfectly fine.But one thing, it doesn't give the file the name that it should get. A name for instance has to be: 54961tdtdtdtd-s0.jpg The number is the id of the database row, the 8 characters are random. -s stands for small and 0 is the picture index. When I echo the value, I get what I want. But when I save it, the random 8 character string had become a totally different 8 character string :S. I have googled and checked things over and over again, cost me hours and I still haven't found the reason. What is noticeable is that when I leave one character away from the name, the value IS what it schould be:S. I really hope you can help me, if you need further info yust ask. Thanks in advance. regards, Joep Roebroek -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Question regarding fopen
This problem is getting stranger by the minute. I will explain in a little more detail what the script is actually for.. It is an advert site and per advert, you can add 5 photo's.. Now you set the $i = 2; When I set the $i (which indictates the index of the photo, so $i = 5; is the last photo) myself, it works.. But normally I get the $i from the database, because there is stored how many photo's the already are in the advert.. When I use that value it doesn't work at all. When i set $i = 2.. It works :S,, but when the value it gets from the db also is 2 than it doesn't work (it is like it just doesn't want me to get it working :P)... Reproduction would be very difficult, because it is in this very specific situation... Maybe I am able to give you access to the FTP but that is a bit risky for me, not that I don't trust you, but the website is not mine.. regards, Joep 2008/5/1 James Dempster [EMAIL PROTECTED]: Do you have a piece of example code that will reproduce the problem? -- /James On Thu, May 1, 2008 at 12:26 PM, Joep Roebroek [EMAIL PROTECTED] wrote: Strangely enough.. It does.. But I have also tried adding a letter (which gives me the good result) and then renaming it... But then the value is wrong again :S I've never had a problem like this.. Very strange.. 2008/5/1 James Dempster [EMAIL PROTECTED]: ?php $foldersystem = getcwd().'/test1'; $id = '54961'; $imgstr = 'tdtdtdtd'; //uniqid(); $i = 2; $imagenamesmall = $foldersystem . '/' . $id . $imgstr . '-s' . $i . '.jpg'; echo $imagenamesmall; // For debugging purposses -- returns exactly what I want. //attempt to create folder mkdir($foldersystem); chmod($foldersystem, 0777); //save picture if(!($handle = fopen($imagenamesmall, 'w'))){ echo Cannot open file (31); exit; } This code works for me. How about you ? -- /James On Thu, May 1, 2008 at 11:04 AM, Joep Roebroek [EMAIL PROTECTED] wrote: Does anyone have an idea? Is this a bug in PHP? Because when I add or remove one static letter in the filename, it does work. And if I don't the file is created, but the $imgstr (random 8 characters) is replaced by a totally different value (also random 8 characters).. I have no idea where this new value comes from. regards, Joep 2008/4/29 Joep Roebroek [EMAIL PROTECTED]: Hi, I'm having a strange problem with fopen For clearence, here is the phpinfo page: http://www.grondengoed.nl/phpinfo.php I will shortly explain the problem I'm having: $imagenamesmall = $foldersystem . '/' . $id . $imgstr . '-s' . $i . '.jpg'; echo $imagenamesmall; // For debugging purposses -- returns exactly what I want. //attempt to create folder @mkdir($foldersystem); @chmod($foldersystem, 0777); //save picture if(!($handle = fopen($imagenamesmall, 'w'))){ echo Cannot open file (31); exit; } //$imagesmall, contains the image resource if(fwrite($handle, $imagesmall) === FALSE) { echo Cannot write to file (32); exit; } fclose($handle); Erverything works perfectly fine.But one thing, it doesn't give the file the name that it should get. A name for instance has to be: 54961tdtdtdtd-s0.jpg The number is the id of the database row, the 8 characters are random. -s stands for small and 0 is the picture index. When I echo the value, I get what I want. But when I save it, the random 8 character string had become a totally different 8 character string :S. I have googled and checked things over and over again, cost me hours and I still haven't found the reason. What is noticeable is that when I leave one character away from the name, the value IS what it schould be:S. I really hope you can help me, if you need further info yust ask. Thanks in advance. regards, Joep Roebroek -- 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] Re: Question regarding fopen
Small correction $i = 4, means the last photo not 5.. Not so important but still.:P 2008/5/1 Joep Roebroek [EMAIL PROTECTED]: This problem is getting stranger by the minute. I will explain in a little more detail what the script is actually for.. It is an advert site and per advert, you can add 5 photo's.. Now you set the $i = 2; When I set the $i (which indictates the index of the photo, so $i = 5; is the last photo) myself, it works.. But normally I get the $i from the database, because there is stored how many photo's the already are in the advert.. When I use that value it doesn't work at all. When i set $i = 2.. It works :S,, but when the value it gets from the db also is 2 than it doesn't work (it is like it just doesn't want me to get it working :P)... Reproduction would be very difficult, because it is in this very specific situation... Maybe I am able to give you access to the FTP but that is a bit risky for me, not that I don't trust you, but the website is not mine.. regards, Joep 2008/5/1 James Dempster [EMAIL PROTECTED]: Do you have a piece of example code that will reproduce the problem? -- /James On Thu, May 1, 2008 at 12:26 PM, Joep Roebroek [EMAIL PROTECTED] wrote: Strangely enough.. It does.. But I have also tried adding a letter (which gives me the good result) and then renaming it... But then the value is wrong again :S I've never had a problem like this.. Very strange.. 2008/5/1 James Dempster [EMAIL PROTECTED]: ?php $foldersystem = getcwd().'/test1'; $id = '54961'; $imgstr = 'tdtdtdtd'; //uniqid(); $i = 2; $imagenamesmall = $foldersystem . '/' . $id . $imgstr . '-s' . $i . '.jpg'; echo $imagenamesmall; // For debugging purposses -- returns exactly what I want. //attempt to create folder mkdir($foldersystem); chmod($foldersystem, 0777); //save picture if(!($handle = fopen($imagenamesmall, 'w'))){ echo Cannot open file (31); exit; } This code works for me. How about you ? -- /James On Thu, May 1, 2008 at 11:04 AM, Joep Roebroek [EMAIL PROTECTED] wrote: Does anyone have an idea? Is this a bug in PHP? Because when I add or remove one static letter in the filename, it does work. And if I don't the file is created, but the $imgstr (random 8 characters) is replaced by a totally different value (also random 8 characters).. I have no idea where this new value comes from. regards, Joep 2008/4/29 Joep Roebroek [EMAIL PROTECTED]: Hi, I'm having a strange problem with fopen For clearence, here is the phpinfo page: http://www.grondengoed.nl/phpinfo.php I will shortly explain the problem I'm having: $imagenamesmall = $foldersystem . '/' . $id . $imgstr . '-s' . $i . '.jpg'; echo $imagenamesmall; // For debugging purposses -- returns exactly what I want. //attempt to create folder @mkdir($foldersystem); @chmod($foldersystem, 0777); //save picture if(!($handle = fopen($imagenamesmall, 'w'))){ echo Cannot open file (31); exit; } //$imagesmall, contains the image resource if(fwrite($handle, $imagesmall) === FALSE) { echo Cannot write to file (32); exit; } fclose($handle); Erverything works perfectly fine.But one thing, it doesn't give the file the name that it should get. A name for instance has to be: 54961tdtdtdtd-s0.jpg The number is the id of the database row, the 8 characters are random. -s stands for small and 0 is the picture index. When I echo the value, I get what I want. But when I save it, the random 8 character string had become a totally different 8 character string :S. I have googled and checked things over and over again, cost me hours and I still haven't found the reason. What is noticeable is that when I leave one character away from the name, the value IS what it schould be:S. I really hope you can help me, if you need further info yust ask. Thanks in advance. regards, Joep Roebroek -- 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:
[PHP] Re: question about linux editor
Sudhakar wrote: i need to connect to the linux server using an editor. can anyone suggest which would be an ideal linux editor to connect to the server. apart from the ip address, username and password are there any other details i would need to connect to the server. please advice. thanks. gedit -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: question about linux editor
On Tue, 25 Mar 2008 11:28:07 +0900, Sudhakar wrote: i need to connect to the linux server using an editor. can anyone suggest which would be an ideal linux editor to connect to the server. Geany - http://geany.uvena.de/ Also look at: Quanta Plus - http://quanta.kdewebdev.org/ Bluefish - http://bluefish.openoffice.nl/ Zend Studio (not free) - http://www.zend.com/en/products/studio/ apart from the ip address, username and password are there any other details i would need to connect to the server. How are you proposing to connect? e.g. * FTP down the files, edit them, FTP them up again * mount the remote server via NFS * mount the remote server locally via SFTP * run the editor remotely: ssh -Y [EMAIL PROTECTED] etc. A conventional way would be to have a development environment locally, into which you transfer the files from the Linux server, edit them, TEST! them, and transfer back the changes (e.g. via FTP). -- Ross McKay, Toronto, NSW Australia Let the laddie play wi the knife - he'll learn - The Wee Book of Calvin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: question about customized error
Sudhakar wrote: if a user by mistake types the wrong url directly in the address bar ex= www.website.com/abou.php instead of typing www.website.com/aboutus.php instead of the browser displaying File not found or a 404 error message i would like to display a customized page which will still have the same look and feel of my website in terms of the layout and i would like to a) display a message such as = Page could not be found and b) the url that the user originally typed should remain in the browser = I guess this would be the case anyway but i was wondering if something needs to be done in order to reatin the original address the user typed. Does this have to be done from apache perspective or can it be done using php. please suggest the procedure in either case apache OR php. please advice. thanks. .htaccess: ErrorDocument 404 /404-error.php 404-error.php: ?php soem code ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: question about direct access to url
Use sessions or (not as secure) pass a hidden form field along from form.php to thankyou.php. You can look for it in thankyou.php and if it's not there then you know something's wrong. You'd check the $_POST array for your secret field and value. \d -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Question about cURL, and iFrames...
Jason Pruim wrote: Happy friday to all of you! May the Beer[1] flow freely from the kegs to your lips after work! I am trying to think through something, I am writing a simple proxy script for my own knowledge and to simplify my life :) What I want to do is bring in multiple website by going to 1 webpage (Think RSS for the entire website) have all the links work properly, login to the pages etc. etc. etc. I think I can do this with cURL which can pull the page in and display it properly, but I'm wondering if I should be displaying in an iFrame to keep my navigation links at the top to go around my site? Another thing that I'm trying to figure out, is if you can automacially fill in usernames/passwords if you can find the name of the box it goes in? simply put... txtUsername = $_POST['Username']; will that fill it in on the remote site? Anyone ever done anything like this that I could look at some code for? I keep searching for stuff like PHP Proxy, and get all of these sites that ARE proxy's... Not quite what I want... Thanks for looking! [1]Or coke, Pepsi, Liquor, etc. etc. etc -- Jason Pruim Raoset Inc. Technology Manager MQC Specialist 3251 132nd ave Holland, MI, 49424 www.raoset.com [EMAIL PROTECTED] So it looks like iframes. That's the only way to not break links, images etc... -Shawn -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Question about development
Jason Pruim wrote: On Feb 12, 2008, at 1:03 PM, Nathan Rixham wrote: Jason Pruim wrote: Hi Everyone, I know this isn't 100% on topic... But when is any post to this list 100% on topic? :) I've been doing some googling trying to find info on how to plan for what a website needs. Stuff like Does it need a forum, live support, database driven etc. etc. Does anyone have a form that they use to give to the client asking them to outline some ideas that they have about the website? What I'm looking for is something that I could give to a potential client and ask them to describe some basic aspects of their target audience, a rough idea of what they want it to look like, or at least other sites that they like. Stuff like that.. Even if you don't have such a form, I'm sure you all have standard questions you ask each client before giving a quote :) Anyone want to share with the class? If there is interest, I may even put it together on a webpage to help future people :) -- Jason Pruim Raoset Inc. Technology Manager MQC Specialist 3251 132nd ave Holland, MI, 49424 www.raoset.com [EMAIL PROTECTED] I always take the simple approach, ask them what they want to achieve/expect from the website. Then verbally work backwards with them to figure out what the website needs in order to reach the clients goal. (personally) In all honesty I'd stay away from any kind of form, as they'll just pick nice to have boxes and end up with something overpriced, not suited to there needs and you'll get complaints in 6 months time. hope that makes sense! ps: the only thing I've found useful that way after many years, is to make the base site structure with very short text descriptions on each page + links to the next page | and for god sake, leave the home page will very very last! Nathan Hey Nathan, Thanks for the reply. I'm just getting more and more into freelance web work and have my first client asking for a quote. Before now, it's all been internal applications, and the companies website that I have worked on. Nothing for other people. I was actually thinking that the form would be for me to make sure I covered the basics... I'm alot better if I have something written down and I can ask the client Do you need to support multiple languages? Which to me then, would lead me into using a database[1] for storing the pages and using browser sniffing to find out what language preference they currently had selected to display in that language :) [1] As I was typing this I realized that maybe a database isn't the best idea for that, but it's the only way I can think of. Anyone who wants to give me another option is more then welcome to do so! -- Jason Pruim Raoset Inc. Technology Manager MQC Specialist 3251 132nd ave Holland, MI, 49424 www.raoset.com [EMAIL PROTECTED] --Email and Googletalk/Jabber IM ID. As to the multilingual; many approaches use defines for site words, buttons, links etc... but since you most likely keep dynamic content in the database then it makes sense to store the translations there too. Then you can build a management interface for the customer to add content and the associated translations. -Shawn -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Question about development
On Feb 12, 2008, at 4:24 PM, Daniel Brown wrote: On Feb 12, 2008 2:53 PM, Nathan Rixham [EMAIL PROTECTED] wrote: Browsers generally send the the HTTP_ACCEPT_LANGUAGE header in a request. $_SERVER[HTTP_ACCEPT_LANGUAGE] = en-gb,en;q=0.5 thus with mine, preference is en-gb, failing that anything en; failing that whatever you've got. ACCEPT_CHARSET is worth a check often aswell; finally POST requests can also have a CONTENT_LANGUAGE specified which describes the lang of the content. Yes, but as has been said in the past, you can't rely on browser headers, because they can easily be forged. ;-P I can see it now That'll mess with them. Now they'll think I'm Mexican! Which goes back to giving them an easy way of changing the display language :P If someone intentionally messes with the language headers they deserve to get a language they may or may not know! :P -- Jason Pruim Raoset Inc. Technology Manager MQC Specialist 3251 132nd ave Holland, MI, 49424 www.raoset.com [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Question about development
Jason, If you don't mind I may give you an email off the list in a moment to brain storm up a quick list of questions to ask clients and indeed client gotchas. For the time being as this seems to be going down the line of how to handle multilingual sites here's my two pennies. XML, store everything in XML, that way I can store extra info specific to the files in there aswell. A quick XPath query [lang=en-gb] and I've got the content I need. To get around the search thing I generally store a plain text version of the content in a single table, with the key being a geometry column to keep things working ultra fast. But.. I'm still experimenting - sure xml is the way forwards.. Nathan Aleksandar Vojnovic wrote: Could you explain this a little better - ...into using a database[1] for storing the pages and using browser sniffing to find out what language preference they currently had selected to display in that language? Aleksandar Quoting Jason Pruim [EMAIL PROTECTED]: On Feb 12, 2008, at 1:03 PM, Nathan Rixham wrote: Jason Pruim wrote: Hi Everyone, I know this isn't 100% on topic... But when is any post to this list 100% on topic? :) I've been doing some googling trying to find info on how to plan for what a website needs. Stuff like Does it need a forum, live support, database driven etc. etc. Does anyone have a form that they use to give to the client asking them to outline some ideas that they have about the website? What I'm looking for is something that I could give to a potential client and ask them to describe some basic aspects of their target audience, a rough idea of what they want it to look like, or at least other sites that they like. Stuff like that.. Even if you don't have such a form, I'm sure you all have standard questions you ask each client before giving a quote :) Anyone want to share with the class? If there is interest, I may even put it together on a webpage to help future people :) -- Jason Pruim Raoset Inc. Technology Manager MQC Specialist 3251 132nd ave Holland, MI, 49424 www.raoset.com [EMAIL PROTECTED] I always take the simple approach, ask them what they want to achieve/expect from the website. Then verbally work backwards with them to figure out what the website needs in order to reach the clients goal. (personally) In all honesty I'd stay away from any kind of form, as they'll just pick nice to have boxes and end up with something overpriced, not suited to there needs and you'll get complaints in 6 months time. hope that makes sense! ps: the only thing I've found useful that way after many years, is to make the base site structure with very short text descriptions on each page + links to the next page | and for god sake, leave the home page will very very last! Nathan Hey Nathan, Thanks for the reply. I'm just getting more and more into freelance web work and have my first client asking for a quote. Before now, it's all been internal applications, and the companies website that I have worked on. Nothing for other people. I was actually thinking that the form would be for me to make sure I covered the basics... I'm alot better if I have something written down and I can ask the client Do you need to support multiple languages? Which to me then, would lead me into using a database[1] for storing the pages and using browser sniffing to find out what language preference they currently had selected to display in that language :) [1] As I was typing this I realized that maybe a database isn't the best idea for that, but it's the only way I can think of. Anyone who wants to give me another option is more then welcome to do so! -- Jason Pruim Raoset Inc. Technology Manager MQC Specialist 3251 132nd ave Holland, MI, 49424 www.raoset.com [EMAIL PROTECTED] --Email and Googletalk/Jabber IM ID. -- 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] Re: Question about development
On Feb 12, 2008, at 2:09 PM, Aleksandar Vojnovic wrote: Could you explain this a little better - ...into using a database[1] for storing the pages and using browser sniffing to find out what language preference they currently had selected to display in that language? Aleksandar I'll try my best to :) I have heard from people (Haven't done it my self) that it is possible and reliable, to use the browsers language setting which gets transmitted in one of the headers (Not sure which one off hand) to initially select the language for the site from your database. IE: If you speak english, and have english selected as your browser language preference, it will send that to the server, when your script sees it, it's a fairly good assumption that that would be the preferred language to display in, so the server pushes up the english version of the site. Obviously, you need to have the actual translated files stored on your server to choose from. And, you should always give them away of overriding the guessed option, just in case they really don't want to use what it appears like they do :) Does that explain it better? -- Jason Pruim Raoset Inc. Technology Manager MQC Specialist 3251 132nd ave Holland, MI, 49424 www.raoset.com [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Question about development
Jason Pruim [EMAIL PROTECTED] wrote: On Feb 12, 2008, at 1:03 PM, Nathan Rixham wrote: Jason Pruim wrote: Hi Everyone, I know this isn't 100% on topic... But when is any post to this list 100% on topic? :) I've been doing some googling trying to find info on how to plan for what a website needs. Stuff like Does it need a forum, live support, database driven etc. etc. Does anyone have a form that they use to give to the client asking them to outline some ideas that they have about the website? What I'm looking for is something that I could give to a potential client and ask them to describe some basic aspects of their target audience, a rough idea of what they want it to look like, or at least other sites that they like. Stuff like that.. Even if you don't have such a form, I'm sure you all have standard questions you ask each client before giving a quote :) Anyone want to share with the class? If there is interest, I may even put it together on a webpage to help future people :) -- Jason Pruim Raoset Inc. Technology Manager MQC Specialist 3251 132nd ave Holland, MI, 49424 www.raoset.com [EMAIL PROTECTED] I always take the simple approach, ask them what they want to achieve/expect from the website. Then verbally work backwards with them to figure out what the website needs in order to reach the clients goal. (personally) In all honesty I'd stay away from any kind of form, as they'll just pick nice to have boxes and end up with something overpriced, not suited to there needs and you'll get complaints in 6 months time. hope that makes sense! ps: the only thing I've found useful that way after many years, is to make the base site structure with very short text descriptions on each page + links to the next page | and for god sake, leave the home page will very very last! Nathan Hey Nathan, Thanks for the reply. I'm just getting more and more into freelance web work and have my first client asking for a quote. Before now, it's all been internal applications, and the companies website that I have worked on. Nothing for other people. I was actually thinking that the form would be for me to make sure I covered the basics... I'm alot better if I have something written down and I can ask the client Do you need to support multiple languages? Which to me then, would lead me into using a database[1] for storing the pages and using browser sniffing to find out what language preference they currently had selected to display in that language :) [1] As I was typing this I realized that maybe a database isn't the best idea for that, but it's the only way I can think of. Anyone who wants to give me another option is more then welcome to do so! -- Jason Pruim Raoset Inc. Technology Manager MQC Specialist 3251 132nd ave Holland, MI, 49424 www.raoset.com [EMAIL PROTECTED] --Email and Googletalk/Jabber IM ID. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php I generally ask people what they are looking to do with the site. Are they just wanting to have an image out there, do they want a contact form, do they want to sell something, do they really care to translate it (blowfish), Then I go into how much $$$ do they want to spend, do they want to update it themselves, how they have worked on it in the past, etc. Generally that alone gives me a good base point. But I'm scatter-brained enough that I just write things down as we talk and that leads me to more questions to ask them. :) Wolf -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Question about development
Could you explain this a little better - ...into using a database[1] for storing the pages and using browser sniffing to find out what language preference they currently had selected to display in that language? Aleksandar Quoting Jason Pruim [EMAIL PROTECTED]: On Feb 12, 2008, at 1:03 PM, Nathan Rixham wrote: Jason Pruim wrote: Hi Everyone, I know this isn't 100% on topic... But when is any post to this list 100% on topic? :) I've been doing some googling trying to find info on how to plan for what a website needs. Stuff like Does it need a forum, live support, database driven etc. etc. Does anyone have a form that they use to give to the client asking them to outline some ideas that they have about the website? What I'm looking for is something that I could give to a potential client and ask them to describe some basic aspects of their target audience, a rough idea of what they want it to look like, or at least other sites that they like. Stuff like that.. Even if you don't have such a form, I'm sure you all have standard questions you ask each client before giving a quote :) Anyone want to share with the class? If there is interest, I may even put it together on a webpage to help future people :) -- Jason Pruim Raoset Inc. Technology Manager MQC Specialist 3251 132nd ave Holland, MI, 49424 www.raoset.com [EMAIL PROTECTED] I always take the simple approach, ask them what they want to achieve/expect from the website. Then verbally work backwards with them to figure out what the website needs in order to reach the clients goal. (personally) In all honesty I'd stay away from any kind of form, as they'll just pick nice to have boxes and end up with something overpriced, not suited to there needs and you'll get complaints in 6 months time. hope that makes sense! ps: the only thing I've found useful that way after many years, is to make the base site structure with very short text descriptions on each page + links to the next page | and for god sake, leave the home page will very very last! Nathan Hey Nathan, Thanks for the reply. I'm just getting more and more into freelance web work and have my first client asking for a quote. Before now, it's all been internal applications, and the companies website that I have worked on. Nothing for other people. I was actually thinking that the form would be for me to make sure I covered the basics... I'm alot better if I have something written down and I can ask the client Do you need to support multiple languages? Which to me then, would lead me into using a database[1] for storing the pages and using browser sniffing to find out what language preference they currently had selected to display in that language :) [1] As I was typing this I realized that maybe a database isn't the best idea for that, but it's the only way I can think of. Anyone who wants to give me another option is more then welcome to do so! -- Jason Pruim Raoset Inc. Technology Manager MQC Specialist 3251 132nd ave Holland, MI, 49424 www.raoset.com [EMAIL PROTECTED] --Email and Googletalk/Jabber IM ID. -- 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] Re: Question about development
On Feb 12, 2008, at 1:03 PM, Nathan Rixham wrote: Jason Pruim wrote: Hi Everyone, I know this isn't 100% on topic... But when is any post to this list 100% on topic? :) I've been doing some googling trying to find info on how to plan for what a website needs. Stuff like Does it need a forum, live support, database driven etc. etc. Does anyone have a form that they use to give to the client asking them to outline some ideas that they have about the website? What I'm looking for is something that I could give to a potential client and ask them to describe some basic aspects of their target audience, a rough idea of what they want it to look like, or at least other sites that they like. Stuff like that.. Even if you don't have such a form, I'm sure you all have standard questions you ask each client before giving a quote :) Anyone want to share with the class? If there is interest, I may even put it together on a webpage to help future people :) -- Jason Pruim Raoset Inc. Technology Manager MQC Specialist 3251 132nd ave Holland, MI, 49424 www.raoset.com [EMAIL PROTECTED] I always take the simple approach, ask them what they want to achieve/expect from the website. Then verbally work backwards with them to figure out what the website needs in order to reach the clients goal. (personally) In all honesty I'd stay away from any kind of form, as they'll just pick nice to have boxes and end up with something overpriced, not suited to there needs and you'll get complaints in 6 months time. hope that makes sense! ps: the only thing I've found useful that way after many years, is to make the base site structure with very short text descriptions on each page + links to the next page | and for god sake, leave the home page will very very last! Nathan Hey Nathan, Thanks for the reply. I'm just getting more and more into freelance web work and have my first client asking for a quote. Before now, it's all been internal applications, and the companies website that I have worked on. Nothing for other people. I was actually thinking that the form would be for me to make sure I covered the basics... I'm alot better if I have something written down and I can ask the client Do you need to support multiple languages? Which to me then, would lead me into using a database[1] for storing the pages and using browser sniffing to find out what language preference they currently had selected to display in that language :) [1] As I was typing this I realized that maybe a database isn't the best idea for that, but it's the only way I can think of. Anyone who wants to give me another option is more then welcome to do so! -- Jason Pruim Raoset Inc. Technology Manager MQC Specialist 3251 132nd ave Holland, MI, 49424 www.raoset.com [EMAIL PROTECTED] --Email and Googletalk/Jabber IM ID. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Question about development
Jason Pruim wrote: Hi Everyone, I know this isn't 100% on topic... But when is any post to this list 100% on topic? :) I've been doing some googling trying to find info on how to plan for what a website needs. Stuff like Does it need a forum, live support, database driven etc. etc. Does anyone have a form that they use to give to the client asking them to outline some ideas that they have about the website? What I'm looking for is something that I could give to a potential client and ask them to describe some basic aspects of their target audience, a rough idea of what they want it to look like, or at least other sites that they like. Stuff like that.. Even if you don't have such a form, I'm sure you all have standard questions you ask each client before giving a quote :) Anyone want to share with the class? If there is interest, I may even put it together on a webpage to help future people :) -- Jason Pruim Raoset Inc. Technology Manager MQC Specialist 3251 132nd ave Holland, MI, 49424 www.raoset.com [EMAIL PROTECTED] I always take the simple approach, ask them what they want to achieve/expect from the website. Then verbally work backwards with them to figure out what the website needs in order to reach the clients goal. (personally) In all honesty I'd stay away from any kind of form, as they'll just pick nice to have boxes and end up with something overpriced, not suited to there needs and you'll get complaints in 6 months time. hope that makes sense! ps: the only thing I've found useful that way after many years, is to make the base site structure with very short text descriptions on each page + links to the next page | and for god sake, leave the home page will very very last! Nathan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Question about development
On Feb 12, 2008 2:53 PM, Nathan Rixham [EMAIL PROTECTED] wrote: Browsers generally send the the HTTP_ACCEPT_LANGUAGE header in a request. $_SERVER[HTTP_ACCEPT_LANGUAGE] = en-gb,en;q=0.5 thus with mine, preference is en-gb, failing that anything en; failing that whatever you've got. ACCEPT_CHARSET is worth a check often aswell; finally POST requests can also have a CONTENT_LANGUAGE specified which describes the lang of the content. Yes, but as has been said in the past, you can't rely on browser headers, because they can easily be forged. ;-P I can see it now That'll mess with them. Now they'll think I'm Mexican! -- /Dan Daniel P. Brown Senior Unix Geek ? while(1) { $me = $mind--; sleep(86400); } ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Question about development
Jason Pruim wrote: On Feb 12, 2008, at 2:09 PM, Aleksandar Vojnovic wrote: Could you explain this a little better - ...into using a database[1] for storing the pages and using browser sniffing to find out what language preference they currently had selected to display in that language? Aleksandar I'll try my best to :) I have heard from people (Haven't done it my self) that it is possible and reliable, to use the browsers language setting which gets transmitted in one of the headers (Not sure which one off hand) to initially select the language for the site from your database. IE: If you speak english, and have english selected as your browser language preference, it will send that to the server, when your script sees it, it's a fairly good assumption that that would be the preferred language to display in, so the server pushes up the english version of the site. Obviously, you need to have the actual translated files stored on your server to choose from. And, you should always give them away of overriding the guessed option, just in case they really don't want to use what it appears like they do :) Does that explain it better? -- Jason Pruim Raoset Inc. Technology Manager MQC Specialist 3251 132nd ave Holland, MI, 49424 www.raoset.com [EMAIL PROTECTED] Browsers generally send the the HTTP_ACCEPT_LANGUAGE header in a request. $_SERVER[HTTP_ACCEPT_LANGUAGE] = en-gb,en;q=0.5 thus with mine, preference is en-gb, failing that anything en; failing that whatever you've got. ACCEPT_CHARSET is worth a check often aswell; finally POST requests can also have a CONTENT_LANGUAGE specified which describes the lang of the content. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Question about development
On Tue, February 12, 2008 3:32 pm, Jason Pruim wrote: On Feb 12, 2008, at 4:24 PM, Daniel Brown wrote: On Feb 12, 2008 2:53 PM, Nathan Rixham [EMAIL PROTECTED] wrote: Browsers generally send the the HTTP_ACCEPT_LANGUAGE header in a request. $_SERVER[HTTP_ACCEPT_LANGUAGE] = en-gb,en;q=0.5 thus with mine, preference is en-gb, failing that anything en; failing that whatever you've got. ACCEPT_CHARSET is worth a check often aswell; finally POST requests can also have a CONTENT_LANGUAGE specified which describes the lang of the content. Yes, but as has been said in the past, you can't rely on browser headers, because they can easily be forged. ;-P I can see it now That'll mess with them. Now they'll think I'm Mexican! Which goes back to giving them an easy way of changing the display language :P If someone intentionally messes with the language headers they deserve to get a language they may or may not know! :P I was at an internet cafe in Paris once. Despite having a French keyboard layout and a browser sending fr as my preferred language, my French language skills were no better than when I walked in... :-) -- Some people have a gift link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Question about functions
Jason Pruim wrote: Hi everyone! So, I'm trying to learn about functions, and I think I understand what to use them for... And one of the ideas I had was to write a function to logout of an application. The question I have though, is how do I call it? Right now I just have a link like this: A href=logout.phpClick here to logout/A Can I do the same thing with a function? And if so, then maybe I don't really understand functions like I thought I did... Because to me, that would look like it would be just the same as calling a single script to logout vs. a function? -- Jason Pruim Raoset Inc. Technology Manager MQC Specialist 3251 132nd ave Holland, MI, 49424 www.raoset.com [EMAIL PROTECTED] Functions basically save you repeating code; for example, let's say we have these lines of code in 10 scripts on our website: if(isset($_GET['pageid']) trim($_GET['pageid'])) { $pageid = trim($_GET['pageid']); } else { $pageid = '1'; } you could wrap this code up in a function as such: function get_pageid() { if(isset($_GET['pageid']) trim($_GET['pageid'])) { $pageid = trim($_GET['pageid']); } else { $pageid = '1'; } return $pageid; } save that function (along with other functions you've made) in an php file (example: myfunctions.php) then in every script we simply include our functions file and call our function(s) as and when we need them: scripta.php: ?php include 'myfunctions.php'; $pageid = get_pageid(); //more code ? I'm no technical writer but I think that about sums it up. Nathan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Question About Blocking Email Addresses in Forms
Richard Lynch wrote: On Fri, January 18, 2008 10:41 am, Per Jessen wrote: 2. check that the domain exists and has an MX. I believe this will foul you up... I *think* many domains just use their regular domain as MX if there is no MX. We've been using the method on public forms for at least 3 years with no issues. I have yet to come across a domain that actually does not have an MX record and just relies on the default working. But if it should ever become a problem, the check is easily changed to look for an A-record, which IS required for email-delivery. And the Bad Guy can easily change tactics to use [EMAIL PROTECTED] or whatever, once they figure out you only check for MX records... Though it could work as a stop-gap measure at least. Sure - my two-step validation without CAPTCHA is minimal effort, but that's good enough for me for the time being. /Per Jessen, Zürich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Question About Blocking Email Addresses in Forms
Thanks for all of your suggestions which all point to using Catpcha. I have actually already implemented Capchta and they are still getting around it. Even if they are entering it manually rather than via a bot, is there a way to check if the email address is of a specific format and if so then don't process the form? Javier Huerta [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] I am wondering if there is a way to block out email addresses in specific format from a form? We ahve a form that people have to enter an email address, and the form has been getting used by bots to send spam to a listserv. The email address they enter is in this type of format [EMAIL PROTECTED], and of course it is always just a bit different every time. Any help is greatly appreciated. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Question About Blocking Email Addresses in Forms
On Jan 18, 2008 10:55 AM, Javier Huerta [EMAIL PROTECTED] wrote: Thanks for all of your suggestions which all point to using Catpcha. I have actually already implemented Capchta and they are still getting around it. Even if they are entering it manually rather than via a bot, is there a way to check if the email address is of a specific format and if so then don't process the form? Javier Huerta [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] I am wondering if there is a way to block out email addresses in specific format from a form? We ahve a form that people have to enter an email address, and the form has been getting used by bots to send spam to a listserv. The email address they enter is in this type of format [EMAIL PROTECTED], and of course it is always just a bit different every time. Any help is greatly appreciated. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php If a human is involved you can't really do anything about it other than slow them down. If they're doing this a lot you can implement some backend server tracking. It is really hit and miss, but you can try tracking by IP, but proxies make this fail. You can also make sure that you require sessions. That might help a bit but a user can always clear their cookies. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Question About Blocking Email Addresses in Forms
Hello, on 01/18/2008 01:55 PM Javier Huerta said the following: Thanks for all of your suggestions which all point to using Catpcha. I have actually already implemented Capchta and they are still getting around it. Even if they are entering it manually rather than via a bot, is there a way to check if the email address is of a specific format and if so then don't process the form? Sure. If you just want to block addresses of some domains, you do not even need to use regular expressions. Try something like this: $block = 'jhgfghjk.com'; $email = $_POST['email']; if(substr($email, -strlen($block)) === $block) { do whatever you want to not accept this address; } If you iterate this code over a list of blocked domains taken from an array, you have implemented a generalized black list. -- Regards, Manuel Lemos PHP professionals looking for PHP jobs http://www.phpclasses.org/professionals/ PHP Classes - Free ready to use OOP components written in PHP http://www.phpclasses.org/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Question About Blocking Email Addresses in Forms
On 18 Jan 2008, at 16:01, Eric Butera wrote: On Jan 18, 2008 10:55 AM, Javier Huerta [EMAIL PROTECTED] wrote: Thanks for all of your suggestions which all point to using Catpcha. I have actually already implemented Capchta and they are still getting around it. Even if they are entering it manually rather than via a bot, is there a way to check if the email address is of a specific format and if so then don't process the form? What does your form actually do? Does it email you, email them, stick something in a DB? What? Regardless, if they're entering a nonsense email address and are managing to get your script to email other people then you're not validating the inputs correctly. For example, are you checking that the email address does not contain carriage returns or line feeds? Same with the subject if your form includes that. Anything that comes from the form and ends up in the email headers needs to be checked in this way. The answer to your question is only if you can define the format precisely enough. -Stut -- http://stut.net/ Javier Huerta [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] I am wondering if there is a way to block out email addresses in specific format from a form? We ahve a form that people have to enter an email address, and the form has been getting used by bots to send spam to a listserv. The email address they enter is in this type of format [EMAIL PROTECTED], and of course it is always just a bit different every time. Any help is greatly appreciated. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php If a human is involved you can't really do anything about it other than slow them down. If they're doing this a lot you can implement some backend server tracking. It is really hit and miss, but you can try tracking by IP, but proxies make this fail. You can also make sure that you require sessions. That might help a bit but a user can always clear their cookies. -- 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] Re: Question About Blocking Email Addresses in Forms
What does your form actually do? Does it email you, email them, stick something in a DB? What? The form sends an email to a listserv and cc's the sender and then enters data into a database. Regardless, if they're entering a nonsense email address and are managing to get your script to email other people then you're not validating the inputs correctly. This is what I am not sure about how to go about doing. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Question About Blocking Email Addresses in Forms
Javier Huerta wrote: Thanks for all of your suggestions which all point to using Catpcha. I have actually already implemented Capchta and they are still getting around it. Even if they are entering it manually rather than via a bot, is there a way to check if the email address is of a specific format and if so then don't process the form? 1. use a regex to validate the email-address syntax 2. check that the domain exists and has an MX. /Per Jessen, Zürich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Question About Blocking Email Addresses in Forms
On Fri, January 18, 2008 10:41 am, Per Jessen wrote: 2. check that the domain exists and has an MX. I believe this will foul you up... I *think* many domains just use their regular domain as MX if there is no MX. And the Bad Guy can easily change tactics to use [EMAIL PROTECTED] or whatever, once they figure out you only check for MX records... Though it could work as a stop-gap measure at least. -- Some people have a gift link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: [QUESTION] MAIL: Send a NOOP instead of DATA
On Tue, January 15, 2008 11:03 pm, Manuel Lemos wrote: Hello, on 01/16/2008 02:11 AM mike said the following: Why not look at phpmailer? Probably more robust than some random classes. I did not suggest any random classes. I developed those classes since 1999 and I know they work reliably because they are used by me and tens of thousands of users that have downloaded the classes from the site. If you have not used these classes, I do not understand why you need to make assertions about their robustness, unless your only purpose was to put down my work. Does it bother you by the fact that I suggest that people use my classes to solve their problems? E. *I* read the first paragraph to refer to the OP's reinvent-the-wheel classes, *NOT* yours. Lighten up. :-) -- Some people have a gift link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: [QUESTION] MAIL: Send a NOOP instead of DATA
Hello, on 01/16/2008 01:38 AM Wang Chen said the following: I wrote a class to send mail by remote mail server. But it was failed. So I captured the network packets by tcpdump, and found that there is a strange packet NOOP was sent. But in the source code I mean to send command DATA. I don't know why a NOOP packet was sent instead. Here is my php source code and the attachment is tcpdump file. Maybe you are accessing a SMTP server with a grey listing or anti-spam/anti-virus frontend that sits on the front of the actual SMTP server and only passes information to the backend server when it is ready. It is possible that your message is malformed and the frontend server is expecting something that you are not sending correctly. Meanwhile the frontend server sends NOOP commands to the backend server to keep the connection opened. You may want to try this SMTP class that is known to work correctly according to the mail standards. See if you can send the message properly. If so, the theory above is likely to be the case. http://www.phpclasses.org/smtpclass If you need authentication, you also need this: http://www.phpclasses.org/sasl -- Regards, Manuel Lemos PHP professionals looking for PHP jobs http://www.phpclasses.org/professionals/ PHP Classes - Free ready to use OOP components written in PHP http://www.phpclasses.org/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: [QUESTION] MAIL: Send a NOOP instead of DATA
Manuel Lemos said the following on 2008-1-16 11:55: Maybe you are accessing a SMTP server with a grey listing or anti-spam/anti-virus frontend that sits on the front of the actual SMTP server and only passes information to the backend server when it is ready. It is possible that your message is malformed and the frontend server is expecting something that you are not sending correctly. Meanwhile the frontend server sends NOOP commands to the backend server to keep the connection opened. But it's strange that php should send a DATA command out, but tcpdump didn't capture this packet. :( You may want to try this SMTP class that is known to work correctly according to the mail standards. See if you can send the message properly. If so, the theory above is likely to be the case. http://www.phpclasses.org/smtpclass If you need authentication, you also need this: http://www.phpclasses.org/sasl Thanks Manuel, I will try this. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: [QUESTION] MAIL: Send a NOOP instead of DATA
Why not look at phpmailer? Probably more robust than some random classes. http://phpmailer.codeworxtech.com/ Not to bash on Manuel, but I find phpclasses to be littered with lots of crappy code and is too ad-laden and hard to use for me to bother. On 1/15/08, Wang Chen [EMAIL PROTECTED] wrote: Manuel Lemos said the following on 2008-1-16 11:55: Maybe you are accessing a SMTP server with a grey listing or anti-spam/anti-virus frontend that sits on the front of the actual SMTP server and only passes information to the backend server when it is ready. It is possible that your message is malformed and the frontend server is expecting something that you are not sending correctly. Meanwhile the frontend server sends NOOP commands to the backend server to keep the connection opened. But it's strange that php should send a DATA command out, but tcpdump didn't capture this packet. :( You may want to try this SMTP class that is known to work correctly according to the mail standards. See if you can send the message properly. If so, the theory above is likely to be the case. http://www.phpclasses.org/smtpclass If you need authentication, you also need this: http://www.phpclasses.org/sasl Thanks Manuel, I will try this. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: [QUESTION] MAIL: Send a NOOP instead of DATA
Hello, on 01/16/2008 02:00 AM Wang Chen said the following: Maybe you are accessing a SMTP server with a grey listing or anti-spam/anti-virus frontend that sits on the front of the actual SMTP server and only passes information to the backend server when it is ready. It is possible that your message is malformed and the frontend server is expecting something that you are not sending correctly. Meanwhile the frontend server sends NOOP commands to the backend server to keep the connection opened. But it's strange that php should send a DATA command out, but tcpdump didn't capture this packet. :( I don't know why you are using tcpdump, but maybe you are only capturing a network interface that is not the one that your code used to connect to the SMTP server. It seems to me that is something is altering the data you are sending for some reason. I suggest that you ask your system administrator. You may want to try this SMTP class that is known to work correctly according to the mail standards. See if you can send the message properly. If so, the theory above is likely to be the case. http://www.phpclasses.org/smtpclass If you need authentication, you also need this: http://www.phpclasses.org/sasl Thanks Manuel, I will try this. -- Regards, Manuel Lemos PHP professionals looking for PHP jobs http://www.phpclasses.org/professionals/ PHP Classes - Free ready to use OOP components written in PHP http://www.phpclasses.org/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: [QUESTION] MAIL: Send a NOOP instead of DATA
Hello, on 01/16/2008 02:11 AM mike said the following: Why not look at phpmailer? Probably more robust than some random classes. I did not suggest any random classes. I developed those classes since 1999 and I know they work reliably because they are used by me and tens of thousands of users that have downloaded the classes from the site. If you have not used these classes, I do not understand why you need to make assertions about their robustness, unless your only purpose was to put down my work. Does it bother you by the fact that I suggest that people use my classes to solve their problems? Not to bash on Manuel, but I find phpclasses to be littered with lots of crappy code and is too ad-laden and hard to use for me to bother. I think your opinion about the site is totally off-topic and does not add anything to this thread. Nobody likes advertising, starting with me, but now that you brought out that subject, for your information, if it was not for the advertising that you used as argument to bash me, the site would already been closed a long time ago. The PHPClasses site has over 550,000 subscribers. About 2000 of them are authors that contributed with more than 4000 freely distributable components. I am just one author. It is a democratic site. You do not have to beg to distribute your classes there. Everybody can contribute. The result is that some classes are very simple, but many others are very sophisticated and provide functionality that you will not find in any PHP classes in any other site. That happens because the site makes an non-trivial effort to promote the work of the authors that contribute to it. If you think just of the winners of the PHP Programming Innovation Award created by the PHPClasses site, you will find there plenty of brilliant classes that stand out from the crowd. http://www.phpclasses.org/winners/ If you do not want to bother and benefit from the work distributed by the site, that is your problem. But please do us a favour, respect the work that the authors submit to the site and do not call it crappy. On 1/15/08, Wang Chen [EMAIL PROTECTED] wrote: Manuel Lemos said the following on 2008-1-16 11:55: Maybe you are accessing a SMTP server with a grey listing or anti-spam/anti-virus frontend that sits on the front of the actual SMTP server and only passes information to the backend server when it is ready. It is possible that your message is malformed and the frontend server is expecting something that you are not sending correctly. Meanwhile the frontend server sends NOOP commands to the backend server to keep the connection opened. But it's strange that php should send a DATA command out, but tcpdump didn't capture this packet. :( You may want to try this SMTP class that is known to work correctly according to the mail standards. See if you can send the message properly. If so, the theory above is likely to be the case. http://www.phpclasses.org/smtpclass If you need authentication, you also need this: http://www.phpclasses.org/sasl Thanks Manuel, I will try this. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Regards, Manuel Lemos PHP professionals looking for PHP jobs http://www.phpclasses.org/professionals/ PHP Classes - Free ready to use OOP components written in PHP http://www.phpclasses.org/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php