Hi,
I am trying to figure out, how to catch any method call on object in PHP. I know about magic function __call, but it is triggered only for method, that does not exist on called object.
For example i have something like this:
class Foo
{
public function bar()
{
echo 'foobar';
}
public function override($method_name,$met...
I am rendering a PDF correctly using SSRS SDK for PHP, and it is being displayed in viewer correctly. But, when I click the save button on the Adobe Reader, the dialog box shows the name of the source files name rather then the name I pass in via HTTP Header. here is my code:
header('Content-Type: application/pdf; filename="'.basename...
This ajax thing im working on is not doing what i tell it to do.
On the client JS side I alert everything that is sent through the request, and on the PHP side I print out everything that it receives. These two lists of variables are not the same. I do not understand why.
Here how I am sending the data (over post):
xhr.onreadystatecha...
This page shows many recent posts, instead I want it to show only the most recent. How would I remove this loop and replace it with a single iteration of the most recent?
<?php while (have_posts()) : the_post(); ?>
<div <?php post_class() ?> id="post-<?php the_ID(); ?>">
<span class="postmetadata"><?php the_cate...
I have a code that look like this.
$language = "eng";
$append = "_sidebar.txt";
$read_text_file = "languages\\$language$append";
$sidebar = file($read_text_file);
$smarty->assign("sidebar_link",$sidebar);
Why does all variables in smarty all look like this:
Smarty_Variable Object (3)
->va...
Basically, I would like a simple, easy, one-file way to parse an INI file with "advanced" features, like section inheritance and property nesting, like Zend_Config_Ini.
For example:
[foo]
a = 1
b.a = 2
b.b = 3
b.c = 4
c = 5
[bar : foo]
b.b = 17
c = 42
Would parse into
array(
'foo'=>array(
'a'=>'1',
'b'=>array(
'a'=>...
How could I recognize every linebreak? It doesnt put > on every new line.
I currently use this '> ' . str_replace("\n", "\n> ", $msg);
Output:
[i]Originally posted by DiSanti[/i]
> Lorem ipsum dolor sit amet, consectetur adipiscing elit.
> Morbi in nunc vitaemauris.
semper posuere sed nec metus. Phasellus fermentum mattis co...
I'm getting confused.
I was able to make openid login kinda work using LightOpenID.
All I get doing that is just an openid_identity such as "https://www.google.com/accounts/o8/id?id=xxx". Pretty disappointing: I was expecting to get the email address too.
i.e. I need to login (that's what openid does) and to know the email address of ...
I'm not a php developer but I'm fiddling with MAMP. I've installed MAMP and my php include() calls aren't working.
[13-Jul-2010 19:23:30] PHP Fatal error: require_once() [<a href='function.require'>function.require</a>]: Failed opening required '1' (include_path='.:/Applications/MAMP/bin/php5.3/lib/php:/Applications/MAMP/htdocs/mt_sand...
I have a server with a PHP script that pulls data from a source and populates a database. I need to call this PHP script repeatedly, each time with a different parameter.
I need to create a shell script on a Mac (which reads in a text file with the list of parameters - that part is not a problem) and for each parameter, runs the PHP sc...
Selenium, php, phpUnit, 404 error calls testComplete() rather than continue, how do I stop this?
I am using selenium server and phpUnit to run php based tests. My tests are simple, test the page is there, if it loads, has no errors on page and then move on. I have a missing page and rather than say, yep its not there and more on I get:
...
Question is in the title. I tried strip_tags, but that shows up blank and I tried using preg_replace, but I don't quite understand the syntax apparently..
Tried this
$test = "Home<i>\r</i><i>\n</i>";
$patterns = array();
$patterns[0] = '<i>';
$test = preg_replace($patterns, '', $test);
but echo $test is still...
Hello, this may seem like a stupid question, but it is stumping me nontheless. I'm sure that the answer is something small. I think it's just one of those situations where I have been looking at the code for too long.
I am trying to compare two PHP variables to see if they are the same. As you can see below, I am comparing $verification...
Is there a native or inexpensive way to check for the length of a string in bytes in PHP?
...
I'm trying to create a universal header for a website built on CodeIgniter, and I'm having trouble figuring out the code that will switch the 'Login' link for the user's name (with a link to the profile page) after the user logs in.
In the controller functions, I've tried the following code:
if(!$this->session->userdata($userSession...
I am using a wysiwyg editor in a web app. It is FCKeditor. In order to edit a file, other than loading javascript, my web form that edits the the file looks like this:
<textarea><?php include('myWebDoc.html') ?></textarea>
I also tried this:
<textarea><?php file_get_contents('myWebDoc.html') ?></textarea>
Both attempts end up parsi...
I'm developing a website using PHP and these strange chars "" appears in my page, right on the top of it.
My code is this:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><?php echo '';?>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-eq...
Not working:
$link = mysqli_connect("localhost", "********", "*******", "*******");
if (mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
}
$cmp = 126;
if (($stmt = mysqli_prepare($link, "SELECT datalock FROM sys_tenancy WHERE id=?"))) {
echo mysqli_stmt_bind_param($stmt, "i", $cmp) ?...
I noticed recently that there are two ways to print multiple statements in PHP.
echo $a.$b; // Echo's $a and $b conjoined, and
echo $a,$b; // Echo's $a and echo's $b.
Is there any point in time where the difference between these two syntaxes matters?
...
Hello..
I am doing a project in PHP which I am not very familiar. I am using a MVC framework (CodeIgnitor). I have noticed that each time I return a view that resulted from a longer/shorter url string all of my includes break. It appears that the paths are relative to url.
Is $_SERVER["DOCUMENT_ROOT"] the best way to generate include p...