php

Auto iconv of Doctrine query

How do I set up Doctrine to automatically run iconv (Windows-1251 to Utf-8) when fetching data? ...

PHP REGEX: Get Image from URL

What I want If the URL in the string contains a .jpg at the end of the URL (not the string) then it should make an image from it with preg_replace else make a normal link. so for example: If I have http://www.example.com/images/photo.jpg then it should replace with: <img src="http://www.example.com/images/photo.jpg" alt="http://ww...

php ReflectionClass

hey all i want to use ReflectionClass to load some classes defined in my xml file but i am getting an error Error while register class :Class ReportErrorHandler does not exist i will not get this error when i will use require_once( 'handlers/system/ReportErrorHandler.php' ); but i dont want to require_once the class ,this is w...

disable html element in php if it exists

how do i disable an html element after checking in php if it exists? in other words, after the data has been inserted into the xml file the first time, the html textbox elements should be disabled, so that the user does not enter any more information in that textbox. is this possible? the code checks if the element exists, and if it do...

Need a POPUP thickbox for fileupload in jquery

strong text Hi pals, I need a Thickbox or any other category of POPUP structure to Upload files to server using same and close successfully after work. If any body have good code give me ... regards Anes ...

Why isn't my php move file script actually moving the file?

I am uploading files to a server using php and while the move_uploaded_file function returns no errors, the file is not in the destination folder. As you can see I am using the exact path from root, and the files being uploaded are lower than the max size. $target = "/data/array1/users/ultimate/public_html/Uploads/2010/"; //Write the...

using xsl displays nothing

i'm trying to implement an xsl file to an xml doc. however when i do so, it displays nothing. if i remove the reference of the xsl from the xml file, the data at least is displayed. this is the xsl code: <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"&gt; <xsl:temp...

PHP: Need to extract certain part of string using preg_match()

I'm try to extract the "INV" part of the string below: 123_456_P1234_INV_UID-123456.PDF Here's the code I have so far: php -r 'echo preg_match("/_(.*?)_UID-.*?\.PDF$/", "123_456_P1234_INV_UID-123456.PDF", $cat) ? $cat[1]."\n" : "";' This returns: _456_P1234_INV Can anyone tell me why it's including everything before the INV bit?...

INSERT new rows, UPDATE old rows: how?

I am making a PHP utility that imports and analyzes a CSV file into $data, and whether or not to INSERT "new" rows into the database ($saveNew). Right now, I have a bit of an ugly mess: (in generalized pseudo-PHP) function synchronize($data,$saveNew) { $existing_ids = $table->find_all('ID'); //array of ID's in the table $incomi...

PARSE XML IN PHP

HI , all .. I need to parse an DWF file using PHP, which looks like an xml file . example : <dwf:Feature id="BXV1D8mWfkGOqXbyoIxQ2g"> <dwf:Properties id="hZBTdWkXKEuhGWAeTpMOUA"> <dwf:Property name="NO" value="0" /> <dwf:Property name="DESCRIPTION" value="Testing" /> <dwf:Property name="DATE" value="06/25/09" /> <dwf:...

A string that contains text

Hello all. I use the following code to check if a string is the session username at the moment. if($_SESSION['username'] == $home || $_SESSION['username'] == $away) I am looking to change that to see if the string includes the session username, not specifically IS the username. Is there a way to do this? Thankyou Edit : Say the str...

Using PHP to format an email?

I know it is possible to send html enabled emails. Is it also possible to send PHP enabled emails? For this to count: php code has to be sent as plain text php code has to be executed on some server X only after recipient opens the email Server X is not the recipient's machine If this is possible, what are the consequential securit...

Could you tell how to replace by regular expression

Could you tell how to replace string by preg-replace (need regular expression): /user/{parent_id}/{action}/step/1 At the equivalent values of an array: array('parent_id'=>32, 'action'=>'some'); To make: /user/32/some/step/1 Addition This is a typical problem, so I probably will not know what the names of variables come ...

Change the product image when visitor makes an attribute selection in Ubercart

Current Setup Each product on the store has multiple images. When the visitor visits a product page they see a main image and a series of thumbnails (view). When they click on a thumbnail that image is instantly displayed in the main image area. Each product also has an attribute selection dropdown for example "Colour". Drupal / Uber...

PHP and the GD library

I'm using GD to change the font on user posted comments. What I have so far works for a single post but what I need are all of the posts output into a single image. Is this possible? ...

Collecting values from the part-AJAX form with PHP

I currently have a form with a dropdown box, and when the value in the dropdown changes, a PHP file with some more form elements get loaded via jQuery's $.ajax function into the main form. However when I submit the form (using just the non-AJAX way) the values from the 'ajaxed' area of the form are not included in the $_POST values. Do y...

Add <br> when echo

Variable $name (string) gives something like (5 possible values): "Elton John" "Barak Obama" "George Bush" "Julia" "Marry III Great" Want to add <br /> after the first whitespace (" " between words). So, it should give when echo: "Elton<br/>John" "Barak<br/>Obama" "George<br/>Bush" "Julia" "Marry<br/>III Great" 1) <br /> should be...

PHP codesniffer (phpcs) - how to allow override when using as part of a svn pre-commit hook?

We have a PHP 5 web application and we're currently evaluating PHP CodeSniffer in order to decide whether forcing code standards improves code quality. We use subversion for our code repository and deployment base and I have added a SVN pre-commit hook to ensure all files committed are free from coding standard smells. The hook technica...

Do you know a good book/website about structuring your codes (PHP/ Web programming)

i mainly use PHP and I have been coding using it for a while. My main problem with PHP is that I think as your program gets bigger, it gets harder to maintain your code (probably applies for other things). I want to reduce this complexity in maintaining/modifying my codes. I want to make things modular and have rules when to start a new ...

Remote Address Parameter in Zend_Http_Client

Hi Am developing a public site that uses the Zend_Http_Client to access remote logic.Is there a property/way in the Client adapter that I could set the remote address of the user browsing the site? Currently am using this workaround which combines both remote address and remote useragent. $client = new Zend_Http_Client(); $clie...