php

Removing the text from drupal custom menu

Hiya, I'm trying to style a custom menu within drupal. I've sucessfully styled to display a background image, but the problem is that the menu item title still displays. So I get a nice image, with blazoned all over it. Is there a template function I could use to format the custom menu and remove the text portion from the hyperlink...

Why is there a warning of permission denied but successfully opened the file anyway?

I tried to open a file with fopen() function in PHP and it output warning of failure to open stream: permission denied. You know that warning / error you encounter when apache doesn't have enough privileges to open a particular file. However despite the warning message being displayed, my PHP script successfully opened the file and wrot...

codeigniter pagination Problem

I want to paginate query results in CodeIgniter to look like this: Problem 1 : The Pagination class always outputs numeric links. I just want to show next and back links. Problem 2 : $data['links'] = $this->pagination->create_links(); returns all of the links as a string. How can I separate the next and back links and put next t...

Eclipse “must-have” development tools/plugins for PHP

According to this post, i ask $title. Which are your favorite PHP coding related Eclipse plugins? Without you can't live? Why? I list my own plugins of choice: Eclipse PDT Mylyn Subclipse Which are yours? ...

Header only retreival in php via curl

Actually I have two questions. (1) Is there any reduction in processing power or bandwidth used on remote server if I retrieve only headers as opposed to full page retrieval using php and curl? (2) Since I think, and I might be wrong, that answer to first questions is YES, I am trying to get last modified date or If-Modified-Since head...

Can I setup a WAMP Virtual Machine on my guest OS that uses files from my Windows host?

I'm on a desktop PC, so I dont need Apache, MYSQL, PHP to run all the time on my main PC. Also I have all the good tools (adobe cs4, etc) on my XP box and they wont run on my Win2000 VM Guest, plus they would require another license even if they did. I'm not sure if its worth the trouble but figured I'd ask before I try to figure out how...

Minify CSS using preg_replace

Hey folks, I'm trying to minify multiple CSS files using preg_replace. Actually, I'm only trying to remove any linebreaks/tabs and comments from the file. the following works for me: $regex = array('{\t|\r|\n}', '{(/\*(.*?)\*/)}'); echo preg_replace($regex, '', file_get_contents($file)); But I'd like to do it in a single multiline r...

Mathematical problem help.

I have some code where, if a user has referred X number of people, he will get X number of credits. For example, referring 2 people = 1 credit. 4 people = 2 credits, and so on. However where this gets tricky is, the numbers can be changed so he gets 1 credit per person, or 1 credit per 3 people, 1 credit for 5 people, etc. If he gets ...

Normalization or Alternative with MySQL

Hi, building a site using PHP and MySQL that needs to store a lot of properties about users (for example their DOB, height, weight etc) which is fairly simple (single table, lots of properties (almost all are required)). However, the system also needs to store other information, such as their spoken languages, instrumental abilities, et...

Consume WebService with php

Can anyone give me an example of how I can consume the following web service with php? http://www.webservicex.net/uszip.asmx?op=GetInfoByZIP ...

New line formatting when using HTML file as Word file?

I'm writing a PHP application for a client that needs a pre-existing HTML page I've already created to be "exported" as an Word file. Simply, this is how it's done: if (isset($_GET["word"])) { header("Content-type: application/vnd.ms-word"); header("Content-Disposition: attachment;Filename=some_file.doc"); } This, of course, will ...

reuse of resource in another sql statement

hi, i am using php with mySql server, pretty new to all the sql and i have a question: i have a query: $book_copy_user = "SELECT * FROM copy_book " . "JOIN copy_user_own " . "ON copy_book.copy_id = copy_user_own.copy_id " . "WHERE copy_user_own.user_id=1"; $res1 =mysql_query($...

How can I get rid of this PHP notice?

I am trying to improve my php code sitewide which is going to take forever because I want to be able to have error reporting on to show all and have no notices. In this little bit of code below on line 6, $selected_ date_ month This code is just a portion of code from a larger function, so sometimes $selected_ date_ month is passed ...

Once I determine a var exist in PHP do I need to keep checking it in that page?

I have a basic PHP question, take the code below for example, let's say I need to use this 10 times on a page, is there a better way to do it? I realize I could wrap it in a function and just keep calling that function but is there a better way then to keep on checking if the item is set and equals a a certain value. After finding thi...

PEAR alternatives in other languages

Is there a good class repository like PEAR for PHP for other languages such as Ruby or C#? If so what are they? Are they any good? ...

How to get a SOAP post in PHP?

OK n00b here with SOAP, Would like some clarification on how to use SOAP. Question: I have a Java JSP that posts a WSDL (Looks like XML format) to my PHP script, but how do I get this in the PHP script? The URL for the WSDL will be different every time. I'm sure it's very simple but just don't see how or am I not understanding this c...

How do I restore this script after a hardware failure?

Hi there, I know this is a bit generic, but I'm sure you'll understand my explanation. Here is the situation: The following code is executed every 10 minutes. Variable "var_x" is always read/written to an external text file when its refereed to. if ( var_x != 1 ) { var_x = 1; // // here is where the main body of the script ...

Regex for html attributes in php

Hi, i'm trying to parse a string of html tag attributes in php. There can be 3 cases: attribute="value" //inside the quotes there can be everything also other escaped quotes attribute //without the value attribute=value //without quotes so there are only alphanumeric characters can someone help me to find a regex that can...

Why should I use bitwise/bitmask in PHP?

I am working on a user-role / permission system in PHP for a script. Below is a code using a bitmask method for permissions that I found on phpbuilder.com. Below that part is a much simpler version w3hich could do basicly the same thing without the bit part. Many people have recommended using bit operators and such for settings and ...

PHP: testing session

Why is the construction brittle? I tried "!empty ( get_original_passhash() )" as a condition, but it ignites the error that you cannot use the return value. if ( get_original_passhash () != '' ) { set_login_session ( get_original_passhash() ); }else print("Please, log in."); ...