php

Mod-Rewrite or PHP router?

I am debating routing my requests with one of the two options: Option 1: simple capture route with Mod-Rewrite and funnel written $_GET route to index.php for loading... #default routing RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^blog/([0-9]+)?$ index.php?rt=blog&params=$1 [L,QSA] // ....

How can Multi-image TIFF files be split with PHP?

I've got a client who needs me to use PHP to split a TIFF image (which contains 2 or 3 images, sort of like an animated GIF) into its component images. Can ImageMagick or one of the other graphic libraries do this? ...

Cake Application Video Tutorial

Anyone know any good cake app build video tutorials? m ...

Is there a library that emulates facebook's "Link Detect"?

I'm looking to write a library that "parses" information like facebook does when you post a link. However as I don't want to reinvent the wheel does anyone know of a library or and effort to write an Library that does this already? I have included an example so that you can get a grasp of what I mean if you don't use face book. ...

many-to-many relationship in doctrine

I've got some tables on my system like these: news --id --title --content video --id --title --url album --id --title Now, I need to do a many-to-many relatioship with this tables, but in a flexible way. I created a table called 'links' with the below structure: links --parent_entity (example: news) --parent_id (example: 5) --chi...

Xdebug configuration with PHP fastcgi and eclipse?

I have been using eclipse-pdt in conjunction with xdebug and apache without problems, for over one year. Things worked flawlessly and I could do all the interactive debugging I wanted from within eclipse (using my own machine as a server). Now I switched from apache to nginx (and therefore PHP runs now not as an Apache service but as fa...

Wildcard mapping for ASP.NET and issues with PHP

Hey all! I have an application written in .NET 3.5 with C# as the language. I'm using Web Forms, but using url routing with the routes defined in my global file. Everything is working as expected. In order for the pretty paths (see: user/665 instead of user.aspx?uid=665) to work properly, I had to add a wildcard mapping in IIS5.1 (local...

Echoing a string that contains PHP (in WordPress)

I have a custom field in WordPress called "thumb-url" which contains the exact location of an image. I want to only display the image if "thumb-url" contains the location of the image. I'm start with an if statement that echoes photo exists if there's a value in the "thumb-url" custom field, otherwise it does nothing. <div class="excer...

Zend Framework: How to retrieve the id of the last inserted row?

I'm inserting a new row into my database with this code: $data = array( 'key' => 'value' ); $this->getDbTable()->insert($data); How can I get the row id of the this row that I just created? ...

Problem with FFMPEG and PHP

I know this isn't exactly a programming question per se, but rather a settings question, but still: I'm trying to convert video with FFMPEG with a PHP script, following this tutorial: http://vexxhost.com/blog/2007/05/20/how-to-convertencode-files-to-flv-using-ffmpeg-php/ FFMPEG works perfectly and I've used it from the command lin...

Does php run faster without warnings?

Since PHP code will run just fine even if it's riddled with warnings and notices about undefined indexes and non-static methods being called as static, etc, the question is, if I spend the time to remove ALL notices and warnings from my code will it run significantly faster? ...

Convert Array to Object PHP

How can i convert an array like this to object? [128] => Array ( [status] => Figure A. Facebook's horizontal scrollbars showing up on a 1024x768 screen resolution. ) [129] => Array ( [status] => The other day at work, I had some spare time ) ) ...

Doctrine - subquery in from

I have query in mysql: SELECT * FROM ( SELECT COUNT(*) AS count, t.name AS name FROM tag t INNER JOIN video_has_tag v USING (idTag) GROUP BY v.idTag ORDER BY count DESC LIMIT 10 ) as tags ORDER BY name and I want to write this in doctrine. How I can do that? I wrote: Doctrine_Query::create() ->select('...

why this PHP class is not working

see class Browser{ var $type = ""; public function e(){ return $this->type; } } when use $b = new Browser('human'); echo $b->e(); and i maen type not appear and i make it human as new ArchiveBrowser(the var type); ...

Simple php if query to double check

Is anything wrong with this code? <?php $variable = ; if (isset($variable)) { echo $variable ; echo "also this" ; } else echo "The variable is not set" ; ?> also, the other potential value of the variable is : $variable = <a href="http://www.mysite.com/article"&gt;This Article</a>; To clarify, I have a variable that may hol...

Line breaks causing php bugs?

I have a php form process script that wasn't saving correctly on our live or test severs but was working in my local test environment. I committed some trivial changes to the file and it started processing correctly. I then reverted those changes and thing still worked correctly. I'm wondering if there was possibly some line breaks / n...

PHP: Variable empty or not set or what?

What is the difference between these four PHP statements? if (isset($data)) { if (!empty($data)) { if ($data != '') { if ($data) { Do they all do the same? ...

File extension is striped when storing a specific filename in MySQL

I have three files: 1. moodsLogo.jpg 2. Copy of (images').jpg 3. Moods logo (Custom).jpg and I have the following code: // (..) some code here $fileName = valid_filename($_FILES[ 'Filedata' ][ 'name' ]); $bl->updateFieldValue("tableName","columnName",$fileName, $id); function valid_filename($filename) { $filename = str_repla...

jQuery plugin to choose thumbnails from external links (like facebooks "attach link")?

I am looking for a jQuery plugin with PHP script to do the same as in facebook "attach link" action, where facebook gives the user a list of thumbnails from the external link to represent the link. thanks! ...

Escaping double quotes in php

I have the following variable being dynamically set by user generated content: $variable = '<a href="http://www.mysite.com/article"&gt;This Article</a>'; When this variable is set, I then echo it as such echo $variable; I know that as is, this wouldn't be valid because I would need to escape the double quotes etc. Is there a way t...