I seem right now to be embroiled in a debate with another programmer on this project who thinks that views have no merits. He proposes a system that PHP looks something like this:
$draw = new Draw;
$nav = $draw->wideHeaderBox().
$draw->left().
$draw->image().
Image::get($image,60,array('id'=>'header_image')).
$draw->imageE...
At the moment my code (PHP) has too many SQL queries in it. eg...
// not a real example, but you get the idea...
$results = $db->GetResults("SELECT * FROM sometable WHERE iUser=$userid");
if ($results) {
// Do something
}
I am looking into using stored procedures to reduce this and make things a little more robust, but I have some...
Does anyone have any recommendations for implementations of ActiveRecord in PHP? I've been using CBL ActiveRecord, but I was wondering if there were any viable alternatives.
...
I've to admin a small website for my alumni group which is hosted by my ISV. The url is something like www.myIsv.com/myWebSite/ which is quite ugly and very forgetable. The main admin of the webserver has registered a domain name www.mysmallwebsite.com and put a index.html with this content:
<html>
<head>
<title>www.mysmallwebsite.com</...
What is the best way to keep a PHP script running as a daemon, and what's the best way to check if needs restarting.
I have some scripts that need to run 24/7 and for the most part I can run them using nohup. But if they go down, what's the best way to monitor it so it can be automatically restarted?
...
Hey,
I'm not sure I'm using all the correct terminology here so be forgiving.
I just put up a site with a contact form that sends an email using the PHP mail() function. Simple enough. However the live site doesn't actually send the email, the test site does. So it's not my code.
It's a shared host and we have another site that has t...
Hey so what I want to do is snag the content for the first paragraph. The string $blog_post contains a lot of paragraphs in the format:
<p>Paragraph 1</p><p>Paragraph 2</p><p>Paragraph 3</p>
The problem I'm running into is that I am writing a regex to grab everything between the first P tag and the first closing P tag, however it is ...
DB_DataObject does not appear to be ActiveRecord because you do not necessarily store business logic in the "table" classes. It seems more like Table Data Gateway or Row Data Gateway, but I really cannot tell. What I need is good ORM layer that we can use with DataMapper and a DomainModel. Any ideas?
...
My website was recently attacked by, what seemed to me as, an innocent code:
<?php
if ( isset( $ _GET['page'] ) ) {
include( $ _GET['page'] . ".php" );
} else {
include("home.php");
}
?>
There where no SQL calls, so I wasn't afraid for SQL Injection. But, apparently, SQL isn't the only kind of injection.
This website ha...
getting this:
problem PHP Warning: mail() [function.mail]: SMTP server response: 550 5.7.1 Unable to relay for [email protected] in c:\inetpub\wwwroot\mailtest.php on line 12
from this page:
<?php
$to = "[email protected]";
$subject = "test";
$body = "this is a test";
if (mail($to, $subject, $body)){
echo "mail sent";
}
...
Can I use Struts as a backend and PHP as front end for a web application? If yes, what may be the implications.
...
I have inherited a client site which crashes every 3 or 4 days. It is built using the zend-framework with which I have no knowledge.
The following code:
<?php
// Make sure classes are in the include path.
ini_set('include_path', ini_get('include_path') . PATH_SEPARATOR . 'lib' . PATH_SEPARATOR . 'app' . DIRECTORY_SEPARATOR . 'classes')...
I have a fairly small MySQL database (a Textpattern install) on a server that I do not have SSH access to (I have FTP access only). I need to regularly download the live database to my local dev server on demand; i.e., I would like to either run a script and/or have a cron job running. What are some good ways of doing this?
Some points ...
In my host, I currently have installed 2 wordpress applications, 1 phpBB forum and one MediaWiki.
Is there a way to merge the login so that all applications share the same credentials?
For instance, I want to register only in my phpBB and then I want to access all other applications with the given username and password.
Even if you do...
Is it possible to cache database connections when using PHP like you would in a J2EE container? If so, how?
...
Okay, here's the case: I have an SQL query like this:
UPDATE foo
SET flag=true
WHERE id=?
Now, I have a PHP array, which has a list of IDs. Is there a neat way of doing this, outside parsing something like:
foreach($list as $item){
$querycondition = $querycondition . " OR " . $item;
}
and using that in the where clause?
...
Is there a programmatic way to build htpasswd files, without depending on OS specific functions (i.e. exec(), passthru())?
...
I've been using PHP for too long, but I'm new to JavaScript integration in some places. I'm trying to find the fastest way to pass database information into a page where it can be modified and displayed dynamically in JavaScript. Right now, I'm looking at loading a JSON with PHP echo statements because it's fast and effective, but I saw ...
Does anyone know of a complete Ajax/PHP contact form that includes error handling/form validation and requires minimum effort to setup? It must also still function in cases where JavaScript is disabled.
I'm pretty much looking for a plug and play solution (well, as close to it as possible).
...
Other scripting languages popular on the web, such as Python and Ruby, are used in desktop applications. However, I've rarely (if ever) seen a PHP application designed to be deployed on a desktop. Why is this? What about PHP is holding it back from this, or what about these other languages make them popular for the dual use?
...