php

PHP SimpleXML with xpath

I have a small XML file: <wddxPacket version='1.0'> <header/> <data> <struct type='coldfusion.runtime.ArgumentCollection'> <var name='HEADLINE'> <string>Richard Barret's Articles on Leadership and High Performance Organisations</string> </var> </struct> </data> </wddxPacket> I'm trying to use PHP Simp...

Smart way of resizing images in PHP

Hello guys. I was wondering if someone can help me with an image resize function written in PHP but one wich has to resize an image, but in a manner like PHPThumb does. So, if I set the width and height of the new image, the function must fit the uploaded image (and mantain aspect ratio) in the new width and height. Any help is apprecia...

How to create HTML button based on condition?

I am using following code: <?PHP if ($_Session['WorkMode'] == 'New' || $_Session['WorkMode'] == "") echo "<input id='Submit' name='Submit' value='Submit' type='button'>"; else echo "<input id='Update' name='Update' value='Update' type='button'>"; ?> Is this the correct way to render buttons? ...

Wordpress posts don't show up

I recently moved my wordpress to a new host and I get the following error on the home page: Not Found Sorry, but you are looking for something that isn't here. The corresponding code (in index.php) is: <?php if (have_posts()) : while(have_posts()) : the_post(); ?> ... <?php endwhile; else: ?> <h2 class="center">Not Found</h2> ...

zf 1.9.6 zend_soap: Function ("doString") is not a valid method for this service

Hello. I'm trying to work with Zend_Soap using zend framework 1.9.6 and php 5.3.1. soap.php (wsdl generator) <?php require_once('Zend/Soap/Server.php'); require_once('Zend/Soap/AutoDiscover.php'); require_once('Soaping.php'); $_WSDL_URI="http://server/soap/soap.php?wsdl"; if(isset($_GET['wsdl'])) { hadleWSD...

Best Book for Wordpress Developer and CMS Development

Hi , I start a new job on the 4th of jan and I need two books one on Wordpress for developers and one on CMS maybe focused on a certain CMS would be good does any one have any recommendations for a good book? ...

To change template through Ajax in Symfony

there are two templates i am using for view and edit(is having the form to update), the view will contain edit(link or button), on clicking the edit button i want that the edit template should be loaded (using Ajax, without refreshing the page). and after editing it should be redirected to view again (using ajax same as above). is there...

PHP: Why Many Types of String Types And Multiple Implementations Of functions?

Hello All, A number of people are unhappy with the current implementation where there are either too many different string types (binary, string, unicode) or the multiple implementations of many internal engine functions and helper functions. Minutes PHP6 Developer Meeting This is for the PHP gurus. Do we really nee...

post variable problem

I'm working on a web site which creates images online ... there is an SWF which sends variables via post to PHP, and it works fine on my PC but when I test on the server, there are missing variables, specifically the one which contains the colour of the pixels in the image (biggest image is 77 kb). I have set up post_max_size = 32M Any...

Solr PHP client vs file_get_contents?

I am using PHP to access Solr and I wonder one thing. Why should I use Solr PHP client when I can use: $serializedResult = file_get_contents( 'http://localhost:8983/solr/select?q=niklas&amp;wt=phps'); to get the result in arrays and then print them out? I don't really get the difference. Are there any richer fe...

How to force page not to be cached in PHP?

I have a page, index.php, that shows information based on a mysql db. There are forms on it, and the action for the forms is set to a separate page called process.php. Process.php does all the database CRUD stuff, then uses header("Location: /webadmin/email/index.php"); to send the user back to the original page. This seems to be ...

get solr object fields in php?

with solr php client you can get results from solr. if ($results) { $total = (int) $results->response->numFound; $start = min(1, $total); $end = min($limit, $total); echo "Visar: " . $start . " - " . $end . " av " . $total . "<br />"; // iterate result documents foreach ($results->response->docs as $doc) { <<...

Integrate Python app into PHP site

This might sound really crazy, but still... For our revamped project site, we want to integrate Trac (as code browser, developer wiki and issue tracker) into the site design. That is, of course, difficult, since Trac is written in Python and our site in PHP. Does anybody here know a way how to integrate a header and footer (PHP) into th...

how to search in multiple fields with solr php client?

when i do a standard search it just search for one field type. $results = $solr->search($query, $offset, $limit); when i try this: $params = array('qf' => 'threads.title posts.body'); $results = $solr->search($query, $offset, $limit, $params); it still doesnt work. any idea? ...

PHP Filtering Form Input

Hey All, I'm sure someone has covered this before, but I didn't find it in a quick search of the site. Right now I'm trying to filter some input from a WYSIWYG, so that it will remove characters like: ¢©÷µ·¶±€£®§™¥ but keep HTML characters. I've tried htmlentities and htmlspecialcharacters, but that still seems to leave those characters...

Are switch case statements flexible?

Hi I have created the following code so when a user chooses a department (Sales, Billing, Marketing, Finance, etc) and uses the contact form I created, the e-mail is sent to the proper person in the company. <?php $ip = $_POST['ip']; $httpref = $_POST['httpref']; $httpagent = $_POST['httpagent']; $visitor = $_POST['visitor']; $visito...

Is there a way to force a new line after php closing tag ?> when embedded among html??

I have been searching online with little success for a way to force php to output a newline after a closing php tag ?> so that my HTML will be rendered as I see it before its parsed by PHP so that it will look neat and tidy when viewing the html source code for a page. I want to stop it from removing the newline and causing the next lin...

solr php client search method: use to search word1 OR word2?

i use solr php client. but when i use the search method: $params = array('qf' => 'threads.title posts.body', 'defType' => dismax); $results = $solr->search($query, $offset, $limit, $params); when i use defType = dismax it searches $query = 'Peter Jakob' as the whole string instead of Peter OR Jakob. it works fine when i dont use the...

codeigniter multiple file upload

Hello, I am trying to get a multiple upload library working for my codeigniter based website, I have it working almost but I have a slight problem if I upload more than one image, the file extentions get screwed up, for example, if I upload three JPEGS, I get this in my uploads folder, image1.jpg image2.jpg.jpg image3.jpg.jpg.jpg I ...

using glob to return a list of folders in a given directory (without paths)

The function below returns all folders in a given directory down to multiple levels. I only need one level depth though, just folders in the target directory, no subfolders. Also the function returns the full path to the folder, I only want the folder name. I'm sure I'm missing something simple. How can I modify the function to retu...