php

Is this a good candidate for a factory?

I want to create a voting system, where multiple domain objects can be voted on: a calendar event a comment a user So I figured I would create a Voteable interface for these items: interface Voteable { public function vote( User $user, $value ); } I thought this vote method would proxy a repository method, something like: cla...

does Apache caches the SESSION data in memory when I use the file handler for session?

In PHP, when I use the file handler for session storing,does Apache caches the SESSION in memory? If not, would a usage of db storage engine on memory tables (mysql) would be a good idea? ...

Using the Twitter API

I am trying to build a small useful application with twitter. I will publish it as an open source project once I am done. I am trying to decide what is the best way to do the following: I want to get the latest 200 tweets from Washington for example and see the most important thing these 200 tweets share. For example, if 20 tweets have ...

Modular architecture in CodeIgniter

Hello, the idea I'm playing with a concept of modular website builder - now mostly in theory, which would containt pages / collections based on modules (either preprogrammed or done specifically when needed). Every module with come with it's ties to DB, views/templates and core data processing, I'm thinking about factory pattern: bas...

PHP Get list of files from Directory (in Moodle)

I want to open a directory and read all the files inside and put them into an array, so far I have: $imagesdir = $CFG->dataroot.'/1/themeimages/'; Which gives me the path to the directory, whats the next step? ...

RSS feed captions

How can I read the captions of a RSS feed from a given website? I have to use either Magpie or PHP. ...

Building a custom API--needing a logic check.

I am in the planning and early coding stages of writing my first full-fledged API for a large scale we application. I have used several APIs over the years but this is the first time I have been asked to construct something that will allow programmatic interaction on this level. I have done quite a bit of research looking for best prac...

MySQL data change management

I have content stored in a table with the following schema: id unsigned int primary_key, name varchar(20) I have two levels of users: 1.Content editor: Who can change content and submit for approval(involves deleting rows as well as editing fields) 2.Content admin: Who can see changes and approve them. The content editor works on a ...

How can I pass in an array as a value into a PHP soapclient request?

How can I pass in an array as a value into a PHP soapclient request? I have a soapclient instantiated and connected already. I then try to make a call to a webservice method that expects 3 parameters (string, string, hashmap). Here is what I expected to work below. But when viewing the xml output, the params node is empty. soapclient-...

generating dates of previous seven days in php

I need help regarding generating dates and days of the last seven to ten days with respect to today. How an accurate timestamp can be created which can take care of week, month and year change ? ...

Does PHP hash() support WHIRLPOOL by default?

I was just wondering if PHP's hash function supported WHIRLPOOL by default. I believe it is but i wanted to ask to be sure. ...

How to display the query executed by the drupal view

I want to display the query that is executed in the drupal view. Currently in the view editor it shows the query however I have a need to use that query in my code to download an excel version of the view. Is there a way to get the executed query the same way it's shown in the "editor" window of the views menu? I want this at the time...

MySQL database not wanting to add any new records

Hi every1! ok so I have this code `$sql = "INSERT INTO userTable (username, password, gender, city, zip, email) VALUES ('$username', '$password', '$male', '$city', '$email')"; mysql_query($sql) or die ("unable to process query");` and for some reason it works on my local server but not on the webserver, all the variables are set for...

Lots and lots of joins in a Zend Query, hopefully just a slight tweak

Apologies for all this code, anyhow Im re-working a query into the Zend query way of working, this is what I have so far: $db = Zend_Registry::get ( "db" ); $stmt = $db->query(' SELECT recipe_pictures.picture_id, recipe_pictures.picture_filename, course.course_name, cuisines.name, recipes.id, recipes.Title, recipes.Method,...

PHP parse directory and subdirectories for file paths and names of only jpg image types

I am looking to modify this php code to do a recursive "search for and display image" on a single, known, directory with an unknown amount of sub-directories. Here's the code I have that scans a single directory and echoes the files out to html: <?php foreach(glob('./img/*.jpg') as $filename) { echo '<img src="'.$fil...

I'm having trouble understanding this really simple PHP code. Please help?

Here's the code: <?php class Order extends Zend_Db_Table_Abstract { protected $_name = 'orders'; protected $_limit = 200; protected $_authorised = false; public function setLimit($limit) { $this->_limit = $limit; } public function setAuthorised($auth) { $this->_authorised = (bool) $auth; } public function insert(arra...

How can I clean this 'controller' file in this mini-php-framework with deals with multilingual websites

I came up with a mini-framework which deals with multilingual websites without using Gettext or Zend_Translate by joining together very good answers from previous questions I asked like this one. languages/lang.en.php(the multilingual content source): <?php $lang = array( 'tagline_h2' => 'I create <a href="#content">websites</a>......

Symfony : ajax call cause server to queue next queries

Hello, I've a problem with my application when an ajax call on the server takes too much time : it queue all the others queries from the user until it's done server side (I realized that canceling the call client side has no effect and the user still have to wait). Here is my test case : <script type="text/javascript" src="jquery-1.4....

Why would this line of code be executed if the IF condition is false? Doesn't make any sense.

Here's the code: <?php class Order extends Zend_Db_Table_Abstract { protected $_name = 'orders'; protected $_limit = 200; protected $_authorised = false; public function setLimit($limit) { $this->_limit = $limit; } public function setAuthorised($auth) { $this->_authorised = (bool) $auth; } public function insert(arr...

Loading the Language Class in ExpressionEngine for PHP Scripts not loaded by ExpressionEngine

Basically, what I need is a way for a PHP script called using ajax to access ExpressionEngine's $LANG superglobal. I'm using ExpressionEngine 1.6.8 core, and jQuery for ajax. My setup is that I have an extension that uses the publish_form_end hook to add some content and javascript to the publish form. The content will be dynamically upd...