php

how to structure a list filtering clean url for usability and seo?

I am a big proponent of using super clean urls for all pages and lists. Generally my pagination urls are just example.com/section/page/2 and tags are example.com/tags/tagname. I generally even try to leave the row id out of the url. But how would you guys suggest doing a filter list? Say you have a list of cars and you want to sort by ...

Beginning Zend Framework

I've read a couple of Related questions by the site, but can't find what I'm looking for. After having done normal PHP without much extra(by which I mean a templating system) for a year now, I feel like trying Zend. Simply because it's the biggest name. I wanna try CakePHP too later. I've been looking into the examples, but these are a...

How to restrict drupal search from indexing all content types?

I only want certain nodes to be indexed. The "search config" module claims to have this capability, but it doesn't work. So, how do I either edit the node module to only index certain nodes, or better yet, impliment a module that can do this for me? ...

Remove duplicates from multi-dimensional array based on higher points

Hi there, I'm racking my brains trying to think of a solution. I can find plenty of solutions to remove dupes from a 2d array but I need to remove dupes where a value is lower than the other. Here is the array: Array ( [basketball] => Array ( [0] => stdClass Object ( [id] => 2...

Regex to move image in markup with PHP when publishing content with TinyMCE

Hi guys, I am using TinyMCE to publish content to my site. I have the problem whereby I can only insert an image inside another element, eg a paragraph, even if I place the cursor at the end of the content. So, when I publish the content, I currently end up with markup like: <p>Text content <img src="blah" /></p><p>Another paragraph</...

(Game Engine) Framework Design

Hi there, I am currently working on 2D browser game. After putting the ZendFramework away, my team and I decided to write our own framework. Now we are helpless, because none of us has ever developed anything similar, except CMS frameworks etc. The language is PHP and the database driver used for it is MySQL(i, PDO, etc) Can you giv...

how to properly use quotes in javascript

I am using a bit of JavaScript like this: echo '<a href="javascript:playSong'."('$row[artist]','$row[title]','$row[sourcefile]')".'">'; My problem is that sometimes my $row[artist] and $row[title] variables contain double qoutes. When this happens it breaks the javascript:playSong(); function call. For example if the line was output...

How to limit the the number of row retrieved from an associated table in CakePHP?

Assuming two database tables: Funds and Prices, in which Funds hasMany Prices. What I wanted to do is to retrieve the latest 15 prices of a particular fund in a certain scenario. Is there a means in CakePHP to make a $this->Fund->find('all') call that would allow me to limit the number of rows to be retrieved from the associated Price t...

Zend DB Table ? Or SQL by your own?

Hi Folks, how do you handle middle sized projects with PHP and Zend Framework. Do you use Zend DB Table / Row for your Models and Database operations ? Or do you have some kind of Abstract Model class with your SQL Statements ? I would like to hear some opinions, thanks. ...

image upload script to make thumbnails and getting unwanted posterized images

I have an image upload script, and the thumbnails that its producing are posterized and of poor quality. Im not sure which specific function in the script alters this so ill post the whole thing. if (isset($_POST['submitted'])) { $idir = "images/"; // Path To Images Directory $tdir = "images/"; // Path To Thumbnails Directory $tw...

Script injection - form validation (jquery)

I use several forms on my site to send data to MySQL. Which is the best way / method to validate my form, if I don't want to users send any script to the database through my forms? ...

HTML-PHP Uploader Query

well, for a college project I'm designing an uploader site (u give it a file, it uploads it...kinda like imageshack or mediafire). Anyway, I got the whole thing working well with a html form and a php script to store the uploaded file in a "/uploads" folder. now here's the thing.....I want to have a drop down list in HTML section, and d...

How to generate multiple levels with GraphViz (Image_Graphviz interface for PHP)

Hi, i'm trying to generate the following diagram using Image_GraphViz for PEAR. However It only shows a top-level node (with the text "0") and childnodes "1", "2", "3" and "4" directly under the top-node. Am I missing something? This is the code: $gv = new Image_GraphViz(true); $gv->addEdge(array('1', '2')); $gv->addEdge...

Letting users register to website, PHP

Hello I have my website and it's form is like this: Information More information Yet more information I want to allow users to register a username a password so that they can log in and leave comments on the items 1,2,3 etc. Each item of information is stored in a mysql table, so to generate the page, each item 1,2,3 etc is a row/rec...

MySQL Order by math

Hello There, I want to order a result by fieldx * fieldy, for example: Row 1: fieldx = 10 fieldy = 10 Total: 100 Row 2: fieldx = 11 fieldy = 5 Total: 55 Row 1 has to appear first. Couldn't find anything about it. It's for a codeIgniter project, so if there is a solution with that I'm very happy. Thanks! ...

How best to handle time arithmetic for a scheduling app?

Im building a bus schedule app. In the mysql db I have a 'time' field that is static - let's say 15:23 which is the scheduled time for the bus and never changes from one day to the next - the bus always comes at 15:23. It's 3:20 PM and the user is running for the bus stop. How do I present the user with "The next bus is in 3 minutes" T...

If libcurl is enabled, can i assume that all setopt options are available?

If server has php libcurl enabled, does it have all setopt options available (unless something new was added in new libcurl version and server didn't upgraded, of course) or is it possible for admins to turn off parts of functionality? I'm especially thinking about CURLOPT_HTTPHEADER - can i assume that if i'll be running my script on s...

PHP XML: How to check if TAG exists inside XML

How do i check if a TAGname exists inside an XML file. so if i want to get $dom->getElementsByTagName('error') and it doesn't exist, it prints out something like an error message. EDIT: I'm working from an API. So what happens is when a user enters an incorrect username, another XML files is loaded that contains the tag <error>. H...

Troubleshooting PHP Mail

How can I check a problem with mail being sent on my server? I run a simple test: if(mail($to, $subject, $message)) { echo 'Mail Sent'; } which the test outputs the text. But no mail ever arrives. How can I go about tracking down the issue? Thanks Rich ...

file_get_contents() GET request not showing up on my webserver log

I've got a simple php script to ping some of my domains using file_get_contents(), however I have checked my logs and they are not recording any get requests. I have $result = file_get_contents($url); echo $url. ' pinged ok\n'; where $url for each of the domains is just a simple string of the form http://mydomain.com/, echo verifie...