php

PHP Namespace: Framework

Hi, are their already PHP frameworks that are using namespaces. I only now that their is zend who are working on it. Best Regards, Sebastian ...

tempnam returning an extra path prefix

When we call $tmpFilename = tempnam(SIEFREPOSITORY, 'Sief'); it returns /export/sief/share/htdocs/siefvalidator_prod/sieflog/SiefMVNtuW SIEFREPOSITORY is /share/htdocs/siefvalidator_prod/sieflog/SiefMVNtuW why is it adding extra /export/sief prefix? ...

Mocking The PDO Object using PHPUnit

I'm having difficulty mocking the PDO object with PHPUnit. There doesn't seem to be much information on the web about my problem but from what I can gather: PDO has 'final' __wakeup and __sleep methods that prevent it from being serialised. PHPunit's mock object implementation serialises the object at some point. The unit tests then...

Use of "getTypeInstance()" of a Product in Magento

Can anybody please put some light on the need of the method "getTypeInstance()", which can be use by any product object? Also what are the pros & cons of using this method? ...

howto Zend_Dojo_Form_Element_FilteringSelect onchange submit

Well the title pretty much says it all. I had $strata = new Zend_Form_Element_Select('strata'); $strata->setLabel('Select a strata: ')->setMultiOptions($this->stratalist)->setAttrib('onChange', 'this.form.submit()'); Then I need to use some fancy dojo form elements in other forms. So I decided to make them all look the same and did th...

Generating a PLIST file - to be read by Objective-C - via PHP

The title sums it up. Would that be possible, as in, is the data structure of a PLIST file possible to generate efficiently via PHP for an Objective-C app to read? Or, would a different format like XML be better? I'm more keen to go with PLIST as I hear it's easier to parse from Obj-C, and won't require any external libraries (this is f...

Why is my PHP error log lagging behind by 2 hours?

When checking php.ini, from both phpinfo and php -i on the command line, my timezone is set to Africa/Johannesburg. So my timezone is GMT +2. I wrote a tiny snippet to check the time is right as follows: echo date('h:i A', time()); echo '<br />' . ini_get('date.timezone'); and this outputs the correct time, matching with my localmach...

How can I run a program in the background (non blocking) with php?

Hi, I want to run a shell script in php, but this shell script takes a long time to execute (it has sleep in it), I don't want the web server to block when executing this script. I tried exec() and shell_exec() in php but the server stops until the shell script finishes! I thought of doing fork in the shell script itself but I don't kn...

find-and-replace-in-html regular expression fails

I have a regular expression that looks through html content for some keywords that used to work, but now fails and i don't understand why. (The regular expression came from this thread.) $find = '/(?![^<]+>)(?<!\w)(' . preg_quote($t['label']) . ')\b/s'; $text = preg_replace_callback($find, 'replaceCallback', $text); function replaceCal...

Clients Complaining for slow speed of my osCommerce Website..

Hello All, My Clients are Complaining for slow speed of my osCommerce Website.. I dont have the basic idea to check out for the speed down of my website.. What could be the issue in this matter? Could Anybody guide me regarding this... ...

To cut flv video using php

I am trying to provide a preview of 30 seconds of premium videos (users have to pay to watch it completely). So I want to create a video file of 30 seconds at the time of uploading these videos. I used ffmpeg as below, but it is not working. ffmpeg -ss 00:00:00.0 -t 00:00:30.0 -i input.flv -acodec copy -vcodec copy -async 1 output.flv ...

Problem with jqGridPHP 3_6_3 & 3_7 installation

i was downloading the jqGridPHP 3_6_3 and i was following step by step of the quick installation guide in READMEPHP file. but why I can’t see anything in my browser when i tried. when i’m trying to use jqGridPHP 3_7 trial version i found the same problem. i was following the steps in READMEPHP file but my browser show me this message “F...

Processing URL parameters - name value pairs separated by slashes

I want to have URLs like :- URL 1 - www.projectname/module/search/param/1 URL 2 - www.projectname/param/1/module/search I want a PHP code which takes the above URLs as parameter and returns an array like Array("module" => "search", "param" => 1) (for URL 1) Array("param" => 1, "module" => "search") (for URL 2) So that I can u...

PHP accessing a property of an object

Hi There, I have an object that looks like this when outputted via a print_r Array ( [178] => My_Model_Category Object ( [autoGenerateURLNameIfNotSupplied] => 1 [id] => 178 [name] => Just for Kids [date_created] => 2010-04-06 16:08:40 [last_updated] =...

Processing an Email Bounce back in CakePHP and Postfix

Hi, I'm trying to handle bounced message and send to a responsible System Administrator. I use CakePHP Email Component to send the message. On server side, I use postfix to transport the message. function sendAsEmail($data) { $Email->sendAs = 'html'; $Email->from = $user['Sender']['username'] . '@example.com'; $Email->return = ...

Trying to use preg_match on extracted html page but this is perplexing me

I've been trying the below script (within a larger app I'm working on) for hours now and I just can't understand what the problem is, no matter what I get "Notice: Undefined offset: 1" meaning that its having some problem putting the result into an array from the preg_match... I did a process that was nearly identical to a similar page e...

How to use a function generating an image?

I have a php code which generate an gif-image defined by a set of parameters. I wrote this code as a function and now I want to insert an image into a html page. My problem is that whenever I use an img tag I need to specify a name of the file containing an image but I do not have an image in a file. The file containing a function for g...

Set Special Price Dates for Products in Magento

I am adding a simple Product in magento, in which I want to set the following, along with others:- Special Price Special Price From Date Special Price To date The problem seems to be the #2 & #3 points. I have been successful in setting the #1 point, but I need help in solving the issues with the last 2 points. I have tried using ...

Not inserting into database!

Code not inserting into MySQL Database!?!? Excerpt Register.php $register = mysql_query("INSTER INTO users VALUE ('','$firstname','$lastname','$username','$password_db','$dob_db','$gender_db')"); echo "Success!"; Connect.php <?php //connect $error = "Problem connecting to database. Please try again late...

PHP process array question

How can I convert the array below Array ( [0] => stdClass Object ( [name] => color [value] => red ) [1] => stdClass Object ( [name] => color [value] => black ) [2] => stdClass Object ( [name] => color [value] => ...