php

Accessing a member of an object within a class in PHP

My code: class Address{ public var $Street; } class Employee{ public var $ID: public var $Name: public var $Address; } $myEmployee = new Employee(); $myEmployee->Address = new Address(); How do I access the the street now? $street = $myEmployee->$Address->Street; $street = $myEmployee->Address->Street; Both give me...

How to put an image url from internet in tcpdf file?

Hi I want to put an image into the pdf file I'm making using TCPDF. It is an image generated by an online API so I cannot store in my webhost. But when I put the image url for creating i'm getting error while generating the PDF file. ...

What Wiki Will I Want?

Duplicate of What is the best open source wiki system ? I need to setup a closed-wiki system, i.e.: Any user can view everything Only registered users can contribute Even then their contribution must be approved by a moderator/editor/administrator before it is displayed to the public. Anyone know of a wiki (preferably open sour...

Sending emails to multiple subscribers with the Zend Framework

I think I must be doing something wrong here because my code only sent an email to the last subscriber in the table. When I log the array of subscribers, its obvious that there are more than one that it is trying to send to. I think the problem has to do with trying to batch them together...What is the best way for me to do this? I'm try...

capturing echo into a variable

I am calling functions using dynamic function names (something like this) $unsafeFunctionName = $_POST['function_name']; $safeFunctionName = safe($unsafeFunctionName); // custom safe() function Then I am wanting to wrap some xml around the returned value of the function (something like this): // xml header etc already created $resu...

PHPDoc type hinting for array of objects?

So, in PHPDoc one can specify @var above the member variable declaration to hint at its type. Then an IDE, for ex. PHPEd, will know what type of object it's working with and will be able to provide a code insight for that variable. <?php class Test { /** @var SomeObj */ private $someObjInstance; } ?> This works great unt...

Zend Framework Zend_Form Decorators: <span> Inside Button Element?

I have a button element that I've created like so: $submit = new Zend_Form_Element_Button('submit'); $submit->setLabel('My Button'); $submit->setDecorators(array( 'ViewHelper', array('HtmlTag', array('tag' => 'li')) )); $submit->setAttrib('type', 'submit'); This generates the following HTML: <li> <label for="submit" clas...

Is it possible to split the file contents using a custom pattern?

Hello, Is it possible to split the contents of file into parts that have specific pattern? This is what I want to achieve: Read the file using file_get_contents Read only contents between similar commented areas. I am not sure how complicated is that but basically If I am parsing a large html file and want only to display to the br...

Possible to remove extentions on php pages?

When I go to some websites I notice that there is no file extension on the page. Actually, this site is a proper example. Anybody know how this is done? :] ...

How does OOP manage to 'include' classes stored in different files

I'm trying to move into OOP development and am turning to here as I'm sick of searching the web and finding only the very basic information about what classes are and how they can inherit from each other - that I understand. What I don't understand as yet is how all these classes can be stored in different files, doted around a folder s...

Run a php app using tomcat?

Is it possible to run a php app using tomcat? Before you tell me to just use httpd, I already have a java application running on my webserver at host/myapp. Now I want to install RoundCube at host/roundcube. One is php however and one is java. I keep seeing offhand references saying this is possible but no real instructions. No, I do not...

JSP or JavaScript equivalent to PHP's $_SERVER["HTTP_HOST"]?

I've go an absolute URL in my JavaScript that I have hard coded for window.location. I don't want to have to change this every time I am testing my app. In PHP I would have handled this by testing the $_SERVER["HTTP_HOST"] variable to find out what server I am on, and adjust accordingly. However, I'm not as familiar with Java and am won...

Get contents from radio button array in email

Hi, I have a sendemail.php set up for sending me information from a form. The way I have it set to send the information is with $_POST['variable name'] I cant figure out how to show the choice of a radio button array in the email that is sent to me. Thanks for any help. ...

Suppress or catch() invalid function call - PHP

Have a series of functions I am calling dynamically sort of like this: $function = 'someFunction'; $x = $function(); .. however, if the function expects parameters, and I don't code it in the call, I seem to crash the page. For example: function someFunction( $in_param1 ) { return "SUCCESS"; } $function = 'someFunction'; // this n...

Passing arguments to the Class Constructor

How can I pass a arbitrary number of arguments to the class constructor using the Object() function defined below? <?php /* ./index.php */ function Object($object) { static $instance = array(); if (is_file('./' . $object . '.php') === true) { $class = basename($object); if (array_key_exists($class, $instance) =...

Requiring SSL for the database connection for MediaWiki/Apache/PHP/MySQL with OpenSSL

Hi, For a school project, I have installed MediaWiki on my local machine, and am required to have any database connection to the local MySQL database use SSL. I am unsure of how to connect all the dots. Here's what I have done so far: I have installed OpenSSL, and created a self-signed certificate, and associated keys. phpinfo() sho...

WebDav connection/authentication with PHP

Okay, so the PHP script exists on serverA. ServerA has php safe-mode ON and WebDAV OFF. I can't change either of these factors. I want a script on serverA to get the user's login/password for another server, which we shall call serverB. ServerB has WebDAV ON. The ultimate goal is that the user will go to the script on ServerA, put in t...

insert multiple rows via a php array into mysql

I'm passing a large dataset into a mysql table via php using insert commands and I'm wondering if its possible to insert approximately 1000 rows at a time via a query other than appending each value on the end of an mile long string and then executing it. I am using the codeigniter framework so its functions are also available to me. ...

Connect database from other computer

I'm using PHP with MySQL database. The PCs are having a network to each other. My problem is I want to connect to the MySQL database on another computer. I want to store data on that MySQL database from another computer. How could i possibly do on this? Thanks so much for any suggestions. ...

Cut string before a symbol with php

How can I cut the string before '(' sign with php For example: $a = "abc dec g (gold)"; How can I cut the string become only "abc dec g"?? I tried to used this strstr($a, '(', true) but error display. ...