php

Zend Navigation add extra id

I made a menu with zend_navigation, using an ini file. That work well. If I look at the code, i see that zend has added a class, to the ul element. With a name that i use in my ini file. But now I want to add also a id to the ul element. How can I do this? protected function _initNavigation() { $this->bootstrap('layout'); $lay...

PHP CLI application debug in ZendStudio (STDIN)

0 I am trying to debug php CLI using Zend Studio. My problem: I can't get user input from keyboard. This is part of code (method in some class): public function getInput($promt = null, $defaultValue = null) { if(!isset($promt)){ $promt = self::$DEFAULT_PROMPT; } echo $promt; $stdin = fopen ( "php://stdin", "r" ...

Looping through with dates syntax issue

I have created a fixture generator for football/ soccer games... for ($round = 0; $round < $totalRounds; $round++) { for ($match = 0; $match < $matchesPerRound; $match++) { $home = ($round + $match) % ($teams - 1); $away = ($teams - 1 - $match + $round) % ($teams - 1); // Last team stays i...

PHP larger grids (or jquery)

I'm trying to jump into PHP and I want to move a current web app to it. The problem is this app had very large grids that rendered from database tables with a lot of fields (one of which was almost 100 fields). I'd like a flexible, good looking, and easy to use grid that can do filtering, grouping, etc.. Very important is that I can...

how to stop sessions expiring after every 3-5 minutes

i have sessions for user login in my web sites but it expires after every 3-5 mintues and often in just 30-45 seconds... how can i fix that ...

How do I host a Plugin Repository based on git?

Users can extend our PHP application with plugins, and we would like to host all these plugins, but more than just hosting files we want to allow users to version their files with git. Finally too, we'd like for other people using these plugins to be able to review/rate the plugins. Is there any such script/software out there that allow...

php multi-dimensional array manipulation: replace index by one of its values

I would like to make this multidimensional array more readable by using one of its sub key values as index. So this array: array( [0]=>array('group_id'=>'2','group_name'=>'red','members'=>array()), [1]=>array('group_id'=>'3','group_name'=>'green','members'=>array()), [2]=>array('group_id'=>'4','group_name'=>'blue','members'=>array()), ...

Count number of results in a View

I need to count how many people belong in pre-defined groups (this is easy to do in SQL using the SELECT COUNT statement). My Views query runs fine and displays the actual data in my table, but I simply need to know how many results it found. However there doesn't seem to be a COUNT option in views. I am guessing I am going to have to u...

Symfony models with foreign keys

So I have 2 models. Users and Groups. Each group has a user as the creator and a group has many users. The FK of these tables are set up correctly, but I was wondering if there was an easier way to get all related FK objects from other objects. For example, with a group object, is there a built in method to get the user object of the cre...

Is there a way to deserialize an object into "$this"?

I'm writing a class to handle a memcached object. The idea was to create abstract class Cachable and all the cachable objects (such as User, Post, etc) would be subclasses of said class. The class offers some method such as Load() which calls the abstract function LoadFromDB() if the object is not cached, functions to refresh/invalidate...

How to properly set URL rewrite rules for a php script to only accept POST

I have a rewrite rule for GET and POST: <LocationMatch "^/my/script/dir/?$"> RewriteEngine on RewriteCond %{REQUEST_METHOD} ^(HEAD|GET)$ RewriteRule .* /resources/scripts/storage/admin/list.php Script POST /resources/scripts/storage/admin/create.php </LocationMatch> How would I modify it to only allow POST? ...

Dynamic data population in table form with Code Igniter

I have a pretty simple question, but for some reason I am drawing a blank. I have the following code in my view file, and I want to display the results in a two column table, so the first entry would be on the left, the next would be on the right then the next one after that would be below the first row, and eventually I will use the pag...

Jeditable doubling up on linebreaks every edit

I'm using var retval = value.replace(/<br[\s\/]?>/gi, '\n'); To strip the <br> tags from the textarea and nl2br('$_POST('newValueHere')') to insert into my database and to return back to jeditable to display the edits. The only problem I'm having is that each click on the editable field seems to make all the <br> tags be written twic...

declare or convert a string to array format PHP

How to convert a string format into an array format? I have a string, $string = 'abcde' I want to convert it to a 1 element array $string[0] = 'abcde' Is there a built in function for this task? Or the shortest way is to $string = 'abcde'; $array[0] = $string; $string = $array; TIA ...

Live comments Update without realoading page in PHP posible?

Hello, i was viewing this video and i really want to develop this is PHP with no AJAX, do you how to start? where can i find some examples codes? Thanks. ...

php OOP, full sample

Hi, On this site I found a lot of cool examples of PHP OOP. Maybe you know where to find complete examples? Guest books, registration forms, blog... When I look at the full model is much easier to understand OOP PHP. As different classes interacting with each other, exchange data How to use the generic class for sending data to the dat...

Help Modifying Generic REST Helper PHP Example Code to Support XML DOM

Hi! I found this example PHP source code at HTTP POST from PHP, without cURL I need some help modifying the example PHP source to support XML DOM for manipulating a REST API. I thought that if I update the CASE statement for the XML section below from $r = simplexml_load_string($res); to $r = new DOMDocument(); $r->load($res); t...

php date() vs mysql MONTH()

Hi, i have this unix timestamp value: 1275364800 (1st june 2010). When printing that value with php: echo date('m',1275364800) it returns 6 (thats ok) But when i select a field from a database: select MONTH(FROM_UNIXTIME(1275364800)) AS month it returns 5 Why? BTW, if i run this query select FROM_UNIXTIME(1275364800) AS q i get 2010-...

Zend Framework - counting rows in select clause ?

Hello! I'm investigating Zend Framework and currently stucked in counting resulting rows of sql query... Every method I try (from documentation and some blogposts and tutorials) returns an error (like Call to undefined function) or simply gives the incorrect value. I've tried this: $checkquery = $db->select() ->from('users', 'COUNT(...

How can I shade a region between two lines in flot?

I have had a lot of success creating graphs with Flot. However, I can not seem to figure out how one would go about shading in a region between two lines using the library. My goal is to be able to create shaded regions as illustrated below: I found this plugin, but it appears that it can only shade a range of values of a line, as ...