I'm trying to get Drupal 6 to reverse the order in which the nodes appear in the frontpage. I'm pretty much using "Story"s as a blog engine and so far it has done it's job pretty well. I'm a bit annoyed though at the fact that nodes are listed in reverse chronological order. I mean, granted, if you want to display multiple node previews ...
I program in PHP mostrly and Ruby sometimes I happen to be in need of a way to implements those "hash arguments" into my PHP funcions (Like, say, an HTML select helper)
draw_select :name => :id, :onclick => 'alert(this.value)'
The problem in PHP is that I would have to define an argument order to implement many possible attributes.
I...
I have a database class that automatically sets up a connection to the database and does some basic input filtering and whatnot. I am looking at setting some predefined constants to adjust the behavior of the class methods. What should I set the values of the constants as? Since the values will never be referred to, or compared, direc...
I've wrote a quick PHP class to ease the access to a mysql database. The class works ok, and has a query() method that opens up the connection, executes the query and then closes the connection (I know that the connection is supposed to close by PHP itself after the script finishes, but I don't like to rely very much on that).
From a pe...
Hi there.
I'm basically new to PEAR (and PhpDocumentor); I installed PhpDocumentor using the PEAR CLI, and everything seemed to go fine... until I went to use it, at which point I got the following error:
Warning: require(PhpDocumentor/phpDocumentor/phpdoc.inc):
failed to open stream: No such file or directory in
/usr/local/bin/phpdo...
Can someone tell me why when I cast a string of say 00332 I only get back 332? It removes the leading zeros and saves the data in the same format.
Thanks
this->_gate = (string) $this->_linkID->QuoteSmart($gate);
...
I have built Web sites with Python/Django and desktop applications with Objective-C/Cocoa so programming is not something that I need to learn. For someone in my situation, what is the best way (specific books or Web sites) to learn PHP and Javascript?
...
I'm trying to work out how to iterate though a returned SimpleXML object.
I'm using a toolkit called Tarzan AWS, which connects to Amazon Web Services (SimpleDB, S3, EC2, etc). I'm specifically using SimpleDB.
I can put data into the Amazon SimpleDB service, and I can get it back. I just don't know how to handle the SimpleXML object th...
How can I do a RAW POST in PHP using curl. Raw post as in without any encoding, and my data is stored in a string. The data should be formatted like this
... usual HTTP header ...
Content-Length: 1039
Content-Type: text/plain
89c5fdataasdhf kajshfd akjshfksa hfdkjsa falkjshfsa
ajshd fkjsahfd lkjsahflksahfdlkashfhsadkjfsalhfd
ajshdfhsa...
Is there any difference or associated risk opening with the following PHP variations?
<? echo "hello world!"; ?>
<?php echo "hello world!"; ?>
<?="hello world!"?>
Also, is it necessary to close all scripts with ?>
...
I was wondering is there a way in PHP that you could tell where a form was submitted without using hidden fields or anything of the like where the user would only need to tamper with the html a little?
For example i am trying to work out if a form that was submitted was actually on my website or whether the form was saved offline and sub...
Hey there, quick question here. I'm sure there's a simple answer.
Coming from PHP, I'm used to declaring a function with a default argument value like this:
function myFunction ($array, $sort = FALSE) {
}
I the sort parameter wasn't filled, the function would continue with the default value of false. In Obj-C, is there a similar t...
My workplace consists of a lot of cowboy coders. Many of them are junior. Which coincidentally contributes to a lot of code quality issues.
I'm looking for suggestions on how to best wane my team into using TDD (we can start with Unit tests, and move into regression tests, and later more automated testing).
Ultimately, I want us to l...
Hello, it seems pretty simple but I can't find a good way to do it.
Say in the first page I create a variable
$myVariable = "Some text";
And the form's action for that page is "Page2.php". So in Page2.php, how can I have access to that variable? I know I can do it with sessions but I think it's too much for a simple string, and I do ...
Someone remind me why "." is not used as the namespace separator? I don't think the "." character is used anywhere else in PHP at all, unless I am mistaken.
...
I'm trying to get the php executable to parse scripts, but it's not working. i run something like this:
php c:\test.php
and test.php contains this:
<?
echo 'hello!';
?>
and that is exactly what running the command returns. It returns the raw code. How can I get it to actually parse the code and return "hello!" instead?
...
This code gives me an empty result. I expect it to print out the titles from the XML-file. I need to use Curl to get the file.
<?php
function get_url($url)
{
$ch = curl_init();
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_URL, $url);
$data = curl_exec(...
I have a user registration form in PHP .I put captcha image check in the page.I used it like this
<img src="captcha.php" alt="Enter this text in the adjacent text box" id="imgCaptcha" />
and in my javascript i will validate this with the same number which is generated in the image (from captcha.php page) . That number was set in a se...
Hi guys, this may come as pretty odd but I'm now working on a membership based website where users sign up and choose mode of membership which would be on monthly, quarterly or yearly payment basis. Its going to be paypal based. However despite having worked 5 years I haven't ever working on any ecommerce project before :\ instead I've w...
Trying to replace this jquery code with some php server side magic:
$(document).ready(function() {
$('#text img').each(function(){
source = $(this).attr('src');
$(this).wrap($('<div class="caption '+ $(this).attr('class') + '"></div>')).removeAttr('class').removeAttr('height').removeAttr('width');
$(this).after('<p>'...