php

Is the RainTPL template engine good?

Hi my great friends, I'm searching for a small Templates Engine for a small site and I found RainTPL 1.7.1 and I want your opinion on it. Can I use it or do you think its not fast and not that good? ...

show last 5 posts that have <!--more-->

I want to show last 5 posts in a wordpress page, but when i use this code it will return the whole posts body, while i have <!--more--> in my post and I want to show till this part. here is the code that I am using : <div> <ul> <? query_posts('showposts=5'); ?> <?php while (have_posts()): the_post(); ?...

Having includes with variables in two places at once.

Hello, I have a small situaton here. I'm building a custom CMS for one of my websites. Below is the code for the main index page: <?php require("includes/config.php"); include("includes/header.php"); if(empty($_GET['page'])) { include('pages/home.php'); } else { if(!empty($_GET['page'])){ $app = mysqli_real_escap...

PHP - How to parse this xml?

I'm trying to parse the XML below so that I wind up with an array that looks like the sample included... I'm having a hard time figuring out how to get the attributes inside of the tags to output the way I want it to... The XML <cust rid="999999" memberid="12345" lname="Doe" fname="John"> <address memberid="12345" address1="1234 M...

How do I parse XML responses from google checkout?

I have seen the XML response from google checkout when an order is processed here. I have also seen the google responsehandlerdemo.php file which I've copied below. I cannot figure out where I am supposed to insert the code that I will use to update the inventory levels on my shop. Can someone point me there? I also am not quite sure h...

How to check if a value is listed in a database using MySQL and PHP?

I was wondering how can I check to see if a web page is listed in a database and if its not add it to the database. How can I do this using PHP and MySQL. Sorry if I'm vague I'm new to PHP and MySQL. ...

PHP MySQL inserting data to multiple tables

Hi, I'm trying to make an experimental web application which minimises redundant data. I have three example tables set up like so: Table one ID | created_at (unix timestamp) | updated_at (unix timestamp) Table two ID | Foreign Key to table one | Title Table three (pages) ID | Foreign Keys to both table one and two | Content | Metadata...

htdocs path in linux

Hello, I am working on linux server through ssh and want to know where to put html and php files (the htdocs folder) but its seems to me the servers is running lighttpd My directory structure looks something like this. ...

Apache, PHP and MySQL portable?

Hi, can I run Apache, PHP and MySQL on a External HD? I need this because I work in diferent computers, and sometimes I don't have installed and configured all aplications for use. ...

Debug PHP with Eclipse?

What is the best way to debug PHP with Eclipse? Specifically, I'm trying to work through some issues on a Drupal 6 installation. I like Eclipse's debugging for Java. Is there a way to do the same for PHP? ...

Writing unit tests for methods which have a degree of randomization

I'm using PHPUnit and my traditional approach is to use mock objects and methods that get called by the methods I'm testing. The mock objects are told what to expect as input by the unit test. The problem is that part of the input supplied to the mock objects are being randomly generated by the methods being tested (and the unit test has...

PHP and MySql hitcounter problem?

Okay I'm new to php and mysql I tried to build a web page hit counter but my page counter dosen't update correctly and it gets the following warnings listed below. Warning: mysqli_query() expects at least 2 parameters, 1 given in Warning: mysqli_num_rows() expects parameter 1 to be mysqli_result, boolean given in Here is the php code ...

How to post 1 line story to user's wall.

I've been looking but can't seem to find an answer for this. What I want to do is this: on mywebsite.com a user clicks a button this button sends a message to facebook ("Soandso has clicked the button") I want facebook to then post a 1 line story to that user's wall "* So and so clicked a button!" Now, I've tried using stream.publish...

Mail() with php

Hi, i wanna write a script sending e-mail to my client automatically using php How do i send it automatically, for example, if they enter their email. and click submit i wanna send this e-mail automatically And, second do i need smtp server on my host? can i just this in any free hosting? Thanks you guys and im so sorry for my lang...

file_exists() for a file that contains (&) in filename

$filename = "Sara & I.mp3"; if (file_exists($filename)) { ... } If the filename has a "&" PHP does not return true for file_exists How can I escape "&" in the $filename for the file_exists to work? Already tried urlecode(), urlrawencode(), htmlentities(), and escaping the '&' with a backslash (\&)... no go ps. this is on a linux sy...

XAMPP: I edited PHP.ini, and now Apache crashes

I'm trying to set up XDebug for PHP. I edited some settings in my apache\bin\php.ini file, and now Apache crashes every couple page requests. (I wish I had saved a copy of php.ini before editing it. der.) I was following instructions here: http://robsnotebook.com/php%5Fdebugger%5Fpdt%5Fxdebug Here is the only section I changed. Does an...

DOMDocument parsing (php)

Hello, I am parsing an xml file from an API which I have converted into a DOMDocument in php. This is mostly fine but one problem I have is when I do this: $feeditem->getElementsByTagName('extra'); as part of a forall statment and the element extra doesn't exist in one of the feeditems I am iterating through in the forall condition th...

problem with $_SERVER['PHP_SELF']

I have a link in one of my php pages where the friends of the logged in user are shown and there is a link like below for each of user's friends like this in this page: echo "<a href='profile.php?id=$row[friend_id]'>$friend_row[name]</a>"; and as you can see the friend's ID is passed to the profile page and in profile page the user ca...

Implementing Business Logic in 3 Tier Architecture

I have a web application I am working on and so far I have the data access layer finished. Each table has its own class that creates objects of rows of that table, so each object represents a row of a table. The functions each object has is basically CRUD operations. The question I have is, what is the best way to implement the business...

Adding a row to a table dynamically

$(document).ready(function(){ var refreshId = setInterval(function() { periodicRefresh(); }, 9000); }) . function periodicRefresh() { $.ajax({ type: 'GET', url: 'include/ajaxActions.php', data: "action=displayLastEvent", success: function(msg){ var newid = $(msg).attr("id"); ...