php

Why doesn't PHP appear to store my variables?

I have a page that allows the user to draw an image using HTML5 canvas, convert it into text with JavaScript and post it to a PHP page. http://dsiextensions.co.cc/chatdraw.php The page is quite confusing, each text box is for each line of to 100px X 100px canvas. To put the data in the boxes, click "Finish" and then click "Submit" (Sorr...

Can you set a form field value with PHP?

I use the $_GET function to pull a value with php from the url (http:..../index.html?variable=value), basic stuff. However, I need to use that value in my form. Typically, I would set <?php echo 'value="'.$variable.'"' ; ?> or something to that effect. However, I can't use php inside my form using the editor I'm working with. Can I ...

Sort directory listing using RecursiveDirectoryIterator

I'm using RecursiveDirectoryIterator and RecursiveIteratorIterator to build a file listing tree using code like below. I need to the list to be sorted - either directories then files alphabetically, or just alphabetically. Can anyone tell me how to sort the file list? $dir_iterator = new RecursiveDirectoryIterator($groupDirectory); $it...

PHP MVC: How to implement an effective Controller/View Association like ZendFramework guys do!

Hi, I am making my own PHP-MVC framework. i have a question regarding Controller and View Association. I love the way Zend framework uses view within Controller as follow: $this->view->data = 'Data here'; so it can be used in view as follow: echo $this->data; I am wondering how can i implement this association. I want to remove c...

'Method name must be a string' when using __call method in php

I am using the magic __call method in PHP. Sometimes the function I call is a number. For example the class name is example, then sometimes I want to call example::32 Is this possible or should I look at another alternative. ...

How to Customize my comment registration in WordPress

Hey guys, I was wondering if name in the leave comment template can be separated to allow for first name and last name as opposed to just name? Did I explain myself right? if so can someone point me to an example. I would like to do this without having to install a module. Thanks guys, Matt ...

get the array with html array path

hey, i have this path name from an input element interesse[angebote][flurfuerderfahrzeuge] as a string in my php var. now i need convert it somehow (with regex or explode()) so it looks like this: $_POST['interesse']['angebote']['flurfuerderfahrzeuge'] and the use eval() to get the value. But I'm sure there must be a much easier way do t...

highlight search keywords on hover

i've a basic php search form which highlights the keywords using css. i was wondering if i could make the keywords in the results highlight only when the user hovers over the record. is this possible? this is the highlight code: function highlightWords($text, $words) { preg_match_all('~\w+~', $words, $m); if(!$m) ...

php $_SERVER['DOCUMENT_ROOT'] too far down the tree

Hi, I have multiple sub-domains within the document_root. And multiple folders/classes within those sub-domain folders. I need something that will help me with my include_once paths, but $_SERVER[DOCUMENT_ROOT] goes too far down. And if I were to use this, and transfer the website folder later, all my include_once paths will/might bre...

Is it possible to code a site similar to Amazon in scale in PHP?

Is PHP scalable enough to grow a project into something large? (Yes, I am aware of Facebook, maybe there are other examples?) ...

How to write this loop prettier?

I've just read this topic http://stackoverflow.com/questions/2930533/highlight-search-keywords-on-hover and actually I use pretty the same structure, but it looks awful. So can you give me an advice, how to write this loop prettier in one php file, I mean php and html at the same time? <table class="result"> <?php while ($row= mysq...

http_build_query ignores the key if the value is an empty array. How is this not a bug?

I ran into a problem today where I was passing a key with the value set to an empty array to http_build_query(). E.g.: $args = array("foo", "bar", array(), "baz"); $qs = http_build_query($args); echo $qs; // outputs 0=foo&1=bar&3=baz, I expected 0=foo&1=bar&2=&3=baz This presents a problem for me, since I'm passing some data to an int...

json encodes aray

Okay I have been struggling with this for hours. What I am doing is creating array of what I call objects that can be moved around on a calendar. Below is my code $year = date('Y'); $month = date('m'); echo json_encode(array( array( 'id' => 111, 'title' => "Event3", 'start' => "$year-$month-10", '...

Dynamic Array traversal in PHP

I want to build a hierarchy from a one-dimensional array and can (almost) do so with a more or less hardcoded code. How can I make the code dynamic? Perhaps with while(isset($array[$key])) { ... }? Or, with an extra function? Like this: $out = my_extra_traverse_function($array,$key); function array_traverse($array,$key=NULL) { $out...

PHP : flatten array - fastest way?

Is there any fast way to flatten an array and select subkeys ('key'&'value' in this case) without running a foreach loop, or is the foreach always the fastest way? Array ( [0] => Array ( [key] => string [value] => a simple string [cas] => 0 ) [1] => Array ( ...

Recursive MySQL function call eats up too much memory and dies.

I have the following recursive function which works... up until a point. Then the script asks for more memory once the queries exceed about 100, and when I add more memory, the script typically just dies (I end up with a white screen on my browser). public function returnPArray($parent=0,$depth=0,$orderBy = 'showOrder ASC'){ $que...

Zend_Session / Zend_Auth randomly throws Error Message ps_files_cleanup_dir: opendir(/var/lib/php5) failed: Permission denied (13)

Hello! I'm currently working on a new Application using (among other things) Zend_Auth but, for whatever reason, this Error Message is showing up at any location totally randomly (or so it seams) Zend_Session::start() - /home/hannes/workspace/develop/library/Zend/Session.php(Line:480): Error #8 session_start() [function.session-start]:...

Can Jetty be installed on ubuntu server?

I plan on using solr on my VPS. My server is Ubuntu. Does anybody know if Jetty can run without problems on Ubuntu, just as in the example Solr distribution? With Tomcat it is possible, but my Q is, is it possible with Jetty? Thanks ...

Persistent memcached connection with Apache and CodeIgniter

I have a CodeIgniter project. I want to use Memcache, but I don't want to create a new connection every time index.php is loaded (which is on every page load). How can I set up Apache / CodeIgniter so that I always have access to a memcache connection, without having to re-establish it all the time? ...

What is better: Developing a Web project in MVC or N -Tier Architecture?

I have asked a similar question before and got an convincing answer as well? http://stackoverflow.com/questions/2843311/what-is-difference-of-developing-a-website-in-mvc-and-3-tier-or-n-tier-architectu Due to the conclusion of this question I started developing projects in N-tier Architecture. Just about an hour ago, I asked another q...