php

Is there an intelligent PHP Emacs tagging solution?

I want to navigate to a member declaration under the point. Creating a tag file using etags *.php and then navigating with find-tag is limited in that it doesn't seem to have any sense of the calling class. So you have to cycle if two classes have methods with the same name. Semantic's semantic-ia-fast-jump function, another potential o...

Is using a script to generate static content just a bad form of caching?

I am about to begin building a small application for a user to manage the content of a simple website. Since the content will be changing relatively infrequently, it struck me that it would be a waste to dynamically generate each page upon request--all of the content on the site will remain the same between edits. The simple solution I...

MODx Wayfinder to limit certain pages

On my current page I have wayfinder defined in a snippet that if this is a top level item, return it's child docs. If it's a child doc, return it's siblings: <? $id = isset( $id )? $id: $modx -> documentObject['id']; $parentID = $modx->getParent($id,1,'id'); $startId = $parentID['id']; if ($startId == 0) {$startId = $id;} $output = ...

Help getting PHP sessions to persist after being taken off-site

Hi, we're working on a payment gateway system with PHP. We use sessions to store the shopping cart data. The system takes you off-site to the payment processor's site, and then return you to your site. On most hosts, we have no issues when we arrive back at our site and having the session data still be there. On those with an issue, turn...

Target module with custom layout in Magento

In my custom module, I'd like to include an extra block and style sheet that targets only pages within my custom module. So that when i access myserver.com/configurator/ Pages will use the correct template I specified In the catalog.xml file, I noticed <catalog_category_default> That seems to be what I am looking for, so I tried: ...

Implementing Model-level caching

I was posting some comments in a related question about MVC caching and some questions about actual implementation came up. How does one implement a Model-level cache that works transparently without the developer needing to manually cache, yet still remains efficient? I would keep my caching responsibilities firmly within the mo...

How do I add an overlay to my OpenStreetMap

I currently use a google map and create tiles for it by using a PHP script to generate the required PNG images var myTileLayer = new GTileLayerOverlay( new GTileLayer(null, null, null, { //tileUrlTemplate: 'Overlays/Overlay_{Z}_{X}_{Y}.png', ...

500 error with CodeIgniter

I have just moved my CodeIgniter project to a new server and now I'm getting a 500 error and no output from the project. It works fine on my old server and in my test environment. I'm completely stumped how to troubleshoot this, especially as there's nothing of use in the log files. Any help would be great! ...

Craft a JSONpath expression so that it retrieves only a specific value?

Hello, I have some JSON of which the following is a small sample: results": { "div": [ { "class": "sylEntry", "id": "sylOne", "div": [ { "class": "sT", "id": "sOT", "p": "Mon 11/17, Computer work time" }, { "class": "des", "id": "dOne", "p": "All classes Siebel 0218" } ] }, I would like to only retrieve ...

PHP preg_match Math Function

I'm writing a script that will allow a user to input a string that is a math statement, to then be evaluated. I however have hit a roadblock. I cannot figure out how, using preg_match, to dissallow statements that have variables in them. Using this, $calc = create_function("", "return (" . $string . ");" ); $calc();, allows users to inp...

advise the decision to build a survey

advise the decision to build a survey for users on RoR or PHP ...

Wordpress throws 404 when I try to use a custom template page

I made a custom page template (for example, for About page), added Template Name inside the file and saved that. Then I tried to add a page in wp admin console using that template. It said that the page had been created successfully but when I try to open it in browser, it shows me 404 error. What did I do wrong? Thanks. I forgot to say...

Why is the same CURL code failing on one server and yet works on the other one?

The code attempts to grab a test page for example Yahoo.com in this case. I am outputting the var_dump http://jinimatics.com/test.php (this works) http://jinimetrix.com/test.php (this does not) (Curl is installed on both servers along with fairy recent Lamp Stack) ...

Organising dates in PHP

Hi All, Im wanting to organize a series of dates in the following format. As a bit of context, the dates are the dates of upcoming events that can be added by my users. The format: January 2011 date - event date - event date - event February 2011 date - event date - event date - event with all events in a given month, arranged ...

Blank Pages with Zen Cart v1.3.8 and PHP 5.3

I am trying to run a live Zen Cart store (version 1.3.8) on a my local machine which is PHP 5.3. I am aware of the incompatibilities between both versions and have dealt with it by applying the patch found here: http://www.zen-cart.com/forum/showthread.php?t=140960 I am able to login the admin side no problem, but when i navigate to the...

PHP/mysqli: Inserting IP address with mysqli_stmt_bind_param()

Hello! I have a database table which contains an unsigned integer field to store the visitor's IP address: `user_ip` INT(10) UNSIGNED DEFAULT NULL, Here's the snippet of PHP code which tries to store the IP address: $ipaddr = $_SERVER['REMOTE_ADDR']; if ($stmt = mysqli_prepare($dbconn, 'INSERT INTO visitors(user_email, user_ip) VALU...

CakePHP: How can I disable auto-increment on Model.id?

CakePHP 1.3.0, mysqli I have a model, Manifest, whose ID should be the unique number from a printed form. However, with Manifest.id set as the primary key, CakePHP is helping me by setting up auto-increment on the field. Is there a way to flag the field via schema.php and/or elsewhere to disable auto-increment? I need just a plain, o...

PHP - regular expression to remove beginning and end chars from a string?

Let's say I have a string like so: $file = 'widget-widget-newsletter.php'; I want to use preg_replace() to remove the prefix widget- and to remove the suffix .php . Is it possible to use one regular expression to achieve all this? The resulting string should be widget-newsletter. ...

Regular Expression to parse SQL Structure

I am trying to parse the MySQL data types returned by "DESCRIBE [TABLE]". It returns strings like: int(11) float varchar(200) int(11) unsigned float(6,2) I've tried to do the job using regular expressions but it's not working. PHP CODE: $string = "int(11) numeric";<br/> $regex = '/(\w+)\s*(\w+)/';<br/> var_dump( preg_split($...

Anyone has sample code that connects two socket in PHP?

I'm trying to write a php code that acts as a server. All it would do is connects two socket, it opens a file socket and pipes everything from it into another socket that it connects to. It would run 24/7. I'm not familiar with PHP but this project requires it. Any help? ...