php

Zend Form Edit and Zend_Validate_Db_NoRecordExists

I am slowly building up my Zend skills by building some utility websites for my own use. I have been using Zend Forms and Form validation and so far have been happy that I have been understanding the Zend way of doing things. However I am a bit confused with how to use Zend_Validate_Db_NoRecordExists() in the context of an edit form an...

Change widget's CSS class names for different category pages in WordPress

I want to change the class names of the sidebar widgets on every different category page of WordPress and I figured the best way to do this would be to make a function in functions.php with all the conditions and return the required class name. I then called the function in the list tags of the register_sidebar function. if (function_ex...

Question about MVC folder structure

To use the MVC pattern/layout structure, does it basicly require everything to be loaded through 1 file, like your index file? ...

Using xpath on PHP: how to select first child?

So I have a XML structure like this one: <layout> <pattern> ... </pattern> <row> ... </row> </layout> How can I select the first node of /layout/ by its index, using xpath? W3C says: There is a problem with this. The example above shows different results in IE and other browsers. IE5 and later has implem...

How do scripting languages set/modify/read out variables?

Assuming the interpreter for the language (Can be anything from PHP to Ruby) is written in C. How are variables (or more complex data structures not only containg name and value), which are defined by the script that is currently being executed, stored and read out? I, with my rather poor knowledge of C, would end up with the conclusion...

component-based php framework?

could someone give an example of the meaning of this word? i read about that prado is a component-based framework and i wonder if cakephp and codeigniter are too? ...

MYSQL like a join but only need the newest row?

I want to do the following but in one query: $query = mysql_query("SELECT name FROM tbl_users WHERE category = '1'"); while($row = mysql_fetch_assoc($query)) { $query2 = mysql_query("SELECT datecreated FROM tbl_comments ORDER BY datecreated DESC LIMIT 1"); $row2 = mysql_fetch_assoc($query2...

Example code for a comment parser

Anyone know of any sample php (ideally codeigniter) code for parsing user submitted comments. TO remove profanity and HTML tags etc? ...

Determine if a string is a valid geographic location

I've got a bunch of "locations" - some are accurate (gaborone, botswana), some are geocodes (40.75,-73.997) and some are completely useless (#siliconcape). I need to find a way to run through the list and determine the City and Country of each string and geocode, and return nulls for the invalid locations. Is there some sort of library/...

why did the creator of prado create yii?

i wonder why the creator of prado created a new framework called yii. wasnt prado the right way to go? does this mean that i shouldnt even consider prado over yii? is yii also component based? ...

Include (../x.php) doesn't work on my Linux server why?

In my Xampp I can do : require_once('../myFile.php'); And it works. When I upload the file that do the require_once, it doesn't work. Here is the error on the server: Warning: require_once(../myFile.php) [function.require-once]: failed to open stream: No such file or directory in /home/xxx/public_html/yyyy/testinclude.php on line 1...

Merging sql queries to get different results by date

I am trying to build a 'recent events' feed and can't seem to get either my query correct, or figure out how to possible merge the results from two queries to sort them by date. One table holds games/, and another table holds the actions of these games/. I am trying to get the recent events to show users 1) the actions taken on game...

For loop only inserts one filename

for($i = 0; $i < $uploadsNeeded; $i++){ $file_name = $_FILES['uploadFile'. $i]['name']; $file_name = stripslashes($file_name); $file_name = str_replace("'","",$file_name); $uploaddir = "media/files/".$_FILES['uploadFile'. $i]['name']; $copy = move_uploaded_file($_FILES['uploadFile'. $i]['tmp_name'], $uploaddir); if($copy){ ...

Is there a good open source app for user profiles with custom fields, field grouping and good search?

I'm on a project to create a skills matrix for about 200 people and am hoping to not have to reinvent the wheel. Users will fill out and maintain their skill proficiencies using yes/no and radio or combo inputs. Skills are grouped by category (Technical, Web, Creative/Social). It needs to be easily searchable, and being relatively prett...

question about component-based frameworks

i read about that with component-based frameworks, like yii, you could reuse every component for you next project. could someone give a real-life example of components (i hear this word all the time, but don't know what they exactly refer to) and how i could reuse them for my next project? are codeigniter and kohana component based fra...

PHP Zend Framework - How to Get Request URI Fragment from Request Object?

Hi, Say e.g. i have a URI http://127.0.0.1/somecontroller/someaction#12345 that takes me to the someAction() action of the someController controller. From there, i am able to retrieve the Request object via $this->getRequest(). i am also able to retrieve various information regarding the URI from the Request object. But, how can i ret...

Zend Db Select ? Substitution in join* condition.

It doesn't look like there's any parameter substitution in Zend_Db_Select's on clause. It's highly annoying that I can't just do something like: $select->joinLeft('st_line_item','st_line_item.order_id = st_order.id and st_line_item.status = ?') So what's the idiomatic alternative that works within the fluent interface? I could do som...

Can I use subversion in such a way that "commit" automatically updates my server files?

I would like to know if there is any way to make it so that when I commit changes using Subversion, that the changes are automatically reflected on my server in the testing folder? Perhaps this idea is irrational. I'm struggling to get a good big-picture view here. If I kept the subversion repository on the server, would that be reaso...

Is there a way to implement an XMPP client or message reciever that can recieve all the messages from an XMPP server?

Basically im trying to build a bot that can send a message using one of many accounts out to a user and be able to receive messages to that account it originally used process and do whatever I need it to do. So far I found the JAXL library (http://code.google.com/p/jaxl/) but based on examples it is only able to handle one user at a time...

Which function architecture is the best for maintainability in this simple case?

I'm adding "promo code" functionality to an online shopping cart written by someone else. This is a pretty micky mouse architecture question, but I would like to hear a couple of opinions. All three of my ideas would work, but which do you think is best for maintainability? So, here's the basic table structure for the promo codes: CR...