php

Yii framework Many to Many relationships..

What is the method to save and update Many to Many relationship in Yii framework? ...

javascript showdown, markdown not parsing correctly

I have a little confusing problem. I have two files, both that run showdown however it seems that only one file parses correctly. Here's the deal. File 1 . Is run through php and ajax File 2 . Is grabbed via an ajax request, the file the processes the ajax request contains this code. Here is the ajax as you can see, the jquery that...

How to continue process after responding to ajax request in PHP?

Some operation takes much time, which leads to ajax request to time out, how to I finish responding to the request fisrt, then continue that operation? ...

Magic functions and inheritance

I would like to know if it's possible to create a magic object that extends another magic object, (with PHP). ...

What happens first in PHP, includes or parsing?

Assume no byte cache. Will the my_func be parsed before a & b are included, or after? $x=my_func(); //a.php and b.php are **very** heavy scripts include ('a.php'); include ('b.php'); //my_func makes the browser use it's cached version of the page. function my_func(){ //send caching headers //header(....); exit; } ...

Superimposing images in PHP

Is there a PHP function that would allow me to superimpose an image over another one? If not, how can I accomplish this (not asking for code, just a list of steps)? ...

Apple Push Notification Service

i tried to run using local mac machine but go the following errors Warning: stream_socket_client() [function.stream-socket-client]: Unable to set private key file `/Applications/XAMPP/xamppfiles/htdocs/apns/apns-dev.pem’ in /Applications/XAMPP/xamppfiles/htdocs/apns/apns.php on line 9 Warning: stream_socket_client() [function.stream-so...

Create an HttpRequest from environment

Can I get a HttpRequest automatically created from the environment? In other words, right now it seems like you have to... $request = new HttpRequest; $request->setCookies($_COOKIE); $request->setHeaders(apache_request_headers()); $request->setPostFields($_POST); $request->setQueryData($_GET); $request->setRawPostData(file_get_contents...

Simple TCP server using select(), why is "longest request" so high?

I am implementing a simple TCP server using the select() method - everything is fine and performance is quite acceptable, but when benchmarking with ab (apachebench) the "longest request" is insanely high compared to the average times: I am using: ab -n 5000 -c 20 http://localhost:8000/ snippet: Requests per second: 4262.49 [#/sec]...

How To rewrite a url with PHP?

Let' say for example one of my members is to http://www.example.com/members/893674.php. How do I let them customize there url so it can be for example, http://www.example.com/myname I guess what I want is for my members to have there own customized url. Is there a better way to do this by reorganizing my files. ...

Why is WordPress considered to be poorly programmed?

I'm not a fan of PHP or spaghetti code, or anything like that, but in my experience WordPress works amazingly well, it's well organized, and I've never come across any hard to understand code. The documentation is incredibly thorough, any security flaws are fixed within seconds, and it "just works". Not to mention that it does EVERYTHING...

Drupal » Print taxonomy terms

Hi all, I'm theming a node-MyContentType.tpl and I would like the ability to 'print' only a specific Vocabulary. In other words, I would like something like that: <Title> <Vocabulary [1]> <Body> <Vocabulary [2]> I think it should be fairly easy, but I'm struggling.... Ideally, I would love to pass arguments to: print the "label" ...

FTP server deatails according to domain

Hello, What I am trying to accomplish is getting relative and absolute paths to files, images and folders that reside on a remote server. I have website address, and FTP details (these are required when signing up). What i need to know is whether the FTP details correspond correctly with the website. Firstly I used (this is all in PHP...

$_SERVER["SERVER_NAME"] not showing www.example.com

Why does $_SERVER["SERVER_NAME"] not echo the www in www.example.com but it does work when I echo it from a sub domain like test.example.com? ...

Trying to find groups of letters with regex

Hey everyone, I need to find 1 or more defined groups of characters enclosed in parentheses. If more than one group is present it will be separated with a hyphen. Example: (us) (jp) (jp-us) (jp-us-eu) I've figured out how to find the group if the string only contains one group: /\(us\)|\(jp\)/ However, I am baffled when it comes ...

Why is CakePHP inserting a space before my xml layout?

I am having a really frustrating problem in CakePHP where a space keeps coming up at the beginning of my KML file layout which causes Google Earth to reject the KML file! <?php header("Content-disposition: attachment; filename=area.kml"); header("Content-Type: application/vnd.google-earth.kml+xml kml; charset=utf8"); header("Content-Tra...

Is it possible to see if a class calls a method without first instantiating it?

I'd like to know if a class is going to call a certain method, but I want to know before instantiating the class. Is this possible? Example: class Controller_Index calls $this->composite('SomeCompositeClass') within its __construct() method. Class SomeCompositeClass has a helloWorld() method. I want to see if I can call Controller_Inde...

Drupal6: Every node view of a certain type leads to 404 error

For some reason, trying to view any node of a certain content type leads to a 404 error. When viewed in a View table, they display just fine. What could be happening? Viewing the database with phpMyAdmin shows the data just fine. The problematic node type was created with CCK. ...

Does refreshing a page destroy PHP sessions?

I've got a captcha command that sets the value of a Session and then refreshes the page if the captcha code isn't correct. In verification section of the page: $_SESSION['refresh']=1; echo '<META HTTP-EQUIV="Refresh" Content="0"; URL="contact-test.php">'; When the page loads it runs a bit of php script to see if there is a value set ...

PHP: how to check for value from array A in array B w/out loop

Two associative arrays A and B: how do I check if any value of from array A exists in array B without a foreach or any other loop? Is this possible? There is array_key_exists and in_array but they search for values in an array, not values from an array in another array. Hope this makes some kind of sense :) ...