I have several static factory patterns in my PHP library. However, memory footprint is getting out of hand and we want to reduce the number of files required during execution time. Here is an example of where we are today:
require_once('Car.php');
require_once('Truck.php');
abstract class Auto
{
// ... some stuff ...
public st...
Using CodeIgniter with persistent connections disabled.
...
It seems if I do something like
$file = fopen($filepath, "w");
$CR = curl_init();
curl_setopt($CR, CURLOPT_URL, $source_path);
curl_setopt($CR, CURLOPT_POST, 1);
curl_setopt($CR, CURLOPT_FAILONERROR, true);
curl_setopt($CR, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($CR, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($CR, CURLOPT_FILE, $file);
$r...
I asked this question before, Here however I think I presented the problem poorly, and got quite a few replies that may have been useful to someone but did not address the actual question and so I pose the question again.
Is there a single-line native method in php that would allow me to do the following.
Please, please, I understand th...
I've searched around and found two different ways to define Content-type for JSON file loaded with php.
header('Content-type: text/json');
header('Content-type: application/json');
which one should be used ?
...
Does anyone know of a good tutorial?
thanks
...
What's your experience with doctrine?
I've never been much of an ORM kind of guy, I mostlymanaged with just some basic db abstraction layer like adodb.
But I understood all the concepts and benifits of it. So when a project came along that needed an ORM I thought that I'd give one of the ORM framework a try.
I've to decide between do...
How are paged results commonly implemented in PHP?
I'd like to have a results page with 10 results. Paging forward in the navigation would give me the next and previous sets.
Is there a way this is commonly done? Does anyone have simple advice on getting started?
...
The default output from Drupal's Form API is:
<input id="edit-submit" class="form-submit" type="submit" value="Save" name="op"/>
How do I theme that so I get:
<button id="edit-submit" class="form-submit" type="submit">
<span>Save</span>
</button>
I need the inner span-tag so I can use the sliding doors CSS technique.
I guess I n...
A site I am working on that is built using PHP is sometimes showing a completely blank page.
There are no error messages on the client or on the server.
The same page may display sometimes but not others.
All pages are working fine in IE7, Firefox 3, Safari and Opera.
All pages are XHTML with this meta element:
<meta http-equiv="Content...
What are some strategies to achieve code separation in AJAX applications?
I am building a PHP application that I would like to have a nice AJAX front end on. I have long since learned to use some kind of templating in my PHP code to make sure I maintain good separation between my logic and display code, but I'm having trouble finding g...
I am working on a small parser that should accept input in a number of languages. I am going to have maybe 50 strings that will serve as keywords/anchors in parsing the input. In PHP, what would be the best way to organize these translated keywords?
One possible solution that comes to my mind is to use an associative array. Like this:
...
I have a script that generates data in csv format which is sent to the user along with a set of headers that tell the browser it is a .csv file. Everything works great when users (left)click on the link to the script, they are presented with a download dialog with the filename ending in .csv and it suggests using excel, or calc, to open ...
Is there any way, from a PHP script called from mod_php with apache, to tell apache to do an INTERNAL redirect to some other file?
I do not want to read/require this file from PHP and spit it out, I think it'd be more efficient to pass this off to Apache. I believe this can be done with mod_perl and I'm curious if there's a way to do i...
I would like to get some good training on how to publish and consume web services using PHP. My employer is allowing me a budget to do this for next year.
I was wondering if anyone new of some good web service training using PHP as the tool to do so.
Edit:
Just to clarify a little. I have been using PHP for about 4 years now and am fair...
Hi,
Let's imagine I got this:
index.php generates form with unpredictable number of inputs with certain IDs/Names and different values that can be edited by user and saved by script.php
<form action="script.php" method="post">
<input id="1" name="1" type="text" value="1"/>
<input id="24" name="24" type="text" value="2233"/>
<input id=...
I was just wondering how many experienced programers out there actually map out their process or algorithms in a program like MS Visio or Gnome Dia?
I am trying to code some complex PHP for my website and just seem to be missing something. Is a diagram program going to help or should I be looking in another area?
...
I control access to some of my static web resources with some PHP logic. Because directory-based authorization through the webserver is not suitable or easily possible.
A combination of things determines whether access is granted or denied. And these rules change from time to time.
In the beginning it was a simple regex path match, a...
I'm not looking for the whole ACO-ARO implementation... I just want to use Auth, and check against the user's role....
What do I put where in order to simply deny users from a given controller unless they have a certain role.
I'm trying to use the $this->Auth->authorize = 'controller';
... but I don't even know where to put that??
An...
I would like to create a batch script, to go through 20,000 links in a DB, and weed out all the 404s and such. How would I get the HTTP status code for a remote url?
Preferably not using curl, since I dont have it installed.
...